0

I am trying to build an obj file loader and I have written code to read an obj file with face f with v/vt/vn - vertex, texture coordinate, and normal.

While going through the obj file, there are so many files without normal coordinates.

My shader code in Fragment shader is:

float lambertianFactor = clamp(dot(normal, lightDirectionNormalized), 0.0, 1.0);
vec3 diffuseTextureData = texture(diffuseSampler, v_texCord).rgb;
vec3 effectiveDiffuse = diffuseTextureData*diffuse*lambertianFactor*directionalLight;    
effectiveDiffuse = diffuseTextureData*diffuse*lambertianFactor;

for obj file without normal coordinate but with diffuse texture, how am I supposed to handle diffuse lighting?

Philipp
  • 119,250
  • 27
  • 256
  • 336

0 Answers0