publicstaticGUIContentmaterialIDText=newGUIContent("Material type","Subsurface Scattering: enable for translucent materials such as skin, vegetation, fruit, marble, wax and milk.");
publicstaticGUIContenthorizonFadeText=newGUIContent("Horizon Fade (Spec occlusion)","horizon fade is use to control specular occlusion");
// Per pixel displacement
publicstaticGUIContentenablePerPixelDisplacementText=newGUIContent("Enable Per Pixel Displacement","Per pixel displacement work best with flat surfaces. This is an expensive features and should be enable wisely. Typical use case is paved road.");
publicstaticGUIContentppdMinSamplesText=newGUIContent("Minimum steps","Minimum steps (texture sample) to use with per pixel displacement mapping");
protectedconststringkMaterialID="_MaterialID";
protectedconststringkStencilRef="_StencilRef";
protectedMaterialPropertyhorizonFade=null;
protectedconststringkHorizonFade="_HorizonFade";
// Wind
protectedMaterialPropertywindEnable=null;
// MaterialID
materialID=FindProperty(kMaterialID,props,false);// LayeredLit is force to be standard for now, so materialID could not exist
publicstaticGUIContentbentNormalMapText=newGUIContent("Bent normal map","Use only with indirect diffuse lighting (Lightmap/lightprobe) - Cosine weighted Bent Normal Map (average unoccluded direction) (BC7/BC5/DXT5(nm))");
publicstaticGUIContentbentNormalMapOSText=newGUIContent("Bent normal map OS","Use only with indirect diffuse lighting (Lightmap/lightprobe) - Bent Normal Map (BC7/DXT1/RGB)");
publicstaticGUIContentheightMapText=newGUIContent("Height Map (R)","Height Map.\nFor floating point textures, min, max and base value should be 0, 1 and 0.");
publicstaticGUIContentheightMapCenterText=newGUIContent("Height Map Base","Base of the heightmap in the texture (between 0 and 1)");
float4 opacityAsDensity = saturate((inputAlphaMask - (float4(1.0, 1.0, 1.0, 1.0) - blendMasks.argb)) * 20.0); // 20.0 is the number of steps in inputAlphaMask (Density mask. We decided 20 empirically)
// Note: If per pixel displacement is enabled it mean we will fetch again the various heightmaps at the intersection location. Not sure the compiler can optimize.
// If any layer use a bent normal map, then bentNormalTS contain the interpolated result of bentnormal and normalmap (in case no bent normal are available)
// Note: the code in LitDataInternal ensure that we fallback on normal map for layer that have no bentnormal
// If there is no bent normal map provided, fallback on regular normal map
bentNormalTS = normalTS;
#endif
return bentNormalTS;
}
float ADD_IDX(GetSurfaceData)(FragInputs input, LayerTexCoord layerTexCoord, out SurfaceData surfaceData, out float3 normalTS)
float ADD_IDX(GetSurfaceData)(FragInputs input, LayerTexCoord layerTexCoord, out SurfaceData surfaceData, out float3 normalTS, out float3 bentNormalTS)
// This function convert the tangent space normal/tangent to world space and orthonormalize it + apply a correction of the normal if it is not pointing towards the near plane