iPhone 3GS Shadowing Bug

Member
Posts: 95
Joined: 2009.09
Post: #1
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?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
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.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
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.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 95
Joined: 2009.09
Post: #4
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];
Quote this message in a reply
Member
Posts: 95
Joined: 2009.09
Post: #5
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.?
Quote this message in a reply
Member
Posts: 95
Joined: 2009.09
Post: #6
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.
Quote this message in a reply
Nibbie
Posts: 1
Joined: 2010.12
Post: #7
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Shadowing bug TomorrowPlusX 6 5,078 Feb 1, 2010 12:00 PM
Last Post: DoG
  Shadow Mapping - Self-Shadowing Z-Fighting Artifacts Bachus 16 22,361 Feb 11, 2009 12:24 PM
Last Post: arekkusu
  2D lighting/shadowing demo Skorche 7 6,395 Nov 22, 2004 09:53 AM
Last Post: Skorche
  Static Shadowing with shadow maps NYGhost 1 3,785 Jun 28, 2003 06:21 PM
Last Post: Feanor
  self shadowing honkFactory 9 4,743 Jan 9, 2003 10:54 PM
Last Post: Mark Levin