So I have a tile layer which is constructed in code, and a background layer which sits behind this tile layer which up until now was using a Diffuse material.
Im experimenting with this background image atm by changing it’s material to Transparent/Diffuse, however no matter where it sits in a 3d space it always renders on top of the tile layer.
The background image is child of the Camera so it moves with it at all times. The tile layer is created in the asset root.
FYI the material for the tile layer is also Transparent / Diffuse as well.
Here is the code used to create the tile layer’s MeshFilter / Mesh
how about you create another camera, give it a different depth, youse your background only with this camera, by using layer filtering.
now set the main cameras clearing to depth only.
Although i don´t know why you need to use a transparent background (being a background there is usually nothing behind it, so why transparency) i can assure you that depth sorting with transparent materials is, let´s say, difficult.
There is a way to tweak the transparent shader by using something like this:
Tags {“Queue”=“Transparent+1” “IgnoreProjector”=“True” “RenderType”=“Transparent”}, and experimenting with these two flags:
//ZWrite On
//Cull Off
Ahh thanks marjan… Will look into tweaking via the settings you provided.
The reason for the background wanting transparency is so I can add another layered background behind it. I just simplified the example to make it easier to debug…
The thing is, if i create a third background layer with transparency as well, the two midground layers behave as expected (i.e. changing the z depth makes one draw on top of the other etc).
The problem seems to be with this custom tile layer mesh im generating from code, it just refuses to draw on top of any other transparent layers in the scene.
EDIT: Managed to get it to behave by changing the transparency type of the layer to be transparent/cutout. Yes it looks rather ugly but as soon as I use proper transparency it jumps / renders to front of the scene.