Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualgreenpig83

Posted 16 May 2013 - 01:12 PM

How do you calculate the normals for your quads? Just inside the quad or with corresponding neighbours? Your first screen looks like first option.

When you calculate a normal for one heightmap point by all 4 triangles, which use the same point, you should get a smooth shading.

 

*---*
|\ /|
| P |
|/ \|
*---*

First Screen shot the light is wrong at some tile (left corner). I think I have some wrong in the vertex -> so the Normal get wrong. Or maybe there is no Shadow setup, so that tile still get more light ?

Because after Smooth,I still use the same Normal Calculating way ( I use only in side the Quad, multy 2 vector, using neibour call Phong shading ? ) . And most of the quad look right with light.

 

Now I'm trying to recalculate the light factor by Code (To do a lightMap demo, Try to precalculate the Light mask, so I can apply Light without using 3D for low Spec System). Using vector and Light direction.. But Somehow I cant get the same light  with DirectX (Use Normal inside Vertex and enable Light, the LIght now is ...) . Maybe inside DirectX FrameWork they added some thing, not just  like in this Tutorial : http://ogldev.atspace.co.uk/www/tutorial18/tutorial18.html

 

 

Light.Type = D3DLIGHT_DIRECTIONAL;
 
//Light.Position=D3DXVECTOR3(-1232.0f,960.0f,2.0f);
 
Light.Diffuse.r = 1.0f;
Light.Diffuse.g = 1.0f;
Light.Diffuse.b = 1.0f;
 
//0.2f, -0.9f, -0.2f
Light.Direction.x = 1.0f;
Light.Direction.y = 1.0f;
Light.Direction.z = 1.0f;

#1greenpig83

Posted 16 May 2013 - 01:10 PM

How do you calculate the normals for your quads? Just inside the quad or with corresponding neighbours? Your first screen looks like first option.

When you calculate a normal for one heightmap point by all 4 triangles, which use the same point, you should get a smooth shading.

 

*---*
|\ /|
| P |
|/ \|
*---*

First Screen shot the light is wrong at some tile (left corner). I think I have some wrong in the vertex -> so the Normal get wrong. Or maybe there is no Shadow setup, so that tile still get more light ?

Because after Smooth,I still use the same Normal Calculating way ( I use only in side the Quad, multy 2 vector, using neibour call Phong shading ? ) . And most of the quad look right with light.

 

Now I'm trying to recalculate the light factor by Code. Using vector and Light direction.. But Somehow I cant get the same light  with DirectX (Use Normal inside Vertex and enable Light, the LIght now is ...) . Maybe inside DirectX FrameWork they added some thing, not just  like in this Tutorial : http://ogldev.atspace.co.uk/www/tutorial18/tutorial18.html

 

 

Light.Type = D3DLIGHT_DIRECTIONAL;
 
//Light.Position=D3DXVECTOR3(-1232.0f,960.0f,2.0f);
 
Light.Diffuse.r = 1.0f;
Light.Diffuse.g = 1.0f;
Light.Diffuse.b = 1.0f;
 
//0.2f, -0.9f, -0.2f
Light.Direction.x = 1.0f;
Light.Direction.y = 1.0f;
Light.Direction.z = 1.0f;

PARTNERS