-
Notifications
You must be signed in to change notification settings - Fork 107
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
fix: Fix screenCoordinates outline rendering in WebGL #1492
base: dev
Are you sure you want to change the base?
Conversation
I suspect that we will have an issue that outline does not appear in r169 WebGPURenderer Also I spotted a bug in WebGL outline when the mode is screenCoordinates
This was because this line fails if we load both
And this easily happens when we write our importmap in this way: <script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.168.0/build/three.module.js",
"three/webgpu": "https://cdn.jsdelivr.net/npm/three@0.168.0/build/three.webgpu.js",
// ...
}
}
</script> maybe we should consider changing the |
outlineTex = texture2D( outlineWidthMultiplyTexture, outlineWidthMultiplyTextureUv ).g; | ||
#endif | ||
|
||
#ifdef OUTLINE_WIDTH_WORLD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so OUTLINE_WIDTH_WORLD in no longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, while I agree that it is too implicit to acknowledge that OUTLINE && !OUTLINE_WIDTH_SCREEN == OUTLINE_WIDTH_WORLD
.
vec2 projectedNormal = normalize( clipNormal.xy ); | ||
projectedNormal.x *= projectionMatrix[ 0 ].x / projectionMatrix[ 1 ].y; | ||
gl_Position.xy += 2.0 * outlineWidthFactor * outlineTex * projectedNormal.xy; | ||
outlineOffset *= vViewPosition.z / projectionMatrix[ 1 ].y; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outlineOffset has been fixed and using the same logic in tsl
Description
feature-test.html
andwebgpu-feature-test.html
.screenCoordinates
outline in WebGL.The screenshot of the new
feature-test.html
: