Here's a preset that takes the existing preset and adds the conversion
back to a world space normal. Basically, it takes apart the components
of the color, scales the appropriate vectors (from the earilier
calculations) by the components and adds them together. The sign was
flipped on the green component, so I had to subtract that one...
Hopefully this will clarify things a bit more.
http://www.file.sc/b4c303/Normal_Map_RoundTrip.Preset
- Andy
Bernard Lebel wrote:
> Hi Andy,
>
> Thanks a lot for the explanation. But I'm still lost (I know...)
>
> I have implemented the whole preset you created into a single shader.
> The picture below illustrates the bumpmap converted into a tangeant
> normal maps.
> http://www.bernardlebel.com/img_remote/3D/XSI/bump2tangeants_tangeantsonly.jpg
>
>
> Now, that's fine if you want to rendermap, but if you want to use that
> bumpmap on-the-fly as a normal map, you have to pipe the output into a
> XSINormalMap shader, as shown below:
> http://www.bernardlebel.com/img_remote/3D/XSI/bump2tangeants_xsinormalmap.jpg
>
>
> So I'm trying to eliminate the need to use a XSINormalMap shader. If I
> implement your suggestion (that is, to use the mi_normal functions to
> convert from tangeants to world space), this is what I get:
> http://www.bernardlebel.com/img_remote/3D/XSI/bump2tangeants_tangeants2world.jpg
>
>
>
>
> Thanks
> Bernard
>
>
>
> On 8/23/06, Andy Jones <andy(at)thefront.com> wrote:
>
>> A way to think of 3-dimensional coordinates is that they are sums of 3
>> non-parallel basis vectors. The standard basis for 3-d space is:
>>
>> (1, 0, 0)
>> (0, 1, 0)
>> (0, 0, 1)
>>
>> With sums of those three vectors you can easily generate any point in
>> 3-d space. To deal with tangent space, your basis is:
>>
>> tangent vector
>> normal vector
>> binormal vector
>>
>> So, your tangent space normal is just a an encoding of those three
>> vectors in color space, so:
>>
>> normal = (2 * R - 1) * tangent + (2 * G - 1) * binormal + (2 * B - 1) *
>> normal.
>>
>> Or, at least something along those lines (possibly flipping signs,
>> depending on how you got your binormal and what direction the tangent is
>> given in. Assuming everything was properly normalized to begin with,
>> this should give you a vector of length 1, just like a regular normal.
>> You should normalize it, though, for good measure, just in case the
>> tangent space map was wonky. For example, if the tangent normal had
>> some procedural component or something. There's a normalize function in
>> mental ray.
>>
>> Then, once you've got that normal, you just have to convert it to world
>> space, or whatever you need it in. This is accomplished with the
>> standard mi_vector_from_object and mi_vector_to_world functions (use the
>> reverse order of the rendermapping shader you made).
>>
>> -Andy
>>
>> Bernard Lebel wrote:
>>
>> > Hi Alan (and Ben!)
>> >
>> > Assuming all vectors live in world space, what *operation* would be
>> > needed to achieve the same result as the XSINormalMap?
>> >
>> >
>> > Thanks
>> > Bernard
>> >
>> >
>> >
>> > On 8/23/06, Alan Jones <skyphyr(at)gmail.com> wrote:
>> >
>> >> The problem you have is the interpolate normals or in world (or
>> >> internal or maybe object - or perhaps they're identical) space. You
>> >> need to transform the interpolated normals into tangent space to
>> >> combine the two. Or combine them both in world space then convert it
>> >> to tangent. Or.. well pick any option you like, but you need to
>> >> effectively combine them into one normal in some space and then
>> >> convert from that space to tangent space.
>> >>
>> >> Cheers,
>> >>
>> >> Alan.
>> >>
>> >> On 8/23/06, Bernard Lebel <3dbernard(at)gmail.com> wrote:
>> >> > Hello,
>> >> >
>> >> > I'd like to know, if anyone has any idea, how is the XSINormalMap
>> >> > shader combining tangeants and interpolated geometry normals.
>> >> >
>> >> >
>> >> >
>> >> > Let say the tangeants look like this:
>> >> >
>> >>
>> http://www.bernardlebel.com/img_remote/3D/XSI/XSINormalMap_tangeantinput.jpg
>>
>> >>
>> >> >
>> >> > Now, let say the interpolated normals look like this:
>> >> >
>> >>
>> http://www.bernardlebel.com/img_remote/3D/XSI/XSINormalMap_interpnormalsi.jpg
>>
>> >>
>> >> >
>> >> > Then, when combined in the XSINormalMap shader, the output is this:
>> >> >
>> http://www.bernardlebel.com/img_remote/3D/XSI/XSINormalMap_output.jpg
>> >> >
>> >> >
>> >> > I have no clue whatsoever how is this result achieved. I'm
>> trying to
>> >> > implement it into my own shader (C++), but am blocked at that
>> point.
>> >> >
>> >> >
>> >> >
>> >> > Thanks
>> >> > Bernard
>> >> > ---
>> >> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
>> >> in body:
>> >> > unsubscribe xsi
>> >> >
>> >> ---
>> >> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
>> >> body:
>> >> unsubscribe xsi
>> >>
>> > ---
>> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
>> > body:
>> > unsubscribe xsi
>> >
>>
>> ---
>> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
>> body:
>> unsubscribe xsi
>>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> body:
> unsubscribe xsi
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi