Skip to content
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

InstancedPointsNodeMaterial: Add sizeAttenuation #29491

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Sep 25, 2024

Related issue: #29394 #29374

Description

Second attempt following #29374 to add support for sizeAttenuation in InstancedPointsNodeMaterial as a fallback for THREE.Points.

This contribution is funded by Segments.AI & Utsubo

Copy link

github-actions bot commented Sep 25, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 687.46
170.22
687.46
170.22
+0 B
+0 B
WebGPU 838.62
224.9
839.02
225.03
+404 B
+131 B
WebGPU Nodes 838.13
224.78
838.53
224.91
+404 B
+126 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 463.24
111.86
463.24
111.86
+0 B
+0 B
WebGPU 533.78
143.98
533.78
143.98
+0 B
+0 B
WebGPU Nodes 490.12
133.72
490.12
133.72
+0 B
+0 B

@sunag sunag added this to the r169 milestone Sep 25, 2024
@WestLangley
Copy link
Collaborator

Sprites have a map, are sized in world units, can be size-attenuated, and can be rotated.

Points are sized in pixels, and are just a "fat" point-list primitive.

It doesn't make sense to size-attenuate something sized in pixels.

@RenaudRohlinger
Copy link
Collaborator Author

Following numerous requests from developers, I'm attempting to offer a fallback solution to THREE.Points, as size attenuation on points larger than 1px is widely used especially since Points.sizeAttenuation is enabled by default.

While I understand that in certain cases, like InstancedPointsNodeMaterial, it may not seem logical to size-attenuate something rendered in pixels, the practical use of size attenuation remains prevalent across many projects.

If you strongly believe that size attenuation is unnecessary for InstancedPointsNodeMaterial, I'm open to creating a new class (e.g., PointsWebGPU) specifically to provide a fallback for THREE.Points in WebGPU. In that scenario, I also plan to rename pointWidth to size to facilitate a smoother transition from Points. Would this approach work for you?

@WestLangley
Copy link
Collaborator

Thank you for your reply.

I would be happy if:

  1. (Instanced) sprites could be sized in world units, and points sized in pixels.
  2. Size attenuation set to true by default for sprites, but it can be disabled.
  3. Points cannot be size-attenuated.

If that is not acceptable for some reason, then an alternative could be to allow points to be sized in either pixels or world units -- but I prefer the solution above.

JMHO, of course. If you disagree, I will not object. :-)

@RenaudRohlinger RenaudRohlinger marked this pull request as draft September 26, 2024 08:52
@mrdoob mrdoob modified the milestones: r169, r170 Sep 26, 2024
@mrdoob mrdoob modified the milestones: r170, r171 Oct 31, 2024
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