0

What i want to draw:enter image description here

I want to draw 3d grid consists of points in OpenGL.Every edge and face also is collection of points. Cube inside also consist of points. Why I need it? I need to visualize temperature gradient, what happened if I will heat one of the faces of cube. How can I calculate VAO for such object?

Do you know another approach to visualize non-empty cube where I can color every point in cube with different color?

  • There are lot more things to know about your problem. In most systems which model temperature a grid or mesh of points will be available for a solid volume. Surfaces will not exist in the model. How dense are your points going to be? If they're too dense your visualisation will be a meaningless mess. Volumetric rendering like this is challenging you should consider multiple translucent iso-surfaces as a powerful solution. – PeteBlackerThe3rd Mar 24 '22 at 10:57
  • You won't be able to see the inside of a cube because the outside is in the way. – user253751 Mar 24 '22 at 11:03
  • @PeteBlackerThe3rd No so dense, it is just university project. Just how can I generate such mesh, just a function which accept a density of points or number of points in one area of one face. – Андрей Петров Mar 24 '22 at 12:07
  • 1
    OpenGL can render points directly, so you just need XYZ and RGB in the VAO for each point. Then call glDrawArrays with mode GL_POINTS. If you're rendering a cube then you only need to worry about the volume, faces and lines can be ignored. – PeteBlackerThe3rd Mar 24 '22 at 14:18
  • use 3D texture and visualize with some [raycast technique](https://web.archive.org/web/20180618064202/https://stackoverflow.com/questions/48090782/how-to-best-write-a-voxel-engine-in-c-with-performance-in-mind/48092685#48092685) + [Blending](https://stackoverflow.com/a/37783085/2521214) or do a **cross-section cut** in GLSL or what ever else ... Sorry for archive link instead of direct one but you are low rep user and can not view deleted QAs ... The first link deals with most of stuff you need for this task so I definatelly recommend to read it – Spektre Mar 25 '22 at 08:08
  • another option is to use VBO with your points and use geometry shader to emit cubes like polygons or their BBOX however I fear with high amount of points this might be problematic from performance aspect also I do not have a good experience with geometry shaders over the years they tend to be not reliable :( across vendors. Also I think **instanced rendering** might be used for this but never done that ... Can you share a valid input ? so we can see how many points or even how the stuff look like ... – Spektre Mar 25 '22 at 08:10

0 Answers0