Skip to content

Conversation

@ycw
Copy link
Contributor

@ycw ycw commented Oct 29, 2025

Related: -

Description

It's more intuitive if inspector::viewer is visualized normal attachment(currently storing direction) as color

L: Dev branch https://raw.githack.com/mrdoob/three.js/dev/examples/webgpu_postprocessing_ao.html
R: This PR https://raw.githack.com/ycw/three.js/d/examples/webgpu_postprocessing_ao.html

image

@sunag sunag added this to the r181 milestone Oct 29, 2025
@sunag
Copy link
Collaborator

sunag commented Oct 29, 2025

It AO seemed strange only on the red channel, I updated.

image

@sunag sunag changed the title Visualize normal as color in inspector Examples: Visualize normal as color in inspector webgpu_postprocessing_ao Oct 29, 2025
@sunag sunag merged commit 7b65617 into mrdoob:dev Oct 29, 2025
9 checks passed
@ycw
Copy link
Contributor Author

ycw commented Oct 29, 2025

Good

@ycw ycw deleted the d branch October 29, 2025 16:56
@WestLangley
Copy link
Collaborator

@ycw

The normal map colors do not look correct to me. Is the sRGB transfer function being applied when it should not be?

related: #30590

const scenePassNormal = scenePass.getTextureNode( 'normal' ).toInspector( 'Normal' );
const scenePassNormal = scenePass.getTextureNode( 'normal' ).toInspector( 'Normal', () => {

return directionToColor( scenePassNormal.sample() );
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it intentional that .sample() doesn't take a parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, but it should be designed to work like TSL.texture(t, /* optional uv */)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@WestLangley
Copy link
Collaborator

If renderer.outputColorSpace is set to THREE.LinearSRGBColorSpace, the normal map colors look reasonable. That would indicate my conjecture is likely correct.

@ycw
Copy link
Contributor Author

ycw commented Oct 30, 2025

The normal map colors do not look correct to me. Is the sRGB transfer function being applied when it should not be?

I don’t have a clear answer right now, it may help to check how the inspector handles rendering, which I’m not very familiar with. I could only test this by trying to neutralize the conversion; for example, by manually applying pow(2.2) to the raw data, return directionToColor(..).pow(2.2), the inspector’s output looked more reasonable:

image

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