Depth rendering question

Here is what I am wanting to do… however, I want to gauge the best approach prior to starting it.

My custom sky box (not a box), uses a few meshes…

hemisphere for night sky

hemisphere for day sky (dynamic alpha in the shader to fade from day to night)

2 hemispheres for cloud layers (shader is used to animate cloud movement and density)

All are in the Sky Bucket

I would like to render the materials as if the depth buffer matters, however, once the material is rendered, I would like to have the final output rendered as if in the Sky Bucket.

I am guessing my two choices are:

  1. Pre-render the material for each object with the depth buffer and then update the texture of the object in the sky bucket. This sounds a bit expensive.

    2-20. ???

    Any ideas about the best approach for this… or even if it is possible?

I guess extending the sky shader to use multiple maps is the best solution.


If the render bucket is set to sky, the depth buffer seems to be set to 1.0 before the shader rendering. I would like to set the depth buffer of the rendered output to 1.0 after the shader renders the material properly. What would be the right way to approach this?

I meant combining the maps in the shader, circumventing the depth issue by efficiently having just one material for the renderer to draw.


Sorry for the confusion, but if I can’t render the texture with depth, I have nothing to map.

What I mean is: Normally the shader renders the sky texture(s) to the sky. You want multiple shaders to mix their output. What I suggest is that you modify one shader so that it loads and paints all of your textures in one pass. You can define the order (and mix type) yourself as you know the textures by their map name in your shader.

1 Like

Note: Just in case this wasn’t already known… the sky bucket is rendered AFTER the opaque bucket.

…I don’t know if that screws up your plans at all.

1 Like

I agree with normen. I work on some sky stuff myself. A couple of cloud layers and day/night sky is no problem for 1 material/dome to handle (unless there are advanced volumetric clouds but they need their own mesh anyways). Just divide everything up properly between vert and frag shaders.

Thanks for all the help. Yeah, I did end up condensing all down to a single hemisphere… the reason I had them separated was for ease of changing code until I was happy with the results.

I ended up using a mask to produce the effect I was looking for (bypassing the need for the depth buffer). It was the final step in seamless fog simulation using shaders.

I’ll post a vid of the final effect soon(ish).

1 Like