Skip to content
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

If a material has two maps, they can not be both updated #24996

Closed
alikim-com opened this issue Nov 21, 2022 · 1 comment
Closed

If a material has two maps, they can not be both updated #24996

alikim-com opened this issue Nov 21, 2022 · 1 comment

Comments

@alikim-com
Copy link

Describe the bug

Function refreshUniformsCommon contains a material map switch that effectively updates the first map found on the material, ignoring all others.

To Reproduce

An example of LambertMaterial with texture and displacement maps that have their offset changed in animation the loop:

https://discourse.threejs.org/t/lambermaterial-map-displacement-map/44932

Code

line 25938 v146:

let uvScaleMap;

if ( material.map ) {

	uvScaleMap = material.map;

} else if ( material.specularMap ) {

	uvScaleMap = material.specularMap;

} else if ( material.displacementMap ) {

	uvScaleMap = material.displacementMap;

} else ...

line 26022:

if ( uvScaleMap !== undefined ) {

        // backwards compatibility
	if ( uvScaleMap.isWebGLRenderTarget ) {

		uvScaleMap = uvScaleMap.texture;

	}

	if ( uvScaleMap.matrixAutoUpdate === true ) {

		uvScaleMap.updateMatrix();

	}

Live example

Expected behavior

All maps found on the material should have their matrix updated

Screenshots

Platform:

  • Three.js version: r146
@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 21, 2022

Duplicate of #9457.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants