PointsNodeMaterial: Fix broken point rendering.#31702
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.
Is dpr applied in screenDPR and in scale intentional?
There was a problem hiding this comment.
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.
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.
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.
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.