hello, what is most up to date methods to start with 2D and DOTS/ECS package?

hello, i am currently find and watching amazing tutorials one 2D DOTS/ECS (using actual quad texture mesh gpu instance rendering with custom shaders not built in sprite rendering):

currently i wish to test limits of 2D sprite rendering in unity but it is difficult for me to find the best current up to date ways for implementation in this (2021).

does anyone know step by step how besides documents such as:

https://philsa.github.io/rival-doc/tutorial.html

this asset developer has good tutorial for setting up raw working station project for ECS DOTS, but i am having difficult times searching for best 2D workflow set up… is only way for using ECS DOTS 2D, mesh renderer and custom shader? i read project tiny is not up to date for now, makes me sad.

I don’t think there is a clear 2D workflow yet. Hybridrenderer still seems really bad for sprites (creates a sprite hybridcomponent with an invisible Companion GameObject AFAIK). I really think it depends on how much time you want to spend on this. Either you do it all yourself specific to your needs or you go the hybrid route and wait until someone else creates something useful.
I decided to go the Hybrid route (with some adjustments) because its just good enough for my usecase right now.
If you want to draw hundreds of thousands of sprites you probably should implement your own solution.

2 Likes

Search the forum, there a two threads where we tested limits, tiltle is “???k sprites” and “1M sprites” or so…some year or two back…

1 Like

I would consider animating manually for right now. Code Monkey does have a DOTs sprite sheet animation video that is pretty good for the basics. I wouldn’t use Graphics.DrawMesh though.
If you have a sprite atlas, you can create a property in your shader to move through the sprites in the sheet (pretty standard stuff). Then, you can use custom material property overrides to animate the selection of sprites. That is what I did for this little test here:

More details about the general method in this thread:

And docs here:
https://docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.8/manual/index.html?&_ga=2.70664528.1964469126.1631914316-784402383.1631914316#custom-shadergraph-material-property-overrides

There is also an Entities 2D package, but I haven’t looked into it yet: 2D Entities | 2D Entities | 0.22.0-preview.8

2 Likes

ok thank you all i will make custom

That is extremely impressive, the Samus Aran sprite renderer you designed.

Are you willing to potentially sell this as an asset down the line?

Have you considered making a public demo just to show the concept in tangible form for Unity as an asset package?

I assume the technique pretty much boils down to efficient use of the GPU in rendering the image data?

Thanks. It is actually pretty basic. If you check out the other information I posted, you will see it is very easy to implement. Here is also a video on Material Properties that might be helpful.
I’m on the fence between 3D and 2D with my current project. If I go 2D, I’ll flesh this out more and post additional details.

2 Likes

Is this technique only for use with DOTS/ECS/Hybrid renderer? I was looking into more efficient means for rendering sprites in standard Unity environment.

Did you check the threads I mentioned?

afaik non of the solutions there is really maintained and the reason is that they are stress tests / very specific use cases. Non of them really depend on dots but they heavily benefit from ecs (data layout / iteration) jobs (parallel processing) and burst / math (sind, speed) + better graphic api (native containers / buffer access).

I think you have 3-4 solutions in the thread. At the time I considered the one I put there the simplest and most performant (except I kept it general and you can squeeze out more by pushing some calculations like ltw to the gpu and limit it to 2d) —those all do not have culling though or other hybrid renderer functionality - they simply rely on drawmeshinstancedindirect ie good to render much of the same

not sure if there are now more performant ways / better implementations….