Jump to content

  • Log In with Google      Sign In   
  • Create Account


Texture Shading


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
3 replies to this topic

#1 Such1   Members   -  Reputation: 435

Like
0Likes
Like

Posted 22 October 2012 - 09:01 AM

Hey guys. I'm using DirectX 11 with Shader 4.0 to create a real time terrain.
Since I'm usign Shader4.0 for compatibility purposes I can't use RWTexture2D so I'm usign RWStructuredBuffer.
But the terrain is squared now. I need a way to blend between each of the square but I can't find a good algorithm.

Sponsor:

#2 Such1   Members   -  Reputation: 435

Like
0Likes
Like

Posted 22 October 2012 - 09:19 AM

Ok. I added this to the code and it already helped:
instead of:
return buffer[y*buffeLength + x];

float xPart = x-(int)x;
return buffer[y*buffeLength + x]*(1-xPart) + buffer[y*buffeLength + x + 1]*xPart;

But I don't know how to add the y component to the formula.

#3 phil_t   Crossbones+   -  Reputation: 2484

Like
1Likes
Like

Posted 22 October 2012 - 11:43 AM

This might help you: http://en.wikipedia.org/wiki/Bilinear_interpolation#Unit_Square

Have a look at the section "Unit Square". I think this is the formula you want?

#4 Such1   Members   -  Reputation: 435

Like
0Likes
Like

Posted 22 October 2012 - 04:08 PM

Thank you. I continued playing with my code until I got some good results and that is exactly what I got.
I was trying to get the same result using triangles instead of quads and it wasn't good.




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