I want to make material with point light omnidirectional shadows as line of sight.
I’m rendering depth cubemap and managed to project it onto meshes by directional vector from Scene capture to pixel in space. This looks fine.
I’ve tried to compare depthmap with simple distance from caster to pixel, but they look off, projected depthmap have visible square faces while distance map from caster to pixel is smooth sphere.
How can i now compare pixels for occlusion? Is my sphere projection off?
Cubemap to world projection looks like this (divided by 5000 for readability)
Cubemap/Pixel distance comparison plus some offsets plus backface mask - looks like this now, there is this visible cross because of cube/sphere mismatch.
think of the cubemap as 6 stitched scene captures, whose scene depth is computed from the perspective matrix which results in something like a ‘rectangle view’ such as of a camera.
instead of storing the cubemap depth try storing the distance from each pixel position to the origin (as easy as in your capture material replacing scenedepth with vector length of worldposition) and you should get an omnidirectional depth from the light rather than 6 stitched perspective depth captures. then the distance from caster to pixel should match
If i understand i need to render WPcaster to WPpixel vector length and render this data to RenderTargetCube instead of storing SceneDepth from caster perspective. How can i do that? AFAIK there is no way to use PP material on SceneCaptureCube component as we can in SceneCapture2D
right, you’d need a postprocess material on the scenecapturecube. my bad, I wasn’t aware that scenecapturecube still doesn’t allow postprocess materials.
I did what you’re trying some time ago in UE3. I thought by now UE4 would have them