pygfx / pygfx

Powerful and versatile visualization for Python.
https://pygfx.org
BSD 2-Clause "Simplified" License
415 stars 38 forks source link

Improvements to point material #48

Open almarklein opened 4 years ago

almarklein commented 4 years ago
almarklein commented 2 years ago

Also check out https://observablehq.com/@rreusser/selecting-the-right-opacity-for-2d-point-clouds and https://observablehq.com/@tuner/selecting-the-right-opacity-for-2d-point-clouds-with-sdf-ant

Korijn commented 1 year ago

By depth attenuation, the goal is to be able to set the radius of points in world space.

This would visually resemble a 3D sphere in the scene, except it's flat, facing the camera, and shaded flat of course.

almarklein commented 3 months ago

Added an item for per-vertex marker shape. See https://github.com/fastplotlib/fastplotlib/pull/549.

Some thoughts on this:

The current markers are shaped programmatically based on the point coords. What marker (i.e. code) to use is determined using templating. Making this dynamic could be done using a big multi-if statement, which possibly hurts performance. An alternative could be an array of function objects, but I'm not sure whether wgsl supports this.

Benchmarking reported in #772 suggests that using sdf's instead of computed markers may be more performant. And if we put all our builtin markers in a single texture, we can easily switch between markers! I think this would be the best approach, because it also allows us to create shapes that are not possible with the computed approach.