PDA

View Full Version : Black Artifacts



brennanrusnell
02-21-2013, 01:12 PM
Hi,

I have an OpenGL ES 2 code base that runs on iOS, Android, and on PC via the PowerVR emulation libraries.

When I run this code on an LG Optimus G LGE971, I see black artifacts on my model:

http://img594.imageshack.us/img594/5238/renderartifacts.png

My first reaction was that the near clipping plane might be the issue, but because these artifacts appear on only select devices, I do not believe that is the issue. Any other ideas on what might be causing this?

Also, this isn't captured well in the above image, but the artifacts are not static -- they move around as the model rotates, etc.

ClayMontgomery
02-21-2013, 02:19 PM
Are you sure all of your triangles strips are wound in the same direction?

Maybe LG's OpenGL ES driver does not use the same defaults for backface culling as other drivers. Try experimenting with changing these options:

glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glCullFace(GL_FRONT);

Regards, Clay

brennanrusnell
02-21-2013, 02:43 PM
Thanks for the tip. I tried every permutation:

GL_CW & GL_BACK
GL_CW & GL_FRONT
GL_CCW & GL_BACK
GL_CCW & GL_FRONT

And even disabled culling altogether. Unfortunately, the artifacts still show up.

If it helps, the severity of the artifacting increases as the model get closer to the camera.

Also, the shader being applied to the gun does not have any lighting information -- it's a simple texture map. Here's the fragment shader:


uniform sampler2D diffuseMap;

varying vec4 varyColor;
varying vec2 varyTex0;

void main()
{
gl_FragColor = texture2D( diffuseMap, varyTex0.xy );
}

Thanks again.
--
Brennan

brennanrusnell
02-21-2013, 03:41 PM
Quick update -- I changed my shader to output the tex coordinates as the R & G channels in my fragment shader. I just set B & A to 0 and 1, respectively. Everything renders correctly (i.e. no artifacts). So, it looks like something is up with my texture settings. If I had to guess, it might be the min/max filters, since the artifacts seems to be a function of distance from the camera.

ClayMontgomery
02-23-2013, 02:56 PM
Do any of the minimization filter types work correctly? Do you have proper mipmaps? Use the PowerVR TextoolGui to be sure.

Regards, Clay