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

InstancedPoints: Fix UVs #29396

Merged

Conversation

RenaudRohlinger
Copy link
Collaborator

Related issue: #29374

Description

Fixes InstancedPoints wrong UVs.

This contribution is funded by Utsubo

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 685.83
169.75
685.83
169.75
+0 B
+0 B
WebGPU 828.45
222.25
828.47
222.25
+14 B
+0 B
WebGPU Nodes 828.03
222.16
828.05
222.16
+14 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 462.42
111.53
462.42
111.53
+0 B
+0 B
WebGPU 526.43
141.9
526.43
141.9
+0 B
+0 B
WebGPU Nodes 483.08
131.72
483.08
131.72
+0 B
+0 B

@sunag sunag modified the milestone: r169 Sep 12, 2024
@sunag sunag merged commit 5fec042 into mrdoob:dev Sep 12, 2024
12 checks passed
@WestLangley
Copy link
Collaborator

Fixes InstancedPoints wrong UVs.

Nothing was broken -- or wrong. It is producing the same answer.

The code is now unnecessarily less efficient for no compelling reason.

@RenaudRohlinger
Copy link
Collaborator Author

I understand that adding a multiplication and a subtraction solely to handle the circular shape of the point is less optimal. However, this correction is intended to fix the UVs in the overall context of why we use UVs, not just for the shader-specific discard function.

For example:

material = new THREE.InstancedPointsNodeMaterial( {
	color: 0xffffff,
	pointWidth: 100, // in pixel units
	vertexColors: true,
	alphaToCoverage: true,

} );
const textureNode = texture( map );
material.pointColorNode = textureNode.rgb;

Before:
Screenshot 2024-09-13 at 14 19 50

After:
Screenshot 2024-09-13 at 14 20 23

LD2Studio pushed a commit to LD2Studio/LD2Studio-Editor that referenced this pull request Sep 13, 2024
LD2Studio pushed a commit to LD2Studio/LD2Studio-Editor that referenced this pull request Sep 13, 2024
@WestLangley
Copy link
Collaborator

OK. For node material that makes sense.

Your contributions have been excellent, BTW. IMHO, of course. :-)

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.

3 participants