jerome Posted February 16, 2015 Share Posted February 16, 2015 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 ? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 16, 2015 Share Posted February 16, 2015 A single point in space:var point = new BABYLON.Mesh("point", scene); Quote Link to comment Share on other sites More sharing options...
jerome Posted February 16, 2015 Author Share Posted February 16, 2015 is this enough to render it ? not sure ... Quote Link to comment Share on other sites More sharing options...
Dad72 Posted February 16, 2015 Share Posted February 16, 2015 This creates a point, but it is not visible. but you can position it in spacevar point = new BABYLON.Mesh("point", scene);point.position = new BABYLON.Vector3(1, 5, 1); Quote Link to comment Share on other sites More sharing options...
jerome Posted February 16, 2015 Author Share Posted February 16, 2015 really ? Ok, I'll test it ASAPthank you Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted February 16, 2015 Share Posted February 16, 2015 If you mean gl_Point, I think you should add a vertex to your mesh to have a point. If not, the mesh will work as an empty mesh. Am I wrong ?If I'm not, you can use a mesh with several points and render it using "point clouds" If you use a mesh per point, take care about draw calls ! Quote Link to comment Share on other sites More sharing options...
dbawel Posted February 16, 2015 Share Posted February 16, 2015 Can you provide a specific example or brief explanation as to how you wish to reference this point (position?) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 17, 2015 Share Posted February 17, 2015 I suggest using either particles or mesh.material.pointsCloud = true Quote Link to comment Share on other sites More sharing options...
jerome Posted February 17, 2015 Author Share Posted February 17, 2015 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 vector3result = a single meshrender = the point (pixel) at each array vector3 coordinate Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted February 17, 2015 Share Posted February 17, 2015 I think that you can find some ideas here : https://www.opengl.org/wiki/Vertex_RenderingAre you sure that mesh indices is a must ? Quote Link to comment Share on other sites More sharing options...
jerome Posted February 17, 2015 Author Share Posted February 17, 2015 thank youhuu, I'm sure about nothing at all Quote Link to comment Share on other sites More sharing options...
jerome Posted February 21, 2015 Author Share Posted February 21, 2015 Do BJS particles rely on gl_Point ? Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 21, 2015 Share Posted February 21, 2015 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"). jerome 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.