nicholas_yue Posted January 14, 2004 Share Posted January 14, 2004 I am attempting to port the glow shader from RenderMan SL I am not sure how to handle Cs. The prman.h header file suggest we pass in the color information via a VEX parameter. I know how to add a color parameter, my question is, how do we get the color information in the first place. Cs is defined as the incoming color information. Here is the glow shader source in RenderMan SL /* * glow(): a shader for providing a centered "glow" in a sphere * * From _RC_ Listing 16.26 p. 369 * Surface mapping object-space coordinates to colors */ surface s_RCGlow (float attenuation = 2) { float falloff = I.N; /* Direct incidence has cosine closer to 1. */ if (falloff < 0) { /* Normalize falloff by lengths of I and N */ falloff = falloff * falloff / (I.I * N.N); falloff = pow (falloff, attenuation); Ci = Cs * falloff; Oi = falloff; } else Oi = 0; } Quote Link to comment Share on other sites More sharing options...
David Gary Posted January 14, 2004 Share Posted January 14, 2004 Once you've created and fed your point attribute ( say Cs or whatever). In VOP, just add a Parameter VOP, rename it to your point Attribute ( Cs here), and turn on Export Parameter, in the Parameter Page. The parameter that you defined at specific points will be interpolated on the whole surface. Hope it answers your question. Quote Link to comment Share on other sites More sharing options...
Mcronin Posted January 14, 2004 Share Posted January 14, 2004 #pragma oplabel "NYVEX Glow" #pragma opname NYVEX_Glow #pragma opicon SHOP_surface #pragma label attenuation "Attenuation" #pragma label gcolor "Color" #pragma hint attenuation float #pragma hint gcolor color #pragma range attenuation 1 20 surface s_RCGlow (vector gcolor = {1.1, 1.1, 0.9}; float attenuation = 2) { float falloff = dot(I, N); /* Direct incidence has cosine closer to 1. */ if (falloff < 0) { /* Normalize falloff by lengths of I and N */ falloff = falloff * falloff / (dot(I,I) * dot(N,N)); falloff = pow (falloff, attenuation); Cf = gcolor*falloff; Of = falloff; } else { Of = 0; } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.