3
votes

I am trying to understand how the "size" attribute in the THREE.PointCloudMaterial translates to the size of it's points on the screen.

With an orthographic camera set at (-1,1,1-1) and size = 1, the points do not fill half the screen, so apparently this parameter does not refer to camera space. Nor does it refer to pixels; at "size = 1", the points >> 1 pixel.

Furthermore, if I resize the browser window, changing it's height, the points scale in size, while if I resize the window's width, the points do not scale in size (!?!)

Any clarification on how "size" get's translated to screen or camera space would be greatly appreciated.

In case it is of interest why I need to know this: I am trying to overlay a PointCloud with a THREE.PointCloudMaterial (with which I can use a texture map) over a second PointCloud that uses a ShaderMaterial (where I can send the size parameter straight to gl_PointSize and know exactly how big each point will be). I am having trouble matching up the point sizes in the two clouds.

Thanks! -mike

1
It is difficult to help you without knowing exactly what you are doing. Can you provide source code and preferably a simple live example so the problem is reproducible?WestLangley

1 Answers

3
votes

Here, at line 368 the code starts.

It uses gl_PointSize to rasterize a vertex. Two options are present, one with attenuation, the other without. Without, the point gets rasterized to a fixed size in pixels. With, the size is divided by depth and creates a perspective effect. This is happening in the vertex shader.

Looking at the code, it seems that the size would be expressed in world units in the case of attenuation, and to a fixed pixel size if not.