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

TSL: parallaxUV #27739

Merged
merged 10 commits into from
Feb 13, 2024
Merged

TSL: parallaxUV #27739

merged 10 commits into from
Feb 13, 2024

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Feb 12, 2024

Description

parallaxUV can offer a depth effect in the material without needing RTT. Many effects such as car painting, ice, some types of water use this effect.

Usage:

const parallaxUVOffset = parallaxUV( uv(), .1 ); // parallaxUV( uv, scale )
const parallaxResult = texture( someTexture, parallaxUVOffset );

Live demo

image

@sunag sunag changed the title Dev parallax uv TSL: parallaxUV Feb 12, 2024
@sunag sunag added this to the r162 milestone Feb 12, 2024
@sunag sunag marked this pull request as ready for review February 13, 2024 01:06
@mrdoob
Copy link
Owner

mrdoob commented Feb 13, 2024

Wooow!

@sunag sunag merged commit a11a773 into mrdoob:dev Feb 13, 2024
11 checks passed
Comment on lines +70 to +77
const roughnessTexture = loader.load( 'textures/ambientcg/Ice002_1K-JPG_Roughness.jpg' );
roughnessTexture.colorSpace = THREE.SRGBColorSpace;

const normalTexture = loader.load( 'textures/ambientcg/Ice002_1K-JPG_NormalGL.jpg' );
normalTexture.colorSpace = THREE.NoColorSpace;

const displaceTexture = loader.load( 'textures/ambientcg/Ice002_1K-JPG_Displacement.jpg' );
displaceTexture.colorSpace = THREE.SRGBColorSpace;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roughness and displacement should be NoColorSpace.

And likewise, the normal texture, but its color profile is sRGB. Regardless, I'd leave it as NoColorSpace.

/ping @donmccurdy for second opinion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we should use NoColorSpace for all textures containing non-color data, including all three here. The color profiles tend to be unreliable, and I'm not sure there's any way to tag an image clearly identifying it as non-color data. If the material looks incorrect when non-color textures are annotated with NoColorSpace, then we would need fix the textures.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

4 participants