iDevGames Forums
iPhone 3GS Shadowing Bug - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: iPhone 3GS Shadowing Bug (/thread-397.html)



iPhone 3GS Shadowing Bug - Bersaelor - Jan 26, 2010 05:45 AM

Hey my developing-friends,

one of my Betatesters reported a strange shadowing Bug in my 3D-Drawing.
He has the same version of the iPhone OS that I have, i.e. 3.1.2.

Yet, he is the only one in the betatesting group with an iPhone 3GS and the only one with the bug. For the others the graphics are fine on iPods or older iPhones.

Here's a picture of the bug:
[Image: 2mphoto2yfj]

It appears to have something to do with the way I place my Light-source.

Basically in one runloop I do the following in the order:

  1. glScale
  2. glotate
  3. glTranslate
  4. place light (glLightfv(...))
  5. draw interleaved array


As explained in the other thread I only draw one time per Frame, so the turning/zooming of the whole geometry (gamemap) is fast. The order up there ensures that the light is turned together with the scene, which is what I prefer (no moving shadows when rotating).

Are you aware of any changes in the way the iPhone 3GS handles lighting compared to earlyer devices?


iPhone 3GS Shadowing Bug - ThemsAllTook - Jan 26, 2010 07:42 AM

That image link doesn't embed properly, but I can see it by going to it directly... I'm not sure exactly what I'm looking at, though everything seems a bit dark. A reference screenshot showing how it's supposed to look would help.


iPhone 3GS Shadowing Bug - Skorche - Jan 26, 2010 07:58 AM

To be clear, this is a lighting problem and not a shadow problem right?

In an earlier post, you were talking about packing for vertex array into smaller data types. Are you still doing that? It's possible that there is a driver bug on the 3GS that doesn't like whatever data type you are giving it.


iPhone 3GS Shadowing Bug - Bersaelor - Jan 26, 2010 09:45 AM

Hey, thanks for the Reply:

Quote:A reference screenshot showing how it's supposed to look would help.

Please watch the youtube-video in my signature, there it is seen as by me and the other betatesters.

Quote:To be clear, this is a lighting problem and not a shadow problem right?

Well I have no code concerning shadows, but Lights produce shadows, or the mere lack of lights, I must admit.

Quote:In an earlier post, you were talking about packing for vertex array into smaller data types. Are you still doing that? It's possible that there is a driver bug on the 3GS that doesn't like whatever data type you are giving it.

That was a test to improve performance but as mentioned in said thread it didn't help, instead i improved some issues on what I draw and how often.

Again, I only got this picture from one Betatester and I'm unable to reproduce it, on my iPod Touch everything is the way it should be.

The black shadows seem to change when I reposition my Light-source, since I did this in several of my releases to help debugging that problem. (kind of a long-range US-Europe, 12hour delayed debugging)
But wherever I put the source of my light, the bug just happens on another subset of angles you may watch the gamemap. Or even at all angles possible. He reports it doesn't appear on all positions of the camera and the "black shadows" change with the movement of the camera.

EDIT: I only use OpenGL ES 1.1. The iPhone 3 GS reportedly supports OpenGL ES 2.0 but I didn't want to do the 3D Part 2 times, so I just used the basic way for OpenGL ES 1.1 via:
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];


iPhone 3GS Shadowing Bug - Bersaelor - Jan 30, 2010 12:44 PM

I just remembered there were those 2 warnings which have been showing up since the very beginning of the project.

I first used the standard- Open GL ES Project to do my Game-3D Engine, and when I merged those files with the bigger Project and Menus and all, those two messages began to show up.

Guess "shader" are exactly whats wrong, maybe thats connected!

I should rename the thread from "shadowing bug" to "shader bug". Does anyone recognize the following lines, maybe they are the reason for what happens!

Quote:[WARN]warning: no rule to process file '$(PROJECT_DIR)/Shader.fsh' of type sourcecode.glsl for architecture i386
[WARN]warning: no rule to process file '$(PROJECT_DIR)/Shader.vsh' of type sourcecode.glsl for architecture i386

EDIT: I just deleted those two files, they are only needed for the ES2Renderer which I don't need.

The Question that remains is: Is the iPhone 3GS really downward compatible to OpenGL 1.1.?


iPhone 3GS Shadowing Bug - Bersaelor - Feb 2, 2010 07:17 AM

I was able to reproduce the Bug in the Simulator.
That means all looks well on iPods and iPhones but not on the Simulator or iPhone 3GS's where there are the little black dots as in the picture.

I was able to reproduce the Bug in the Simulator.
That means all looks well on iPods and iPhones but not on the Simulator or iPhone 3GS's where there are the little black dots as in the picture.

Experimenting with the position of the Lightsource I know can describe the problem better.

Appearently everytime a certain triangle (or several triangles in the same plane) faces the lightsource and the viewport source at a specific angle the area goes completely black.
I know that because the areas that are painted black change when I change the position of the light source but are only visible when you adjust the camera to some narrow range of angles.

It's not changing when I first draw the light and then scale/transform or do it the other way around.


RE: iPhone 3GS Shadowing Bug - jarodl - Dec 28, 2010 04:08 PM

Hello! I ran in to the same problem and blogged about the solution here:

Eliminate iPhone OpenGLES project warnings

Instead of deleting the two shader files you just need to move them to a different directory in the application target folder.