Hello,
I have a few questions about Nanite Foliage, more specifically about the TwoSidedSign implementation for Nanite voxels.
GetNaniteVoxelTwoSidedSign (from NaniteVertexFactory.ush) currently always returns +1, meaning everything is regarded as front-face. This can cause issues with many two-sided foliage assets, not looking as they should when the geometry is switched to voxels For example because they darken albedo based on face orientation.
There is a even VOXELTODO there to implement it.
float GetNaniteVoxelTwoSidedSign(FInstanceSceneData InstanceData, FNaniteView NaniteView, FNaniteTransformedVert Vert)
{
// VOXELTODO
// Hack to determine TwoSidedSign from normals for voxel. Doesn't work well with trees that bend normals for shading
const float3 WorldNormal = mul(Vert.TangentBasis.TangentZ, DFToFloat3x3(InstanceData.LocalToWorld));
float Dot = dot(WorldNormal, NaniteView.ViewForward);
//return Dot < 0.0 ? -1.0f : 1.0f;
return 1.0f;
}
I tried enabling the commented-out normal test, but it looks that TangentBasis.TangentZ contains the principal axis of the fitted SGGX distribution rather than an oriented mean normal. So it appears to have an arbitrary sign.
Also, SGGX_Dvis uses saturate(VoM), which appears to restrict the normal to be camera-facing.
So my questions are:
1) Are there plans to implement GetNaniteVoxelTwoSidedSign properly?
2) Am I correct in saying the axis stored in TangentZ is really arbitrary? Or I am missing something?
3) It seems that it should be possible to at least store the axis orientation without any additional memory overhead. Is there a reason that was not done, or is it simply not done yet?
It seems that the idea was to sidestep this issue by using the currently disabled analytic SGGX shading path (using the currently disabled NANITE_USE_ANALYTIC_SGGX path). Looking at it closer the raw NDF axis would be stored in its own GBuffer channel and later used to evaluate during deferred lighting.
4) Is my reading of the analytic SGGX path correct?
5) What’s the status of the analytic SGGX shading path? The documentation at https://dev.epicgames.com/documentation/unreal\-engine/nanite\-foliage seems to say that this feature is upcoming.
6) Is the analytic SGGX path expected to work with Substrate? Some of its current gating still refers to the old MATERIAL_SHADINGMODEL_TWOSIDED_FOLIAGE. Is missing Substrate integration the reason the path remains disabled?
Thank you.
[Attachment Removed]