-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
PointsNodeMaterial: Fix broken point rendering. #31702
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
|
||
| const scale = /*@__PURE__*/ uniform( 1 ).onFrameUpdate( function ( { renderer } ) { | ||
|
|
||
| const dpr = renderer.getPixelRatio(); |
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.
Is dpr applied in screenDPR and in scale intentional?
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, since the scale computation should happen in pure JS.
You could compute everything in the shader but then you end up with more computations since you do redundant computations per vertex.
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.
Actually, I was asking a different question. :-)
In any event, I found it. You introduced an error in your formula for scale. I'll file a PR.
My 2^n tests are looking better with this fixed.
| const dpr = builder.renderer.getPixelRatio(); | ||
|
|
||
| pointSize = pointSize.mul( dpr ); | ||
| pointSize = pointSize.mul( screenDPR ); |
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.
Duplicating this line does not change the rendered output.
This appears to be returning 1, not the actual DPR.
Is there something about the context missing?
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.
Ups, the correct update type is missing. I'll file a PR.
Related issue: #31627 (comment)
Description
Makes sure
PointsNodeMaterialgenerates the correct vertex shader for point primitives (which always have a size of1pixel inWebGPURenderer).It also makes sure the
scalefactor introduced in #31627 and the DPR handling is implemented based on uniforms.