A Couple of Shader Questions

I have a couple of shader questions, and might continue this thread as I have a feeling that there are more to come :confused:

When you create a ShaderMaterial using Cyos, the worldViewProjection is added as a uniform. This way, the shader is local to the mesh and doesn’t change based on the position of the mesh. This is something I’m after, but somehow unable to achieve with the pbrCustomMaterial :stuck_out_tongue:
Here’s an example of a moving sphere using the pbrCustomMaterial: https://www.babylonjs-playground.com/#LIVRIY#17
Here’s an example of a moving sphere using the ShaderMaterial: https://playground.babylonjs.com/#1EG6VC#1
What I want, is for the first example to behave like the second one. I am sending the worldViewProjection matrix to the shader using what I found in the ShaderMaterial source, but whenever I try using it, the mesh disappears.

  1. What am I doing wrong?
  2. Is there any way of changing the emissive color in the pbrCustomShader? If I wanted to use the above effect only as emissive color, is this possible without making another injection point in the shader, just after:
    vec3 finalEmissive = vEmissiveColor;
    #ifdef EMISSIVE
    vec3 emissiveColorTex = texture2D(emissiveSampler, vEmissiveUV + uvOffset).rgb;
    finalEmissive *= toLinearSpace(emissiveColorTex.rgb);
    finalEmissive *= vEmissiveInfos.y;
    <—
    #endif

https://playground.babylonjs.com/#1EG6VC#2
use world uniform in ShaderMaterial

It’s the other way around. I want the effect to ‘stand still’ in this PG: https://www.babylonjs-playground.com/#LIVRIY#17
Just like it did in this one: https://playground.babylonjs.com/#1EG6VC#1