Replacing Points
Andor Salga | 10 June, 2009 | 9:56
I filed a bug a while ago concerning rendering points while playing a DVD on OS X. On some systems everything slows down, on others the OS crashes. See Point Rendering Bug under Points and Lines Update. I compiled a list of things which can be done to address this issue.
My first option is to debug the code in the extension. In a way, this is the best route to take since I would be focusing on the real issue; finding why it’s crashing and fix it. On the other hand, debugging code I’m not familiar with would be time consuming and success isn’t guaranteed. It’s tempting to tackle the heart of the matter: find the bug, create a patch and submit. But tempting as it is, it don’t think it’s worth the risk and the best use of time.
The next few options involve workarounds. The first is rendering sphere meshes instead of points. The main drawback with rendering spheres is there are many more vertices to send down the pipeline compared to a single vertex. This means there will be a slowdown on render. Sphere meshes will require a separate shader, but with some additional lines, they can be lit with some diffuse light making them appear 3D. In ways, this can enhance the scene’s visual quality. Additionally, the function to test ray/bounding sphere has already been written, so it will easy to use it to test ray/’point’ intersections for picking.
Another workaround includes rendering points as billboards. This would only require three extra vertices to send down the pipeline, so speed wouldn’t be a concern. The code for billboarding is already been used in the particle system class, so I’ll be able to use that. The main problem relates to texture quality. Since a texture will be mapped to the polygon, as the size increases, so will the texture. If the point size is allowed to increase to a very large size, the visual quality of the texture will drop.
Since the mocap data we’re using has roughly 40 markers per actor, 40 spheres may be asking for too much. 40 billboards on the other hand may be a viable substitute. Diffuse light can be faked with a texture. In the shader, the color of the billboard can be added to the texels, similar to how the particles are rendered. Since applying textures does not slow down rendering, it’s not a problem. The texture quality issue may be dealt with limiting point size or creating a custom sort of mipmapping.
My first option is to debug the code in the extension. In a way, this is the best route to take since I would be focusing on the real issue; finding why it’s crashing and fix it. On the other hand, debugging code I’m not familiar with would be time consuming and success isn’t guaranteed. It’s tempting to tackle the heart of the matter: find the bug, create a patch and submit. But tempting as it is, it don’t think it’s worth the risk and the best use of time.
The next few options involve workarounds. The first is rendering sphere meshes instead of points. The main drawback with rendering spheres is there are many more vertices to send down the pipeline compared to a single vertex. This means there will be a slowdown on render. Sphere meshes will require a separate shader, but with some additional lines, they can be lit with some diffuse light making them appear 3D. In ways, this can enhance the scene’s visual quality. Additionally, the function to test ray/bounding sphere has already been written, so it will easy to use it to test ray/’point’ intersections for picking.
Another workaround includes rendering points as billboards. This would only require three extra vertices to send down the pipeline, so speed wouldn’t be a concern. The code for billboarding is already been used in the particle system class, so I’ll be able to use that. The main problem relates to texture quality. Since a texture will be mapped to the polygon, as the size increases, so will the texture. If the point size is allowed to increase to a very large size, the visual quality of the texture will drop.
Since the mocap data we’re using has roughly 40 markers per actor, 40 spheres may be asking for too much. 40 billboards on the other hand may be a viable substitute. Diffuse light can be faked with a texture. In the shader, the color of the billboard can be added to the texels, similar to how the particles are rendered. Since applying textures does not slow down rendering, it’s not a problem. The texture quality issue may be dealt with limiting point size or creating a custom sort of mipmapping.
