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

GroundedSkybox: Fix UVs being flipped #27500

Merged
merged 2 commits into from Jan 9, 2024

Conversation

hybridherbst
Copy link
Contributor

Related issue: #27422, cc @elalish

Description

The current implementation had flipped UVs compared to using the same texture as environment.background and environment.image, which also resulted in flipped lighting.

I brought the GUI back and added a toggle to switch back and forth now :)
ezgif com-video-to-gif-converter

This contribution is funded by Needle

@hybridherbst
Copy link
Contributor Author

hybridherbst commented Jan 4, 2024

Hm, may actually need to use the same logic as scene.background to decide if to flip:

boxMesh.material.uniforms.flipEnvMap.value = 
    ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 4, 2024

Regarding WebGLBackground: The flip depends on the texture type since textures of cube render targets have px/nx flipped.

@hybridherbst
Copy link
Contributor Author

I see – then I think flipping here as currently in the PR is always correct for the supported case (an equirectangular texture is passed in), don't think passing in a cubemap would be expected to work for now.

@Mugen87 Mugen87 added this to the r161 milestone Jan 8, 2024
@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 8, 2024

@elalish
Copy link
Contributor

elalish commented Jan 8, 2024

Ah, good catch! I totally missed that reversal in my model-viewer examples. I don't rely on cube map inputs, so this is fine, but it seems like adding that flip is still a good idea. Might as well make cube maps work too if it's easy.

@Mugen87 Mugen87 merged commit c46ef18 into mrdoob:dev Jan 9, 2024
11 checks passed
AdaRoseCannon pushed a commit to AdaRoseCannon/three.js that referenced this pull request Jan 15, 2024
* GroundedSkybox: Fix UVs being flipped

* fix deepscan issue
@hybridherbst hybridherbst deleted the fix/grounded-skybox-uv-flip branch January 18, 2024 18:19
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.

None yet

3 participants