RE: passing U and V vectors to mental ray

Date : Wed, 1 Mar 2006 16:14:15 -0500
To : <XSI(at)Softimage.COM>
From : "Halfdan Ingvarsson" <hingvars(at)Softimage.COM>
Subject : RE: passing U and V vectors to mental ray
The tangent version would not be susceptible to triangle seams. The mi_bump_basis tries to compute bump vectors (tangent/binormals) based on individual triangles, irrespective of neighbours (since mental ray doesn't support topological data). Instead, the tangent op averages tangents over edges that neighbour a vertex. This gives a much better behaved tangents.
 
CAV is a color-at-vertices cluster property.
 
 - ½
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Mathieu Leclaire
Sent: Tuesday, 28 February, 2006 17:15
To: XSI(at)Softimage.COM
Subject: RE: passing U and V vectors to mental ray

I’m not sure what CAV is. I’m currently using Matt Lind suggestion of using the mib_bump_basis() function from the basetexgen.c example and it seems to be working well so far. But I am curious about that Tangent and CAV technique. Could you elaborate more on it please? Do you think it would be faster to process with your technique? What I also like about Lind’s suggestion versus yours is that you don’t need to create a Tangent operator so it’s a few less steps to do for the users but if it can accelerate the calculations, maybe I’ll use yours instead. But if you could please elaborate a bit more, it would be greatly appreciated.

 

Thanks.

 

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Halfdan Ingvarsson
Sent: Tuesday, February 28, 2006 2:38 PM
To: XSI(at)Softimage.COM
Subject: RE: passing U and V vectors to mental ray

 

state->derivs will be filled in for parametric surfaces since derviatives are easy to derive from those (pun intended).

 

For polymeshes, there are no well-defined derivatives, since the surface is not continuous. It is possible to provide derivatives for polygon meshes but we don't since not everyone agrees what the best way of computing them is.

 

There's a Tangent operator in XSI (Property->Tangent) that you can apply to a texture projection (which provides UV direction) and a CAV (which receives the tangents). You can then add a texturespace parameter to a shader that selects a CAV, which will then get added as a texture space to the polymesh object and you can get the tangents from that.

 

 - ½

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Mathieu Leclaire
Sent: Tuesday, 28 February, 2006 14:30
To: XSI(at)Softimage.COM
Subject: RE: passing U and V vectors to mental ray

I’m not sure that’s the info I’m looking for. First off, won’t the u and v vectors change depending on the texture space selected? state->derivs is not dependant of the texture space and they always return me a null vector in all the tests I’ve done. I looked at the doc and though that maybe state->bump_x_list and state->bump_y_list could be what I was looking for but they also always return me a null vector.

 

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Alan Jones
Sent: Tuesday, February 28, 2006 12:40 PM
To: XSI(at)Softimage.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.