Antoshidza / NSprites

Unity DOTS Sprite Rendering Package
Other
536 stars 42 forks source link

Add Example Render #1

Closed xentripetal closed 1 year ago

xentripetal commented 2 years ago

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

Antoshidza commented 2 years ago

Hi @xentripetal!

I'm currently working on huge revision of this system, so there is no documentation here, it is very raw package you can still use though with 0.50 Entities package. You can see future changes in "rework-buffer-management" branch (name doesn't reflect all meaning). For example 2D Transforms / Sorting was removed from package's core and will be provided as separate package or simply through gists.

Still basically the core principles remains the same. Render archetype implementation is really whatever you want to use to keep data you need to pass to SpriteRenderingSystem. In my project it is ScriptableObject with material/instanced properties names/matrices property name (deprecated) which I then use with SpriteRenderingSystem.RegistrateRender().

Here is compatible shader with this package on main branch. I will update this gist with future updates. The main thing in this shader is StructuredBuffer<T> _propertyName which should be registered as instanced property

I'm very glad you find this work helpful 😊

Antoshidza commented 1 year ago

Hi again @xentripetal

I've done with system rework and finally have written basic documentation, you can read it in ReadMe and repo's wiki. Still it is not render example but it is far simpler to figure out how to work with system.

Though my next step is to provide example project.

Antoshidza commented 1 year ago

Hi @xentripetal !

I've finally implemented sample project. There is an example of how to

xentripetal commented 1 year ago

Thank you! That is seriously a great demo and thorough documentation.