Global shadow map.

https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/LightMobility/StationaryLights/index.html#directshadowing

It says:
“Translucency also receives shadowing very cheaply with Stationary lights - Lightmass precomputes a shadow depth map from static geometry which is applied to translucency at runtime. This form of shadowing is fairly coarse and only captures shadowing on the scale of meters.”

Is that global shadow map some way obtainable in material nodes? It would be really handy to make real volumetric fog effects that does not need very high resolution shadows.

It could be similar that new DistanceToNearestSurface node. Even just saying where to find that texture would make me happy.

It’s per-light so can’t be accessed in a material graph - the engine uses deferred shading so materials are evaluated separately from lighting. However the source could be modified to pass in the directional light’s shadowmap. It’s called StaticShadowDepthMap in LightComponent.h. In TTranslucentLightingInjectPS::SetParameters you can find an example of how to bind that texture to a shader.

One thing you can do without any source modification is setup a scene capture from above to capture depth. I can’t remember exactly how you get depth atm, seems like it comes from a buffer visualization mode. Then you have the shadowmap in a texture. Of course, the tricky part is to setup the transforms so you can actually sample the shadowmap and determine if a point is shadowed or not.

Thanks for reply. I will test scene capturing. I will need to study out internals of UE4 so I can get more familiar with the pipeline. Currently there are not many ways to alter fog effects in flexible ways. Is there some plans for volumetric effects in the roadmap?

It would be really great to have some kind of volume texture based unified fog system. Like this one:
2014/08/bwronski_volumetric_fog_siggraph2014.pdf

Some mindstorming:

-Particles could inject density to cells.
-Fog material function could add animated noise density to cells.

-Lights could have “light fog function” so inscatter could be calculated per light per cell.

-At the end cells could be integrated with raymarching and total extinction + inscatter could be calculated.