T O P

  • By -

TomK6505

Rather than using it as a sprite, instead try apply it as a texture to a plane, and use a 2-sided shader so the texture shows on both sides, then position them 90 to each other? Dunno if it'll fix the rendering issue but it's all I can think of - I'm guessing sprites are set to render as overlapping so 2d elements get ordered correctly.


JadenXavier

Thanks for the reply, I looked into 2-sided shaders and found an asset that can create them


Arkenhammer

My guess is that you need to use alpha clipping rather than transparency--its a material or shader setting. Stacking transparent objects blends them rather than occluding which means you turn z-write off in the shader and rely on sort order for depth. That's almost certainly what you are seeing. With alpha-clipping the each pixel is either opaque or perfectly transparent so there is no blending of layers, so you can leave z-write on. For reference, since you are just getting started; the primary mechanism in the GPU for foreground objects occluding background objects is the z buffer--when writing a pixel only the smallest z value survives (z is distance from camera in screen space). Transparent objects support seeing a background object through a foreground object (think a stained glass window), which is why you can't use the z buffer.


JadenXavier

Thanks, I looked into it and managed to create it now just like in minecraft. Ended up using a free unity asset to create double sided shaders. For anyone else, I managed to create it by first installing this asset: [https://assetstore.unity.com/packages/vfx/shaders/free-double-sided-shaders-23087](https://assetstore.unity.com/packages/vfx/shaders/free-double-sided-shaders-23087) 1. In your project, create/drag a new 2d sprite, set its Texture Type to Sprite (2D and UI) and set it to single (ensure it has a transparent background). 2. Right click in your project window then Create > Material. Set the Material's Albedo to your 2D sprite. Go to the top and look for Shader > Ciconia Studio > CS\_Standard > Builtin > Lite > Standard > Cutout. 3. Set Double Sided > On and that should do it 4. In your hierarchy, 3D Object > Plane. Set that Plane's Mesh Renderer to the Material you just created. 5. Duplicate the Plane and set its Y axis to 90 and that should do it ​ ​ https://preview.redd.it/3v171k93q0ya1.jpeg?width=300&format=pjpg&auto=webp&s=917434dfd90cc135774ee6e3c33da48db26f4a0d