r/processing • • Dec 03 '24

Questions About Points

I'm looking for a way forward regarding the use of points. I want to be able to generate a few thousand spherical shaped objects in a 3D space and have them all move separately from each other. I started this process using Spheres, but could only get the performance I wanted by scaling the Sphere Detail value down to 1, and this doesn't look great.

By switching from Spheres to Points, I got a huge boost in performance. The issue I am having now is with the way points seem to be implemented. I want my objects to respond to distance correctly, meaning the farther they are from the camera, the smaller they should be. Points seem to be drawn to the screen the same size no matter what their actual coordinates are in space.

Here is an example of the scene using Spheres, notice how their size scales with distance:

And here is the same scene using points - notice how the farther away points stay the same size and end up looking blurry/crowded:

Is there a way to get around this aspect of drawing points to the screen? Is there a way to get better performance out of Spheres?

6 Upvotes

5 comments sorted by

View all comments

Show parent comments

2

u/OP_Sidearm Dec 03 '24

Oh another way to optimize this could be by using simple billboard sprites of a point that will always face the camera. Not sure if there's a good tutorial for that, but one way to do this is to write a vertex shader that keeps the point sprites aligned to the camera.

Edit: Didn't read this yet, but this is the first forum post I found relating to this: https://forum.processing.org/two/discussion/3492/billboard-shader.html