Jump to content

  • Log In with Google      Sign In   
  • Create Account

Rene Z

Member Since 24 May 2010
Offline Last Active Jun 02 2015 04:30 AM

Topics I've Started

Avoiding artifacts when rendering large alpha blended particles

11 January 2011 - 02:43 AM


I'm currently working on our particle system, but I've come across a problem. We simulate the smoke of a large fire by emitting two types of smoke particles: a high amount of small particles near the fire to create detailed and turbulent appearing smoke, and a few large, long lived particles which will leave a long trail (several hundred of meters long in extreme cases). The problem is that the large particles show very obvious popping artifacts when moving or rotating the camera due to the changing ordering.

My questions are:
1 - Are there any common solutions to this problem? I've come across this Nvidia demo, the smoke during take-off appears to me as large particle quads but shows no artifacts. Does anyone have a clue how this is done?

2 - Can point sprites solve this problem? This would mean the large particles cannot rotate anymore, but I think this is still better than the current situation.

Thanks in advance

Optimal alignment of vertex data

30 December 2010 - 03:09 AM


I just finished overhauling my vertex buffer management. The old system created a different VBO for every vertex attribute, the new system shares a single VBO among the attributes and interleaves the data.

Often, people suggest aligning interleaved vertex data to a multiple of a certain amount of bytes (32 comes up frequently) for optimal performance. I thought of this as plausible, because data for SIMD operations on the CPU has to be aligned too. So, I ran some tests using a large amount of vertices and simple vertex and fragment shaders to test the difference between 32 and 16 byte alignment, and tight packing. To my surprise I was unable to measure any difference in performance. These tests were performed on an AMD HD4870X2 with the latest drivers.

My questions are: Should vertex data be aligned for other (older?) models? If so, what is the recommended number of bytes? Is it worth the increase in memory usage?

Thanks in advance.

What can cause glGetTexImage to always return zeros only?

13 August 2010 - 06:24 AM


I'm doing some image filtering using shaders, and then try to get the result with glGetTexImage. The problem is the function always returns zero's, but I'm sure the texture contains the right values: If I use the texture to render an object everything looks fine.

The FBO's used as render targets all have a grayscale color attachment, and I try to get the result by calling


for the color attachment of the last FBO.

- glGetError() returns 0
- The texture is bound to texture unit 0, and unit 0 is active.
- The FBO using the texture isn't bound.

Does anyone have a clue what I'm doing wrong? Thanks!

Checking for non-zero determinant in matrix inversion

24 July 2010 - 02:18 AM


When calculating the inverse of a matrix you need to check that the determinant is non-zero. I understand why this is necessary, but I would like to know if matrices with a zero determinant can occur in 3d applications when doing nothing crazy. Removing the branch would be nice.

Bug in Intel drivers with uniform int arrays in fragment shader?

14 June 2010 - 10:34 PM


Recently I noticed one of my shaders wasn't working correctly on an Intel graphics card. After some testing I traced the issue to an uniform array of int in the fragment shader. This array was always filled with zero's. Where it gets really strange is that the vertex shader uses the exact same array without any problems. All that is necessary to reproduce the issue is

Vertex shader:

uniform int someValues[2]; // Initialize from openGL with [1, ..]

void main(){
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex * float(someValues[0]);

Fragment shader:

uniform int someValues[2]; // Initialize from OpenGL with [1, ..]

void main(){
gl_FragColor = someValues[0] == 1 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 1.0);

Would someone with an Intel chipset be so kind to test this out to see if this is an error on my part, or if the Intel driver is broken?

After some more testing it appears float arrays don't work either, and the compiler treats someFloatArray[0] as an integer value. Sigh.

[Edited by - Rene Z on June 15, 2010 4:51:24 AM]