I’ve picked up my project for the first time in a long time and the API’s shifted a bit.
A shader that previously worked is now triggering an error:
Shader [Shader Id 133 shader-proc] requires texture sampler [noise] which has not been set, while rendering [Pass:RenderPassShadowDirectional-Light | SHADOW Light FACE 0 | FlameConeExtended]
I’m setting the parameter whilst programmatically generating the material, and as mentioned this approach worked previously.
I’ve seen discussion on this forum that some of the API updates may have caused errors that only show for the first render of the material, but I’d like to know what I can do to ensure I’ve using my custom shader materials properly.
Hmm, I’m not aware of any changes here that changed the behaviour. We added this error message (when using the debug engine only) where before we had no message and possibly incorrect behaviour / using this material property from some previous material that set it up.
Try putting a breakpoint to where the message is printed, and inspect the material and similar.
From what I can tell the sampler2d is being set correctly, but that’s from logging the material out. I’ll try again with a breakpoint - hopefully there’ll be something more helpful
One thing I notice is that the texture has the _needsUpload property set to true - could this be the cause of the issue?
Currently I’m creating a new material and using material.setParameter() with the appropriate resource. Here’s the full material generation function in case it helps:
My previously exported works fine but for some reason since the engine update it no longer seems to be reading the asset correctly. This function is called to modify materials on first use and store them in a global namespace - so they should only get generated once.
Looking at the generated material it appears to have the parameters set correctly, but perhaps I’m looking at the wrong area. Is there a preferred way to set a sampler2d programmatically from the asset library? I’m afraid I’m a bit lost at the moment as to what could be causing this…
I think it is something to do with the engine trying to render a shadow map with your shader and cannot find noise texture sampler. Try disabling shadow casts for the box. @mvaligursky can probably give a more educated answer.