Specular highlight on iPhone

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
mannam
Halfling
Posts: 45
Joined: Tue Feb 15, 2011 7:23 am

Specular highlight on iPhone

Post by mannam »

Hello,

I found that specular on iPhone is not highlighting. Specular value is added to diffuse and then clamped to 1:

Clamp01(diffuse + specular) * texture

That is, if diffuse is 1, I see no specular highlight, even the texture is black. Is this normal on iPhone?

Thanks,
Man
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Specular highlight on iPhone

Post by masterfalcon »

Could you give more information about how to reproduce this? Also, is this GL ES 1 or 2?
mannam
Halfling
Posts: 45
Joined: Tue Feb 15, 2011 7:23 am

Re: Specular highlight on iPhone

Post by mannam »

Sorry forgot to mention.

I build it from 1.7.3 source, should be GLES 1.

Thanks,
Man
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Specular highlight on iPhone

Post by masterfalcon »

You forgot the "how to reproduce" part. what is your material? what are you doing to the material in code? etc.
mannam
Halfling
Posts: 45
Joined: Tue Feb 15, 2011 7:23 am

Re: Specular highlight on iPhone

Post by mannam »

It's quite straightforward:

Code: Select all

material Outside_Mat
{
	technique
	{
		pass
		{
			ambient 1 1 1 1
			diffuse 1 1 1 1
			specular 1 1 1 1 50
			emissive 0 0 0

			texture_unit
			{
				texture texture.png
				tex_coord_set 0
				colour_op modulate
				mipmap_bias -2
				scale 1 1
				scroll 0 0
				rotate 0
			}
		}
	}
}
In coding, I add a directional light with white specular:

Code: Select all

	mLight = sceneManager->createLight("Light");
	mLight->setType(Light::LT_DIRECTIONAL);
	mLight->setSpecularColour(1, 1, 1);
The problem is only on iPhone. In PC, the specular is correct.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Specular highlight on iPhone

Post by masterfalcon »

Thanks. I've confirmed this on GL ES 1. I'll let you know what I find out.
warmi
Gnoll
Posts: 674
Joined: Sun May 27, 2007 3:56 am
Location: USA

Re: Specular highlight on iPhone

Post by warmi »

masterfalcon wrote:Thanks. I've confirmed this on GL ES 1. I'll let you know what I find out.
Specular will never work properly with GLES 1 when using texturing, because GLES 1.x lacks GL_SEPARATE_SPECULAR_COLOR.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Specular highlight on iPhone

Post by masterfalcon »

Agreed. That's exactly what I was seeing once I started looking into it.
mannam
Halfling
Posts: 45
Joined: Tue Feb 15, 2011 7:23 am

Re: Specular highlight on iPhone

Post by mannam »

Understood, thanks.

Man