Jump to content

plotting simple point


jerome
 Share

Recommended Posts

Hi,

 

Is there a way to plot just a simple point in space (independant from size, cam distance, etc, so not a solid mesh) like we can do for lines with createLines() ?

This would be very convinient for all plotting needs (maths rendering, geometries, etc).

 

I just couldn't find it... couldn't find it in threejs either : seems to be a weird thing to implement. Something to do with gl_point maybe ?

Link to comment
Share on other sites

I didn't express well.

When you use createLines(), you get only one mesh with many vertices.

The mesh is rendered according a color. There is no need for materials.

Moreover it is ever rendered with a series of lines of one pixel width whatever the distance from the cam. This is particuliarly convinient for math curves plotting because the rendering keeps the same wether you are close or far from the mesh.

 

I wonder if the same thing could be done with only points instead of lines.

 

If I use a new Mesh per point, it is overkill and would probably choke the draw call process. This is not the same than a single mesh containing many points.

Btw, I don't think adding a vertex will change anything. Indices will be required too.

Maybe by giving the mesh many vertices and indices so as triangles (faces) are each only one point ? I guess it won't work. (yes, I meant gl_Point ;) instead)

 

What if I use particles ?

Are un-textured particles such kind of wanted points (ever one pixel witdth) ?

Can we just have un-textured particles ? If a texture is needed, we face again the permanent one-pixel size problematic (I want the size ever the same, like for createLines).

I don't know the pointsCloud property. Need to have a look.

 

 

The thing I was looking for was something like :

createPoints(name, array, scene);

array : an array of vector3

result = a single mesh

render = the point (pixel) at each array vector3 coordinate

Link to comment
Share on other sites

You can use the PointCloud rendering mode of a material to draw points in space.

Do that using the pointCloud setter of the material (exactly like wireframe mode) or by changing the fill mode of the material to BABYLON.Material.PointFillMode ( which is exactly what the setter is doing).

With a carefully plotted mesh you can actually create rather nice effects :-) change the positions to the ones you want and you can create a graph. I haven't tested, but the material class has also a pointSize variable which is referenced in the default shader. So I assume that using this variable you will be able to change the size of the displayed points.

Using one single mesh for that will also save draw calls.

And yes, eventually it is using gl.POINT (search the engine class for the function "drawPointClouds").

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...