Hi guys,I’m trying to render some building in unreal,the requirements are simple the building top and wall color can be translucent but a face won’t blend with internal faces in side building.
So I tried to use CustomDepth to cull internal faces inside buildings.What I did is enable Custom Depth Write on the material and component,then in the material I compare PixelDepth with CustomDepth, if PixelDepth is smaller which means the pixel is actually closer to the camera so that we set opacity to regular value,otherwise set opacity to 0.
It works fine if the camera is close to the building,however when the camera move away the building seems to be culled beacuse of the comparison returned wrong value. I think it’s beacuse of the precesion of depth,So I changed the bias in PixelDepth according to the distance between the camera and pixel in world spcae, divide by -200 means of bias of 0.5%in depth.But it still works not very well when far, As you can see in the picture below,the buildings should be a rect,but now it’s like a triganle,the top half was culled
Has anyone encountered similary problem?