Re: passing U and V vectors to mental ray

Date : Tue, 28 Feb 2006 17:39:40 +0000
To : XSI(at)Softimage.COM
From : "Alan Jones" <skyphyr(at)gmail.com>
Subject : Re: passing U and V vectors to mental ray
I'm not sure if XSI passes them to mental ray, but you should check for a state->derivs (double check the exact name in the docs though).

This would be the info you're after for working in tangent space.

Cheers,

Alan.

On 2/28/06, Mathieu Leclaire <mleclair(at)hybride.com> wrote:

Hi,

 

I've been looking at the D3 normal map source code and spdl and I've seen him accessing those vectors from the parameters:

miVector    u;          /* tangent from bump basis */

miVector    v;          /* binormal from bump basis */

 

…Which I'm guessing, and please correct me if I'm wrong, would represent the direction of the Us and the Vs so we can determine the orientation of the texture at that point right? So basically, if you would sample a point on the same triangle but a little farther in the direction of the u vector then your UV from that new point would have a U value higher then the one from the original sample… I assume that's what it represents.

 

Anyway, D3 uses those u and v vectors to transform the vectors to UV space or from UV space by putting them in a matrix along with the surface normal before calling a mi_vector_transform.

 

I can find a lot of great use to those u and v vectors and create cool shaders but my attempt to access those vectors through the spdl have so far failed miserably. I'm just not yet comfortable with spdls and D3 links a few of them through the phenomenon section like this:

 

phenomenon "d3_normalmap_gen_declare"

{

    Name = "d3_normalmap_gen";

    Use = texture;

    Version = 1;

 

    Node "basis"            = guid "{811FFAA5-2A42-47DF-B767-8DAEB5993E9C}";

    Node "nmapgen"          = guid "{9B4BC656-96D1-4F3A-AC2F-2172A5D406A6}";

 

    Connection "basis::ntex"            = interface "tspace_id";

    Connection "basis::project"         = interface "project";

 

    Connection "nmapgen::u"             = "basis::u";

    Connection "nmapgen::v"             = "basis::v";

    Connection "nmapgen::type"          = interface "type";

    Connection "nmapgen::objects"       = interface "objects";

 

    Connection root                     = "nmapgen";

}

 

…Where nmapgen is linked through another spdl that contains the u and v vectors parameters. I'm just all confused how it all works here. Can't I put all this in the same spdl instead of having 2 spdls to install? Can anyone just explain to me how to build my shaders spdl so that the user can chose a texture space and where mental ray will be able to extract the u and v vectors? I want my shader to work whether D3 is installed or not. Can anyone explain all this to me please?

 

Thanks!

 

 

Mathieu Leclaire

R&D Programmer

Hybride Technologies



Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.