How is the size used in THREE.PointCloudMaterial?

I'm trying to figure out how the "size" attribute in THREE.PointCloudMaterial matches the size of its points on the screen.

With spelling camera set to (-1,1,1-1) and size = 1, the dots don't fill half of the screen, so apparently this setting is not relevant to camera space. It also doesn't apply to pixels; with "size = 1", points → 1 pixel.

Also, if I resize the browser window by changing its height, the dots scale to fit, and if I resize the window width, the dots won't scale to fit (!?!)

Any clarification on how "size" will translate to screen or camera space would be greatly appreciated.

If wondering why I need to know this: I'm trying to overlay a PointCloud on a THREE.PointCloudMaterial (with which I can use a texture map) on top of a second PointCloud that uses a ShaderMaterial (where I can send the size parameter directly to gl_PointSize and know exactly how big each point). I am having problems matching the sizes of points in two clouds.

Thank! -mike

+3


source to share


1 answer


Here at line 368 the code starts.

It uses gl_PointSize to rasterize the vertex. There are two options: one with attenuation, the other without. Without this, the point is rasterized to a fixed pixel size. This divides the size by depth and creates a perspective effect. This happens in the vertex shader.



Looking at the code, it seems like the size will be in world units in case of fading and fixed pixel size if not.

+3


source







All Articles