-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MeshMatcapMaterial: update default matcap #23126
Conversation
Interesting... Another option would be to generate a default matcap |
Yes, this PR was in lieu of doing something like this: const matcap = new THREE.DataTexture( new Uint8Array( [ 50, 50, 50, 200, 200, 200 ] ), 1, 2, THREE.RGBFormat );
matcap.encoding = THREE.LinearEncoding;
matcap.minFilter = THREE.LinearFilter;
matcap.magFilter = THREE.LinearFilter;
matcap.generateMipmaps = false;
matcap.needsUpdate = true; The result is similar. |
I think I prefer the DataTexture approach. The "dumber" the shaders are the better. |
For the reasons mentioned in #22293 (comment), I suggest to not use WebGPU does not support them anyway, see gpuweb/gpuweb#66. |
So, @Mugen87 @mrdoob, it would be the renderer's responsibility to populate a default matcap if none is specified. This would be checked per-frame. Is that right? // FYI, you do not require that approach for the three.js/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js Lines 9 to 25 in 1a241ef
I am implementing the same approach here. |
The PR in its current form provides indeed the simpler solution. It would be nice to avoid the per-frame checks in the renderer. |
@Mugen87 So, is that a tacit approval? :-) |
Changed my mind 🤓 |
Thanks! |
Previously, if the
matcap
was not defined, the shader would render white:We can actually improve on the default with a small change to the shader:
Just a suggestion... :-)