Jump to content

  • Log In with Google      Sign In   
  • Create Account


Displacement of vertex height from a grey scale texture on CPU


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
1 reply to this topic

#1 MARS_999   Members   -  Reputation: 1255

Like
0Likes
Like

Posted 11 March 2014 - 07:35 PM

I am lost on how to do this correctly...

 

I have a grey scale texture with 0-255 values for heights of my mesh, but the texture size is 256x256 and the mesh only has 409 vertices. Problem is I don't understand how I can do a one to one ratio here to offset the vertex height to match the texture. How are others going about this? I am assuming you need to sample an area and not use all 256x256 pixels in the displacement texture?

 

If anyone has code for this I would appreciate it to study from as I am totally lost here.

 

Thanks!



Sponsor:

#2 eppo   Crossbones+   -  Reputation: 2344

Like
1Likes
Like

Posted 12 March 2014 - 01:12 AM

A typical displacement map is sampled like any other texture: using a set of texture coordinates (like from a uv map). You can use adaptive tessellation to create additional vertices that sample this map in between the original vertices.

 

If you want to do a one-on-one mapping of 409 displacement values tied to 409 vertices it makes more sense to store them as a vertex-(weight-)-map and use them as a vertex shader input (next to position, uvs, etc.).






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