Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Terrain shader questions  (Read 436 times)
tkuehnl
Customers
Community Member
*****
Posts: 5


« on: May 17, 2008, 03:10:50 PM »

Greetings,

  Am I correct that the terrain vertex data does not include tangents and binormals? I would like to add normal mapping to my shader, is my only option to calculate tangents and binormals in the shader? I have my concerns about performance with that method.

Anyone care to discuss? Anyone already have it working?

Much appreciated.

-Todd
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4436


WWW
« Reply #1 on: May 17, 2008, 06:39:56 PM »

Yes for now you must compute Tangent & Binormal in shader.

It's not that hard in the case of land shader though. You can compute it in the vertex shader using the vertex normal as a base. It can be done with 2 or 3 cross products so the performance loss won't be big.

Tangent info will be soon available in minimesh & terrain.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
tkuehnl
Customers
Community Member
*****
Posts: 5


« Reply #2 on: May 18, 2008, 02:06:28 AM »

Thanks for the info Sylvain, I will compute them within the shader.

take care,

-Todd
Logged
AriusEso
Customers
Community Member
*****
Posts: 317

Esoteric


« Reply #3 on: June 03, 2008, 09:01:53 PM »

I actually did this a couple months back. With the help of Sylvain and Waterman on IRC we got the following solution working. So, for anybody searching:

Code:
float3 Tangent   = cross(IN.Normal, float3(1, 0, 0));
float3 BiTangent = cross(Tangent, IN.Normal);
         Tangent          = cross(IN.Normal, BiTangent);
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks