-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
PointsNodeMaterial: Fix scaling bugs #31627
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.
|
|
This PR broke the visuals in https://threejs.org/examples/webgpu_lights_custom |
|
@WestLangley Can you please revisit this change? Depending on the camera, the point cloud looks now distorted. This becomes more clear if you remove the custom lighting model: regression-pointcloud.movThis is clearly a regression. If not fixed, we have to revert the PR before the |
|
This PR ads an extra scale factor ( by DPR * canvas_height ) to mirror the implementation in WebGLRenderer. // Here are the use cases that, as of now, must be supported: sprite = new THREE.Sprite( new THREE.SpriteNodeMaterial() );
instancedPoints = new THREE.Sprite( new THREE.PointsNodeMaterial( { positionNode: instancedBufferAttribute( positionAttribute ) } ) );
pointCloud = new THREE.Points( new THREE.BufferGeometry(), new THREE.PointsNodeMaterial() );It is the third use case that is the problem. When When the same material is used as the material for // @sunag @Mugen87 Can you please help with the architecture here? |
Unfortunately, the implementation is not correct. The scale factor The distortion from the video comes from the fact that the new scaled point size is incorrectly used in subsequent shader code for point primitives. |
|
@sunag Can we implement two |
|
@WestLangley The const _size = /*@__PURE__*/ new Vector2();
const scale = /*@__PURE__*/ uniform( 1 ).onFrameUpdate( function ( { renderer } ) {
const dpr = renderer.getPixelRatio();
const size = renderer.getSize( _size );
this.value = 0.5 * size.y * dpr;
} );If you need DPR as a uniform, I suggest we enhance |
|
#31702 attempts to provide a fix. |
|
@Mugen87 Thank you for your help! |
The idea was great. Thank you too! :) |
Fixes #31179.
Fixes #31353.
The goal here is to match
WebGLRenderer's output usingPointsMaterial.