Screenshots using custom #ifdef block within a PBRCustomMaterial

Also, you can trigger a recompilation of the shader by calling sphere.resetDrawCache(), then use scene.executeWhenReady to call the screenshot function only when the shader compilation is finished:

2 Likes