MR Shaders in XSI


Hi there,

I’m teaching myself XSI for all it’s worth and have dabbled with C++ programming in the past.
That’s how I decided to try compile an MR shader from the source.
I got the code for the Cook-Torrance shader from

And so I managed to port the example to VC++, compile the spdl and it works.
Problem is the material is a lot lighter than the included Simple Cook-Torrance shader.
So I figured it’s an XSI specific problem that Ambient color has to be calculated
using the scene Ambience color before returning.

So far I managed to get the Ambience color to work from both the shader spdl color box
and alternatively from the Ambience color box. So I have access to both colours from the dll.
What I wanted to ask is?

What calculation do you make with the two values before returning the Ambient colour from the shader?

That’s all I wanted to ask.
Nanomation seems to have a nice XSI shader writing tutorial and run into the very same problem
>> LINK <<

You should see that the shader behaves pretty much like the built-in XSI phong shader. You may notice that the wrapmaterial is quite a bit lighter than the XSI shader if you use exactly the same values. This is because XSI scales all its ambient values by a global multiplier (set in Render>Modify>Ambience). We would have to add some extra code to take advantage of this, but it’s beyond the scope of this tutorial.

Just wondering if someone would be so kind as to shed some further light on
how to compile shaders for XSI and deal with the Ambient/Ambience calculation properly?


I havent played with MR shaders but i would imagine that Ambiant light simply multiplies with material ambiant color, as diffuse color multiplies with diffuse lighting.


Yes that worked like a charm thank you very much :buttrock:

So I got my home compiled Simple Cook-Torrance shader now.
I think the next step will be passing the radiance parameter to it.
Maybe that’s another day.

Here’s a screenie :slight_smile:


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.