Fog issue on iphone

I’ve enabled fog (in conjunction with clipping plane), but the behavior is different between the unity app and my iphone.

Within Unity, fog behaves as I’d like. Off in the distance the effect is consistent where objects of a certain distance are fogged out, and appear into the view from it in the distance around the slipping plain.

When running the same app on the iphone, the fog acts like a stationary object, the camera will pass through it, and the scene will start normally then move into the “thickest” part of the fog, rendering all objects’ textures invisible and the same color as the fog.

Is there a workaround for this, or has anyone at least had this occur?

I am using Fog in one of my iPhone Games, and I am not experiencing that at all. It works as expected here.

I have encountered something similar in one of my scenes, but decided to drop the fog anyway so I didn’t get to the bottom of it… could it be that the fog on the device does some sort of vertex shading? So if you have few vertices (big terrain quad) the interpolation would yield some strange results?

(I would have to do some tests to answer my own question :slight_smile: )

Yes, fog is calculated per-vertex and linearly interpolated along the polygons.

Etoiles, good thought on the matter.
Only polygons large enough to stretch into the ‘fog’ area are affected.
Meaning the texture(s) will carry over the applied fog color. For example, a floor that spans into the fog area retains it’s “fogged” color and I lose the texture detail to it as the camera moves forward.
A simple fix is to break up the geometery, of course, but considering the behaviour difference, I wonder if this is a bug or due to a limitation of the iPhone’s OpenGL or what have you.

My problem is I’m trying to keep the draw distance down for performance, and it appears I’ll have to keep the polys and levels broken up into chunks that are quite small.

This is how OpenGL ES 1.1 works. Don’t forget, the iPhone has a GPU thats comparable to an 8+ year old desktop card. Something around a TNT2 / GeForce1 at best

This is no Unity Limitation

Ok, then.
I never mind a work-around, provided I have a definitive answer as you’ve just provided. Thanks guys. :slight_smile: The help is so good here I wish I had more problems. :stuck_out_tongue: