Hi
I’m trying to write a custom lit shader for Forward+ Rendering for Entities Graphics. Currently when I try to implement the light loop using the macros for FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
#if USE_FORWARD_PLUS
for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex)
{
FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
Light light = GetAdditionalLight(lightIndex, inputData, shadowMask, aoFactor);
#ifdef _LIGHT_LAYERS
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
#endif
{
lightingData.additionalLightsColor += CalculateBlinnPhong(light, inputData, surfaceData);
}
}
#endif
I crash the Editor (2022.3.4).
========== OUTPUTTING STACK TRACE ==================
0x00007FF7BEEEDB2B (Unity) GfxDeviceD3D12Base::smile:rawBuffersCommon
0x00007FF7BEEECEBE (Unity) GfxDeviceD3D12Base::smile:rawBufferRanges
0x00007FF7BEEED140 (Unity) GfxDeviceD3D12Base::smile:rawBuffers
0x00007FF7C05242A2 (Unity) GfxDeviceWorker::RunCommand
0x00007FF7C0526CDB (Unity) GfxDeviceWorker::RunExt
0x00007FF7C0526DF8 (Unity) GfxDeviceWorker::RunGfxDeviceWorker
0x00007FF7BEB69AF7 (Unity) Thread::RunThreadWrapper
0x00007FF9D479257D (KERNEL32) BaseThreadInitThunk
0x00007FF9D5CEAA68 (ntdll) RtlUserThreadStart
========== END OF STACKTRACE ===========
The default SimpleLit shader works fine with Forward+ Rendering and after reading the Entities Graphics docs, I’m not sure what I’m doing incorrectly when trying to implement a shader for Forward+ Rendering path.
All properties have the UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT macro also.
If I comment out lightingData.additionalLightsColor += CalculateBlinnPhong(light, inputData, surfaceData); the object is clickable in the hierarchy, but doesn’t take the input from the point lights (which makes sense because I’m not doing any lighting calculation in the loop).
However - I need to do the lighting calculation and make sure the object is clickable in the GameObject hierarchy. How can I solve this crash within the Editor & create a custom lit shader?