#Duplicate sprite in shader to give it depth

1 messages · Page 1 of 1 (latest)

boreal grotto
#

I'm trying to duplicate a sprite in its SpriteRender's shader to make it look like it has some depth in 3D. I can achieve this by duplicating the GameObject and offsetting the Z position, but since I have hundreds of objects, I thought it would be more optimized if was made in a shader.
I'm using Built in pipeline with Amplify Shader.

deft nexus
#

What exactly does duplicating achieve here? Is this shadow related?

boreal grotto
deft nexus
#

If you want more geometry I'd just make a custom 3D mesh in that case

#

but I'd try out the duplication idea before digging too much in optimization as the dynamic batcher does pretty well considering

boreal grotto
#

Here in an example

#

The left grid is multiple sprite duplicated, the right one is one sprite

deft nexus
#

The left could just be a texture

boreal grotto
#

You mean painting the texture as it's 3D?

deft nexus
#

Yeah that's an idea, otherwise you can always throw in 3D models into your game even if it is 2D

boreal grotto
#

If you paint the shadows in the texture it's gonna look wrong when the camera moves

#

3D models works but it's more complicated, the idea is to give a bit of depth without having to make models for everything

#

It's like extruding the mesh and adding a little offset

#

I think

deft nexus
#

You've got parallax mapping and other types of texturing maps but not entirely sure how large of a workflow that would become

#

Basically you can do a lot of magic with normal maps

boreal grotto
#

I dont think it's gonna look as good honestly

digital quartz
#

The geometry doesn't matter for performance as much as the number of meshes and draw calls, more precisely

digital quartz
#

If you have to use 2D components, maybe having them on a tilemap renderer and duplicating that wins some performance as they're both rendered in one batch, but it might not be worth it to use sprites at all

#

I'm not sure what all the BiRP relevant technical details are but sprites don't tend to play nice with 3D lighting and probably not batching either

#

Two triangles per surface is a minimal cost to worry about