Lots of shader error messages after new update

Hei,

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.

image

2 Likes

oh, ok thx!!

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.

Hmm, it looks like it throws a Debug.error now so that will stop code execution which explains why it isn’t working now :thinking:

The debug messages only trigger in debug builds of the engine as well.

Edit: Actually, no. We now stop the rendering of the draw call/effect to prevent further WebGL errors

2 Likes

oh. ok. good to know :slight_smile:

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.

https://us2.campaign-archive.com/?u=c631f23c118ced493c1ba9659&id=8302cd9e25

This gives a chance for developers to preview the engine ahead of the change.

If you go to your account page: https://playcanvas.com/account

Ensure that this is enabled

2 Likes

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.

1 Like

@mvaligursky how do we deal with that engine behavior?

I mean even in “official” explosion effect demo the explosion texture isn’t displayed at all with engine v1.60.0 (worked well with v1.59.x)
https://playcanvas.com/project/439297/overview/explosion-particle-effect

Just open the editor and launch the project with latest engine v1.60 and you’ll get this:

Working well with v1.59:

Maybe you could consider enabling “depth grabpass” by default?

@Igor Thanks for letting me know about that project. I’ve now fixed it by enabling depth grabpass on the camera.

1 Like

@yaustar please also fix this one:
https://developer.playcanvas.com/en/tutorials/flaming-fireball/
https://playcanvas.com/editor/project/439385

Thanks, fixed.

@mvaligursky @yaustar Could enabling this cause some performance issues?

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.

2 Likes

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.

https://developer.playcanvas.com/api/pc.CameraComponent.html#requestSceneDepthMap

Theres also an option in the editor on the camera component

1 Like

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.

1 Like

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.

1 Like

Seems like there’s also a bunch of pretty new error messages that’s thrown for 3D elements that are set to throw shadows AND uses a custom shader.


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)