Just now there was an update to the PlayCanvas engine that caused a lot of shader/render related errors across our projects, some in custom elements, but also some in native elements like the particle system:
Shader [Shader Id 10 particle] requires texture sampler [uSceneDepthMap] which has not been set, while rendering [Pass:RenderAction 0-11 Cam: Camera | Camera | World | Fire]
Haven’t had time to look that closely at it yet, but kinda looks like there was a bug with the update? Anyone else having these issues?
That is a new error message introduced into 1.60. The error/issue that it’s showing is was there before in 1.59 and before, just not reported back to you, the user. Before it was just failing sliently.
In this case, I think that it’s showing you are using a particle effect that needs Depth Grabpass enabled on the camera.
I might be wrong, but I think this particle effect in particular also stopped showing when the error massages was introduced. Guess it might be the error handling or something.
Also as a heads up, we do send out newsletters when new engine minor versions are available to preview in the Editor. This is done about a week before we intend to update the Editor to that version.
We got similar errors on some custom shaders of ours. Most likely they come from the material waiting for the texture sampler to load and get uploaded to the GPU.
At the end they look as expected, any idea if we can suppress those errors until we find a more elegant fix? @mvaligursky
I think the best way to handle those is to create a placeholder texture and assign it to the material. This would stop the error (which shows once time per mesh), but additionally it can cut down on the number of shaders that get compiled. Otherwise it’s a good chance that initially a shader compiles for a material without texture, and then later when you assign it, it would compile another version to support the texture.
Internally when a texture load for material textures is trigger, we assign a placeholder tiny texture to the material to avoid multiple shader compilations. So try something similar I think.
Yes, it’s not a free feature performance wise. On Webgl2 it’s pretty cheap, and just copies a buffer each frame. On WebGl1 it needs to re-render the scene again to generate the depth buffer.
So on lower powered devices, you might consider not using a depth grab-pass - which means no soft particles, and no depth of field or similar post-processing that depends on the depth.
I couldn’t find the property depthGrabpass in the API documentation (I’ll enable/disable it). However, I found a workaround. My water shader doesn’t show up when the option is disabled, but if I start the game with it enabled and then disable it afterwards, I can see my water shader. I need to disable it because it causes FPS drops on my computer.
Hey I see … when you enable it, the depth texture is captured, and on the following frames it uses that texture. The result is of course that the texture contains no longer matching depth, and so you can expect some artefacts.
The thing is … why don’t you just disable the softness of the particle system? That way it will render for you, and you don’t need the depth grab pass at all.
Thank you @mvaligursky , it turns out my problem is not related to particles, I’m using some water shader from an external resource so its shader code was not working after the engine update, I updated the code (disabled some parts of it) and it worked.
Still, it is good to know this, I might have a problem in the future.
However, this seems to not be the case if you only use directional lights.
Anyone know anymore about this? I mean, the quick fix ofc. is to just make sure to disable “cast shadows”. But say you actually want the element to throw shadows. Do you need to set up the shader in a a specific way?
@Astra - it looks like your custom shader uses uTexMap uniform, but does not have a value assigned to it? (As part of material, or MeshInstance, or global texture, depending on what is needed)