So I tried a custom function node with the following:
void PBR_float(float3 positionWS, half3 normalWS, half3 normalTS, half3 viewDirectionWS, half3 bakedGI, half3 albedo,
half metallic, half3 specular, half smoothness, half occlusion, half3 emission, half alpha, half clearCoatMask, half clearCoatSmoothness, out float3 Color)
{
#if defined(SHADERGRAPH_PREVIEW)
Color = float3(1, 1, 1);
#else
InputData inputData;
inputData.positionWS = positionWS;
inputData.normalWS = NormalizeNormalPerPixel(normalWS);
inputData.viewDirectionWS = SafeNormalize(-viewDirectionWS);
inputData.shadowCoord = half4(0, 0, 0, 0);
inputData.fogCoord = 0;
inputData.vertexLighting = half3(0, 0, 0);
inputData.normalizedScreenSpaceUV = half2(0, 0);
inputData.shadowMask = half4(0, 0, 0, 0);
inputData.bakedGI = bakedGI;
SurfaceData surfData;
surfData.albedo = albedo;
surfData.specular = specular;
surfData.metallic = metallic;
surfData.smoothness = smoothness;
surfData.normalTS = normalTS;
surfData.emission = emission;
surfData.occlusion = occlusion;
surfData.alpha = alpha;
surfData.clearCoatMask = clearCoatMask;
surfData.clearCoatSmoothness = clearCoatSmoothness;
Color = UniversalFragmentPBR(inputData, surfData);
#endif
}
But I get weird results. The shadergraph preview output is all black no matter what (unless I set emission color to something above black, so it seems emission is the only bit that’s working). And the actual object in the scene that uses it is all black with random flickering white pixels. Super weird.
If I bypass this node and route all my other inputs directly to the output fragment node, it renders correctly (as correctly as you’d expect without lighting information). That is, textured, colored, not all black, etc.
Does anyone have an example lit node they can share so I can compare?