- Home /
Skybox rendered over sprites in reflection
My scene has:
A Skybox (under everything):
"Queue"="Background"
"RenderType"="Background"
A Unity Terrain:
"Queue" = "Geometry-100"
"RenderType" = "Opaque"
Billboarded Sprites (SpriteRenderer.orderInLayer values are > 0 so they always render above the Terrain):
"Queue"="Geometry"
"RenderType"="Transparent"
Particle Effects (over everything):
"Queue"="Transparent"
"RenderType"="Transparent"
The problem occurs in water reflections (using Low Poly Water GPU) . The water script uses a separate reflection Camera which renders to a RenderTexture applied to the water surface. Seems straightforward.
Without the skybox, the Sprite plants appear over both Terrain and black sky in the reflection:
With a skybox, the plants disappear. They appear over the Terrain, but BEHIND the skybox clouds in the reflection (I think):
Looking at Frame Debug just confused me further. It lists the draw order as:
Render.OpaqueGeometry
Camera.RenderSkybox
Render.TransparentGeometry
So the Skybox is ALWAYS rendered after Geometry? Then how does it end up behind the sprites aboveground, and over them in the reflection? And consistently behind the Terrain in both cases?
Is this something to do with Stencils? Or in how Skyboxes are connected to Cameras? Or is it due to the Transparent RenderType?
I CAN work around by setting the sprites to "Queue"="Transparent" and making their SpriteRenderer.orderInLayer values negative so they will render below the particle effects. But I'd still like to understand why the two camera renders differ and whether there is a better way to make the skybox behave correctly with my sprites on the Geometry layer.
Your answer
Follow this Question
Related Questions
Gradien Skyboxes problem 0 Answers
Skybox reflections stopped working. 0 Answers
Transparent Shader Render Order Issue 0 Answers
Uniform Texture, Rendering Problem 0 Answers
A little Shader rendering problem 1 Answer