Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > RenderMan interface > Re: two differe...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 746 of 788
Post > Topic >>

Re: two different shaders in the same geometry object??

by Rick LaMont <lamont@[EMAIL PROTECTED] > Sep 16, 2007 at 03:15 PM

<fruela@[EMAIL PROTECTED]
> wrote:
> It is possible to create a sphere with one half "metal shader" and the
> other half with "matte shader"?

The easiest way is to create two hemispheres:

    Surface "metal"
    Sphere 1 -1 0 360
    Surface "matte"
    Sphere 1 0 1 360

Another way is to write one shader that does it all:

    surface metalmatte(float Ka = 1, Kd = 1, Ks = 1, roughness = 0.1)
    {
        normal Nf = faceforward(normalize(N), I);
        Oi = Os;
        if (v < 0.5)
            Ci = Os * Cs * (Ka * ambient() +
                Ks * specular(Nf, normalize(-I), roughness));
        else
            Ci = Os * Cs * (Ka * ambient() + Kd * diffuse(Nf));
    }


Rick LaMont
Dot C Software, Inc.
http://www.dotcsw.com/
 




 2 Posts in Topic:
two different shaders in the same geometry object??
fruela@[EMAIL PROTECTED]   2007-09-16 10:37:20 
Re: two different shaders in the same geometry object??
Rick LaMont <lamont@[E  2007-09-16 15:15:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 12:55:24 CST 2008.