three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Suggestion: Add points to Mesh*Material for gl.POINTS drawing

Open takahirox opened this issue 8 years ago • 11 comments

Description of the problem

What do you folks think of adding .points property to Mesh*Material for gl.POINTS drawing?

If .points is true, render with gl.POINTS mode. It's similar to .wireframe.

I needed this when I worked on SkinnedMesh with particles. I couldn't use THREE.Points because model requires skinning.

https://twitter.com/superhoge/status/914785053661712384 https://twitter.com/superhoge/status/914786091332505600

Three.js version
  • [x] Dev
  • [ ] r87
  • [ ] ...
Browser
  • [x] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [x] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)

takahirox avatar Oct 03 '17 09:10 takahirox

Hmm what about a drawMode attribute? Values possible would be WIREFRAME, POINTS or TRIANGLES or something similar.

Would be a better approach than having multiple boolean flags, and can be easily poly-filled for compatibility with old code.

tentone avatar Oct 03 '17 16:10 tentone

Is adding skinning/morph support to PointsMaterial what you are looking for?

WestLangley avatar Oct 03 '17 19:10 WestLangley

@tentone

It might be also ok. (We might need to reconsider where peoperty specifying draw mode should be, in Mesh(Object3D) or in Material?)

@WestLangley

If I'm right, the combination of (Skinned)Mesh and PointsMaterial doesn't draw with gl.POINTS mode. In the current implementation, only Points can be drawn with gl.POINTS mode

takahirox avatar Oct 04 '17 00:10 takahirox

@takahirox Yes, we would have to fix that somehow, if we were to add skinning/morph support to PointsMaterial.

WestLangley avatar Oct 04 '17 02:10 WestLangley

@WestLangley

In my case, I use ShaderMaterial so I need gl.POINTS drawing mode property in it. But maybe having skinning/morph support in PointsMaterial would satisfy the users who just wanna render SkinnedMesh with gl.POINTS.

takahirox avatar Oct 04 '17 06:10 takahirox

But maybe having skinning/morph support in PointsMaterial would satisfy the users who just wanna render SkinnedMesh with gl.POINTS.

That would probably also require a SkinnedPoints class -- in addition to adding morph target support.

If that is not appealing, then the proposal by @takahirox to add a .points property similar to .wireframe is a possibility.

WestLangley avatar Oct 04 '17 18:10 WestLangley

Probably SkinnedPoints would be good enough in my case.

takahirox avatar Oct 06 '17 01:10 takahirox

@mrdoob Do you agree with adding SkinnedPoints?

takahirox avatar Oct 06 '17 06:10 takahirox

/ping @mrdoob

takahirox avatar Oct 11 '17 23:10 takahirox

The new node material provides a beautiful solution for this use case: https://threejs.org/examples/webgpu_skinning_points

I would prefer a node material solution rather than introducing SkinnedPoints or having an additional points material property.

Mugen87 avatar Sep 10 '22 09:09 Mugen87

The new node material provides a beautiful solution for this use case

Were you able to get that to work with WebGLRenderer?

WestLangley avatar Sep 10 '22 16:09 WestLangley

webgpu_skinning_points also works with WebGL thanks to WebGLBackend (just test the example with Firefox or Safari). The node material provides a solution for both WebGPU and WebGL.

Certain features are hard or inconvenient to implement with WebGLRenderer due to its architecture. It makes more sense to support things like selective lighting, per-instance uniforms or skinned points just with WebGPURenderer. So I think this issue can be closed.

Mugen87 avatar Nov 25 '23 14:11 Mugen87