Jump to content

  • Log In with Google      Sign In   
  • Create Account


Wrong vertex displacement direction


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Juan Camilo Acosta Arango   Members   -  Reputation: 152

Like
0Likes
Like

Posted 27 June 2013 - 06:10 PM

Hi

 

I am implementing displacement over a tessellated surface, but the result is strange because the position of the vectors is tending to go up. Is that normal? i think the new position must follow the normal map.

THis is my code:

 

float offset = g_DisplacementTxt.SampleLevel(g_samLinear, Out.texCoord, 0).x;

float4 txtNormal = g_NormalTxt.SampleLevel( g_samLinear, Out.texCoord, 0 ) * 2 -1;

position = position + (txtNormal * offset);

 

WrongDisplacement+direction.png


Juan Camilo Acosta Arango

Bogotá, Colombia


Sponsor:

#2 TiagoCosta   Crossbones+   -  Reputation: 1929

Like
1Likes
Like

Posted 27 June 2013 - 06:20 PM

The vertices should be displaced in the normal direction.

 

Are you transforming the normal to world-space?


Tiago Costa
Aqua Engine - my DirectX 11 game "engine" - In development

#3 Juan Camilo Acosta Arango   Members   -  Reputation: 152

Like
0Likes
Like

Posted 27 June 2013 - 08:52 PM

I am only sampling the normal texture and then 2 * -1 to get the world normal

 

float4 txtNormal = g_NormalTxt.SampleLevel( g_samLinear, Out.texCoord, 0 ) * 2 -1;


Juan Camilo Acosta Arango

Bogotá, Colombia


#4 MJP   Moderators   -  Reputation: 10632

Like
0Likes
Like

Posted 27 June 2013 - 11:30 PM

Tiago is asking if your normal map contains world-space normals, since typically they contain tangent-space normals that have to be transformed to world-space before you can use them.



#5 Juan Camilo Acosta Arango   Members   -  Reputation: 152

Like
0Likes
Like

Posted 28 June 2013 - 07:16 AM

Yes, when i made the map i set it to be world space normals


Juan Camilo Acosta Arango

Bogotá, Colombia


#6 TiagoCosta   Crossbones+   -  Reputation: 1929

Like
0Likes
Like

Posted 28 June 2013 - 08:04 AM

Yes, when i made the map i set it to be world space normals

 

Don't you mean object space normals?

 

If they're indeed object space normals, and position is in world space you have to transform the normals to world space using the world space matrix.


Tiago Costa
Aqua Engine - my DirectX 11 game "engine" - In development

#7 Juan Camilo Acosta Arango   Members   -  Reputation: 152

Like
0Likes
Like

Posted 05 July 2013 - 02:13 PM

I have found another clue, i duplicated the geometry and place in positions different from the origin and these is the result i get....

wrong+disp.png

 

I think is some one related to the vertex position space but not sure.


Juan Camilo Acosta Arango

Bogotá, Colombia





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS