Escaping the "2D Nightmare" by switching to 3D ? Please help !

Hey guys ! :slight_smile:
So I’ve been working on my 2D game for a while now and I’ve been trying a lot of different setup to get my graphics to look how I want it to look… but there is always something that doesn’t work !

I was working with 2D Renderer, but there were too many problems, I switched to URP at the moment but…

What I’m trying to create is close to the new “2D standards”, such as Hollow Knight or Tails of Iron.
And I suspect that both of those games are using the good old Built In Renderer, but first =

We need then a few “graphics features” in our game, let’s break it down quickly :
:sunglasses:

  • Parallaxe :
    We will need to work in a 3D world, sure Sprites can do that, but Sorting Layer is just impossible to use in a real life scenario with multiple Sprite layered on the Z axis. Rendering the sprites by Z depth and leaving all Sprite Sorting to default is quite a good solution for Z ordering… except that it makes the 2D Light system completely unusable, as the lights will affect all the Sprites no matter their depth in the scene.

  • Depth of Field/Blur :
    There seem to be just NO WAY to create a DoF shader for Sprites in URP or 2D Renderer, I’ve looked everywhere, was ok to pay big money on the assetstore, nothing. All those nice shaders used to work on the Built in Renderer.

- Lighting :
2D Lights are cool when the setup allow them, they need Sorting Layers to work properly, and we just made clear that Sorting Layers cannot be used in a “complex” or large setup, so, what options do we have here ?

Conclusion and Questions :
That being said, it becomes apparent that I have 2 problems here :
1/ The new URP and 2DLights are terrible to work in a “3D like” environment or parallaxe camera setup
2/ Sprites are still not good for Lights and DoF Shaders

Which makes me think that I should probably go the 3D way, in the Built In Renderer.
I was thinking about displaying my Sprites on Quads, using 3D Lights, and actually working DoF Shaders.

Do you guys have any advice on how to convert my project to this new setup ?
Do you have alternative ways of achieving what I’m looking for ? :roll_eyes:

Any help would be greatly appreciated ! :wink:

It just so happens they discuss how they used 2D Lights in this little video here.

https://www.youtube.com/watch?v=0iKhPM-wrpQ

Hope that helps.

1 Like

Hey @Lo-renzo ! Thanks for the link :wink:

It just so happens that they discuss how many complex custom editor scripts they had to built to be able to use those 2D features !! :smile:

They even say that they modify 2DLights so the lighting can auto-set the Sorting Layers.

Also, it seems like they were not able to implement a Depth of Field feature, I could be wrong but it seems like only the first foreground with specific assets are blurred (and probably baked blur in photoshop).
Their “fog system” is very clever and kind of create a sense of depth so well that you think there is DoF, but if you look closely : assets in the background are NOT blurred.

It just adds to my point : if you are making a complex game with a lot of layering, the system just does not work right now. You have to expand on the system and create a lot of stuff, and you have to give up on the depth of field if you want to stay 2D in URP.

I’m not really trying to make a point here though, if I’m wrong and that you can provide help to make it work, I’d be thrilled !

And if I’m better of going 3D (with Quads/UVs, normal Lights, DoF Shaders), any help would also be appreciated :slight_smile:

1 Like

It’s hard for anyone outside of your project to guess what your workflow and runtime requirements are so at best their suggestions will be biased towards their own projects. I don’t have any experience with the 2D stuff so I can’t say what you can and can’t do with it and how well it works in comparison to using built-in or 3D with URP. But I have used the 3D built-in and 3D URP stuff to do 2D-like graphics with reasonable ease and success. It likely depends on your use-case and requirements.

I’d suggest setting aside a few days, maybe a full week and try to come up with an MVP using the built-in. Then compare the pros and cons with what you are currently doing. This will give you a much better idea of how it will work with your requirements.

1 Like

I know that it’s definitely possible to do everything you want in Built-in 3D, but I don’t know enough about the URP 2D renderer to say how much easier it might be.

The only way I know of to convert a URP project to built-in is the manual way- converting each material and redoing the lighting. If you’re not using source control, you might want to make a copy of your project before trying to convert it, so that you can go back to original if you change your mind.

1 Like

Thanks for your inputs guys, appreciate it :slight_smile:

I’m exploring the possibility of “converting” my sprites to quads, but it seems like setting the packed texture UV to the different quads is not trivial at all. I can think of some runtime manipulations but setting up a complex scenes without seing your visual is not possible… Can you set the quads uv in a more easy way, in the editor ?

Definitely gonna try on a mock up 3D project, good idea :slight_smile:

The editor has no built-in facility for editing UVs. You would either need to write a script or use a plug-in like Probuilder.

Probuilder is free btw. Even though it’s UV editing is not very good, mapping a quad to a portion of an image is basic enough that it should be easy with Probuilder.

1 Like

Good to know,
but that sounds like a pretty tedious workflow if you’re building a complex multi layered game with a lot of “sprites”…
Or maybe if you do it just once per “sprite” and then re-use them as prefab, it could be ok

To save time and edit the scene more easily, it might worth considering building the scene with actual Sprites and creating Quads at runtime to replace the sprites with meshes for depth of field, what do you think ?

Well of course. It would be no different than if you did a 3D game. You’d set-up an object once and reuse it whenever you needed that object. Creating every quad in your game from scratch would be a pretty absurd amount of unnecessary work.

Would it? I don’t understand how placing a sprite is any easier than a quad, unless you were using the tile-map editor or something.

Well, considering the sprite texture would come from an atlas, it sounds easier to drag it into the scene than creating a quad and assigning its mesh the correct UVs from the atlas texture.

I never used quads before though, so I might be overthinking it :slight_smile:

You can make prefabs, like you already suggested. For each “sprite” in your atlas, map it to a quad and then make that a prefab in a folder in your project tab. So I guess there’s a little bit of setup, but then dragging out a prefab into your scene will be just the same as dragging a sprite into your scene.

Since you’re using atlased textures. You only need to create one material for the whole atlas and any prefab for that atlas can use the same material. For environment art, you can even combine the meshes that use the same material at runtime for performance:

1 Like

Very nice suggestion, thanks a lot !