#Timeline for 2D?

1 messages · Page 1 of 1 (latest)

junior copper
#

Is there a timeline for when 2D graphics will supported? What is the current way to accomplish 2D sprite rendering?

solid token
#

nope, it's not on the roadmap

#

There's a community made package called nsprite if you want a fully dots sprite renderer

#

Or you just use companion gameobjects

junior copper
#

Thanks! What exactly is meant by companion gameobjects? Is there a quick guide on how they are setup? Do I have gameobjects which reference Entities and then a managed script that just copies position every frame from the entities to the gameobjects?

#

Will this be more or less performant than the NSprites approach?

solid token
#

it's more the other way around

#

you have an entity with a managed IComponentData which points to the connected gameobject

#

I imagine NSprite would be more performant

#

the issue i think is if you want a lighting system

#

since 2d lights won't affect them (pretty sure though i've never tried)

#

@upper salmon might be able to help out (NSprite creator)

junior copper
#

Thanks so much for all the info! That's very helpful

#

Does unity actually plan to support 2D at some point. 3D is fully supported in DOTS already, right?

solid token
#

i'm very much a beginner when it comes to the lighting system

solid token
#

so probably not for a few years

junior copper
#

Because it sounds like just using 2D gameobjects (only their drawing should be quite highly optimized already) and then copying once per frame should not be sooo terrible

solid token
#

typical Unity timeframes

junior copper
#

haha

#

Still odd given that most people probably use Unity for 2D

#

But maybe gameobjects is enough for 2D since drawing performance is not such an issue

#

But I do understand it right that the default ECSsamples actually convert everything to entities when rendering 3D, there is no hidden companion gameobject trick happening?

#

Same for physics?

solid token
solid token
junior copper
#

So I could just use 3D physics for spacial queries etc., and hope the gameobjects will be performant enough, which they probably will

solid token
#

there's no 2d version for physics either

junior copper
#

Hmm sad that 2D is so much behind, but still great that they are pushing the ECS stuff, its great fun

#

Thanks for all the help!

upper salmon
#

Hi @junior copper ! Hi @solid token , thank you for sharing!

  1. Hybrid approach is something comes in when you want to have unity ECS architecture and gameobject base part of implementation. Though it brings lots of problems which conflict with main idea of using DOTS and the main thing is - less performance. Every hybrid entity (except static ones) will access to gameobject's transform and copy the value. some time ago (maybe it is fixed for now, I don't know) those companion systems was designed horrible, like producing garbage every frame and make not optimised calculations, I've even fixed it a bit, when I was using hybrid approach a lot (entities version 0.17).
#
  1. Using NSprites of course gives you pure ECS approach of sprite rendering, and it is already more performant than using regular SpriteRenderer. But it's not the most important thing in terms of performance. NSprites requires from you using instancing compatible shader, which brings lots of optimisation! Instancing isn't DOTS thing by itself, but you can render incredible instance count with instancing. You can try to render 1000 sprites with instancing (not necessarily using NSprites) and with regular SpriteRenderer and see the difference.
  2. Lightning system and other stuff can be implemented with NSprites. Again NSprites wants from you instancing compatible shader, that is all about compatible with any kind of rendering. If you want light for example with using URP / URP 2D you should see how light data comes to shaders and implement it with your own shader. You can face some difficulties because we deal with instancing and things can be made different.
    This section is relative to any feature you want to implement. NSprites by itself is a very pure solution which just render instancing reading data from entities.
    I'm slowly working on my 2D game and I want to bring light to it. I have Smart2DLightning package and I will adapt it to use with DOTS and NSprites, so in future I can share what can be done with lightning.
  3. Overall I want to say again that NSprites is pure solution without any kind of built-in everything! There are also Age-of-Sprites (sample project using NSprites) and NSprites-Foundation (package which share my way of using NSprites). Using NSprites from scratch you will need to implement register system / instancing compatible shader / prepare material assets / implement any features you want like sorting / culling / animation / etc. Sounds difficult, but if you want to render thousands of sprites difficulties worth it entity