Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X

Posts tagged ‘Point Cloud’

[Week 4] Behind on schedule, but puffing on.

Since I spent most of the previous week bedridden, I have fallen behind a week and will have to rethink my planning. Yesterday I did pretty decently however, and now my billboards are in place. Cleaning code has gotten pushed back, and now focus will instead be on functionality. I’ll make it less messy when I feel I have the time.

This is the shader program for my first billboarded particles:

  1. [VS] Pass unprojected points directly down to the Geometry Shader
  2. [GS] GL_POINTS as input, output GL_TRIANGLE_STRIP
  3. [GS] Get the non-projected point. (modelView, no projection)
  4. [GS] Add/Subtract extents from the points for each corner of the billboard, then multiply with the projection matrix.
    projection * vec4(pos.x – extent.x, pos.y – extent.y,  pos.z, pos.w), //Lower Left
    projection * vec4(pos.x+extent.x, pos.y – extent.y,  pos.z, pos.w), //Lower Right
    (etc..)
  5. [GS] Emit vertices accompanied by an outparameter for UV coords,
  6. [FS] Texture the billboard from a sampled texture!

This is mostly done, I just need to put up a texture on the billboard now. One interesting detail to note for someone new to geometry shaders (like me!), remember to generate points following a point only altered by the modelview matrix, otherwise the billboard will be skewed depending on the screen width and height!

Hopefully things will work pretty alright and I won’t have to overthink. I am slightly curious about the difference in consumption between these Geometry Shader billboards and normal billboarded particles. Maybe I’ll have to measure when I have time.

[Week 3] Billboards? Point Clouds?

Now that I am finally not sick, it’s time to try and get things done! The first thing I’m getting to this week is some simple representation of the particles. I want to draw scaled textures from the points. I have two choices for this. I could either make a shader for binding and drawing simple point sprites, these would be very cheap to do, but as far as I understand, they’ve got two issues.

  1. As a GL_POINT is culled out of the screen, the texture will never be drawn (even if it may cover more screen space). This could lead to some strange artifacts. I have yet to test the severity of this, so I can’t speak for how it would look. Chances are it could look allright, but I can find no direct example of it online. I’ll just trust what I read on this.
  2. GL_POINTS are not rendered with depth, so if I’ve understood this right, these point sprites will all be of a certain unit size, regardless of the depth value of the point in the pointcloud. Again, this is something I haven’t tried, but if it is like this, it would be an effect I wouldn’t desire. I could make my own distance attentuation in the shader for this, but there might be a simpler solution altogether.

I first thought that point sprites would be a nice little solution, and true, it may be one. But the points presented above made me consider just doing a simple fragment shader (at first) which would take a point and make a quad facing the camera out of it. This would mean I wouldn’t have to worry about neither culling, nor distance attentuation, as this would be handled by OpenGL itself. This shader could later be changed to create actual, rotated particle geometry, something that might be interesting to peek into later. However nothing that I will focus on during the run of this project.