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

add uvNode in materials #30520

Closed
Makio64 opened this issue Feb 14, 2025 · 2 comments
Closed

add uvNode in materials #30520

Makio64 opened this issue Feb 14, 2025 · 2 comments
Milestone

Comments

@Makio64
Copy link
Contributor

Makio64 commented Feb 14, 2025

Description

Sorry to re-open the subject ( #30160 )

I cross a case where I'm loading a gltf with many maps and I want to simply change the uv in all of them in my shader ( to give a "liquid" effect )

In legacy threejs i would have done it at the start of my shaders and the change would have been effective everywhere.

But in TSL how should I do if I dont have the uvNode ?

colorNode = ...  * customUV
metalnessNode = ... * customUV
roughtnessNode = ... * customUV
//etc.. ?

Solution

if uvNode is define replace uv() by uvNode()

Alternatives

?

Additional context

No response

@sunag
Copy link
Collaborator

sunag commented Feb 17, 2025

The solution below will work if you want to replace a non-procedural texture() uv.

const replaceDefaultUV = ( node, uv ) => node.context( { getUV: () => uv } );

materialBox.colorNode = replaceDefaultUV( materialColor, uv( 1 ) );

@Makio64
Copy link
Contributor Author

Makio64 commented Feb 19, 2025

@sunag thanks for the fix, but I still beleive this should be out of the box, it was one of the things i used the most in production for years when it came to custom shaders.

There is probably a point I'm missing ?

@Samsy @mrdoob @Mugen87

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

3 participants