Description
On rendering with a secondary camera the shader of a skinned mesh gets regenerated. There might be circumstances where this is necessary (no idea). But in the general case the generated shader is (almost) identically to the previously generated one. The only difference is the unnecessary renumbering of the bone buffer. e.g.
uniform NodeBuffer_1179 {
mat4 buffer1179[2];
};
GLSLNodeBuilder.js#L1575
The number comes from node.id and changes. Otherwise the shader is unchanged. But it is triggering a cache miss and therefore a recompile.
Reproduction steps
- Use the WebGL backend. WebGPURenderer({ forceWebGL: true })
- Have two cameras.
- Have a skinned mesh.
- Watch WebGLBackend._completeCompile with a breakpoint.
- Switch between cameras.
- Observe WebGLBackend._completeCompile being called twice for the same object and material.
Code
Live example
https://jsfiddle.net/1byfwaj4/
Screenshots
No response
Version
0.181.2
Device
Desktop
Browser
Chrome
OS
Windows
Description
On rendering with a secondary camera the shader of a skinned mesh gets regenerated. There might be circumstances where this is necessary (no idea). But in the general case the generated shader is (almost) identically to the previously generated one. The only difference is the unnecessary renumbering of the bone buffer. e.g.
GLSLNodeBuilder.js#L1575
The number comes from
node.idand changes. Otherwise the shader is unchanged. But it is triggering a cache miss and therefore a recompile.Reproduction steps
Code
// code goes hereLive example
https://jsfiddle.net/1byfwaj4/
Screenshots
No response
Version
0.181.2
Device
Desktop
Browser
Chrome
OS
Windows