Devam Ediyor

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.

Beceriler: iPhone, Mobile App Development, OpenGL

Daha fazlasını görün: vertex max, object model, object max, need model game, mobile phone model, method models, mesh model, max vertex, learn model, learn ios, learn max model, dot pixel, blocks max, axis lighting, render models, rendering ios, model template, model scene, model ios, model background, max step models, max object, max models game, max iphone models, max blocks

İşveren Hakkında:
( 1 değerlendirme ) Braintree, United Kingdom

Proje NO: #4421424

Seçilen:

honeypotant

I am ready for you. Thanks a lot.

3 gün içinde 144$ USD
(8 Değerlendirme)
5.4

3 freelancer bu iş için ortalamada 202$ teklif veriyor

spcinc

Please check PMB.

in 3 gün içinde250$ USD
(6 Değerlendirme)
5.3
Coder1983

Please check personal message for details

in 5 gün içinde242$ USD
(4 Değerlendirme)
4.0
WangJinHao

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

in 5 gün içinde315$ USD
(6 Değerlendirme)
3.2
maolongdong

Fixed already, please check PMB

1 gün içinde 220$ USD
(0 Değerlendirme)
0.0