In Progress

OpenGL ES 2.0 lights study project

This is a very simple study style project for someone with 3D background. I'm just trying to learn OpenGL ES 2.0 lights and stuck on a problem with lighting correctly models with Phong edge smoothing normals.

Attached is a simple XCode project along with my simple 3d model .obj. This is a standard iOS 'OpenGL Game' template project generated by XCode with the only change I replaced their default cube model mesh data with the one from the included .obj. The other change is I'm rendering the model twice with slight translation on X axis.

The model actually appears to render correctly (see attached screenshot). However, each object instance is lit absolutely identical to the other despite them being offset in the scene. I suppose thats because the example XCode auto-generated vertex shader is not taking vertex position into account, only relying on the directional light vs vertex normal angle to calculate diffusion. The light is not interpolated across the whole scene, every object is just lit in the same way as the other.

This is what the auto-generated template vertex shader looks like:

void main()

{

vec3 eyeNormal = normalize(normalMatrix * normal);

vec3 lightPosition = vec3(0.0, 0.0, 1.0);

vec4 diffuseColor = vec4(0.4, 0.4, 1.0, 1.0);

float nDotVP = max(0.0, dot(eyeNormal, normalize(lightPosition)));

colorVarying = diffuseColor * nDotVP;

gl_Position = modelViewProjectionMatrix * position;

}

So this project is for changing the shaders code in such a way that actual vertex position is taken into account when computing per-vertex lighting. Please make sure you understand what I need exactly before you bid on it.

On that screenshot I attached, you can clearly see that the two blocks are lit identically which looks weird. You get a feeling that the second one is brighter while in fact if you check the actual pixel colors the two boxes are lit identicaly.

Instead, I want the light to be interpolated across the whole scene so there is no weird light step between two adjacent blocks as you can see on the screenshot. I believe this method is called Phong shading.

Thanks.

Skills: iPhone, Mobile Phone, OpenGL

See more: xcode 2.1, x-axis, vertex max, step 3d model, phone 3d model, opengl 3d model, opengl *, object 3d model, object 3d max, obj 3d model, need a 3d model for my game, mobile phone 3d model, mobile 3d model, method models, mesh 3d model, max vertex, learn to 3d model, learn rendering, learn ios, learn 3d rendering, learn 3d max model, dot pixel, blocks for 3d max, axis lighting, auto 3d model

About the Employer:
( 1 review ) Braintree, United Kingdom

Project ID: #4421424

Awarded to:

honeypotant

I am ready for you. Thanks a lot.

$144 USD in 3 days
(8 Reviews)
5.4

3 freelancers are bidding on average $202 for this job

spcinc

Please check PMB.

$250 USD in 3 days
(6 Reviews)
5.3
Coder1983

Please check personal message for details

$242 USD in 5 days
(4 Reviews)
4.0
WangJinHao

What a very easy job for me!!!!!! Dear sir. I can help you. Please check my PM! Thanks.

$315 USD in 5 days
(6 Reviews)
3.2
maolongdong

Fixed already, please check PMB

$220 USD in 1 day
(0 Reviews)
0.0