Some Trouble with depth texture

Good morning nasimiasl!!!
This is PG:
It is probably that BBL use an override vertexShader to draw PBRMaterial’s depth map
I use static input positionUpdated.y+=3.;, it is not work too

1 Like

you need change the depth shader code
but if you explain the target maybe i can make it without postprocess

Many postprocess effect need depth texture, such I think I have to know how to change the depth shader code. Could I change one material’s depth pass? Vertex Shader animation maybe use it to provide correct depth map too

you can have your depth channel use by RenderTarget and sec material

I used to write Unity Shader Language, it contain a depth pass to calculate vertex, maybe I need to write something like that to get the correct depth’s gl_Position, but I don’t know how/where to write

you need find the vertex shader of main material and use the same vertex shader in calculate depth material in the rendertarget for each mesh

Do you mean I need to write a custom rendertarget to getDepthMap instead of scene.enableDepthRenderer?

yes let me make demo

Thank you very much!!! I am reading how BBL renderDepth :star_struck:(DepthRenderer.ts)

i write a sample with shaderbuilder for just calculate wpos without depth

1 Like

Thank you for your demo!!! I think I know how to do it, I will have a try today!!! :star_struck: :star_struck: :star_struck:

Ohhhhhhh, I get it!!!

I rewrite the DepthRender, hahaha, I store depth shader infomation in material, then recognize them in isReady to support custom depth pass.

@nasimiasl @sebavan Thank you all!!!
Ghost shadow is Fix!!!