Giter VIP home page Giter VIP logo

nsprites's People

Contributors

antoshidza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nsprites's Issues

use compute shader + bitonic sort to compute sorting order

The rendering performance is impressive but I noticed that computing sort value is slow compared to the rendering.

Maybe the sorting work could be done on GPU and the result could be consumed in sprite shader thus no CPU is involved.

I found this repo https://github.com/hiroakioishi/UnityGPUBitonicSort/tree/master and have a simple performance test:

3 GHz 6 core Intel Core i5
Radeon Pro 570X 4 GB
Unity 2021.3.14
Running in Editor

buffer size: 262144
sorting cost (no ComputeBuffer.GetData): 0.0783 ms

Suggestion: Compatibility with various renderpipeline and use cases

This is just a suggestion.

The following line uses Graphics to draw.

Graphics.DrawMeshInstancedProcedural(_mesh, 0, Material, _bounds, _entityCount, _materialPropertyBlock);

This would result in unexpected drawing order when drawing in a sophisticated environment such as having multiple cameras.
Would it be better to use a command buffer to perform the draw operation and add it to necessary pipeline?

One could also add it back to Graphics when desired
https://docs.unity3d.com/ScriptReference/Graphics.ExecuteCommandBuffer.html
or add to specific desired camera
https://docs.unity3d.com/ScriptReference/Camera.AddCommandBuffer.html

This would provide support for hybrid rendering

Supporting Multiple Animations in the Same Sprite Sheet

Thanks for NSprite.

I have a sprite sheet with multiple animations. I was wondering if you'd consider skipping "0 second length" frames in SpriteUVAnumationSystem. So, "walk" could be frames 0-3 and "idle" could be frames 4-7.

Here's one proposal to check the nextFrameDuration. I would add an escape clause to the loop in case someone accidentally create an AnimationSet where all frames are set to 0.

A better way might be to change SpriteAnimatedRendererAuthoring to not load them into the animationSet. That would avoid checking each frame.

            if (timerDelta >= 0f)
            {
                ref var animData = ref animationSet.value.Value[animationIndex.value];
                var frameCount = animData.FrameDurations.Length;
                frameIndex.value = (frameIndex.value + 1) % frameCount;
                var nextFrameDuration = animData.FrameDurations[frameIndex.value];

                ////// added.  Would need an escape clause in case all frames are set to 0.
                while (nextFrameDuration == 0f) 
                {
                    frameIndex.value = (frameIndex.value + 1) % frameCount;
                    nextFrameDuration = animData.FrameDurations[frameIndex.value];
                }

                if (timerDelta >= animData.AnimationDuration)
                {
                    var extraTime = (float)(timerDelta % animData.AnimationDuration);
                    while (extraTime > nextFrameDuration)
                    {
                        extraTime -= nextFrameDuration;
                        frameIndex.value = (frameIndex.value + 1) % frameCount;
                        nextFrameDuration = animData.FrameDurations[frameIndex.value];
                    }
                    nextFrameDuration -= extraTime;
                }

RenderArchetype.cs has wrong encoding on macOS and invalid characters

Opening the sample project or trying to use the package on macOS (tested on M1 Pro, macOS Monterey) fails to compile and shows multiple errors in the console like: "Library/PackageCache/com.tonymax.nsprites@aedf3b9/Rendering/Common/RenderArchetype.cs(205,71): error CS1519: Invalid token '�' in class, record, struct, or interface member declaration"

converting the encoding in Rider for example to UTF8 does not fix the issue.

edit: seems to be the "C" character in "ChunkBaseEntityIndices" is invalid/corrupted

Sprites doesn't get rendered before 1st reallocation

How to reproduce:

  • create new project 3D URP + NSprites + NSprites-Foundation
  • create only on gameobject in subscene with SpriteRendererAuthoring
  • create at least 1 sprite entity but less then initial buffer capacity (128 in foundation package)
  • all properties should be registered as EachUpdate

Sprite not rendering when use SpriteAnimatedRendererAuthoring

I'm using 1.016 Entities and Entities Graphics with NSprite 4.0.0 and NSprite Foundation 6.0.3

WX20240227-150653

SImply add one GameObject to the subscene and add SpriteAnimatedRendererAuthoring with those Animation from Age-of-Sprites Project, the Sprite Frame Animation dosen't show as expected neither editor mode nor runtime mode

WX20240227-150726

Add Example Render

It would be helpful to have an example implementation of a valid render archetype or shader. I'm unsure how to handle the matrices property in a custom shader.

p.s. I really appreciate you working on this and making it public! Its a very noticeable gap in the DOTS ecosystem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.