Image Declaration
Before anything can be created or rendered at all the renderer needs to know several things. Where will it send the output of the image (the pixels)? What name will this image have? What file format will this image be? What resolution will be the image? All of these questions are answered on a block that will usually read like this:
PixelSamples is somewhat similar to ShadingRate but it affects the anti-aliasing of the edges of your objects. It determines how manytimes the final pixel will be sampled. Higher values will give you smoother edges. Higher values are also necessary when rendering with depth of field or with motion blur. PixelFilter allows you to select what kind of filtering you want to use on your final images.
Camera Declaration
After the image settings are declared a camera needs to be created. This is usually done by calling
A special note must be added here. Remember that RenderMan has a hierarchical graphic state and it keeps track of the current coordinate system. This means that when you apply a translation or a rotation, it is the whole coordinate system that is affected. When you call the projection command you have just created a camera and the camera has its own local coordinate system. Since everything in our digital world is created AFTER the camera then we can say that the world is positioned in relation to the camera or is a children of the camera. This is a concept that is a little hard to grasp at first since in most 3D apps we tend to think of the camera as one more object in our world. For this reason you will usually see a bunch of transformation calls before the camera is declared. This moves the camera (and its coordinate) to where it needs to be.
World Declaration
After the camera we can finally begin to create our world. Calling WorldBegin creates a new coordinate system where all of our objects will be added to. The first thing to be created are usually the lights. This is done because RenderMan uses things as they are declared. You cant declare a model and then a light that is supposed to affect it, because the object will have already been passed to the renderer, so the light cant affect it. Lights are declared with the following call
LightSource “pointlight” 1 “float intensity” 10 “color lightcolor” [1 0.5 1]
After the lights are declared the objects can finally be created. Objects are usually created inside what is known as attribute blocks. You can change anything on the graphic state in an attribute block without affecting the rest of the scene because the graphic state is “popped” back to its previous state when you exit the attribute block. Lets look at a simple example of how the whole graphic state and attribute blocks work:
WorlBegin #Begin declaring the world
Surface "plastic" #Declare the current surface shader
Color [1 0 1] #Define the current color - all objects from now on
#will receive this shader and color
AttributeBegin #Now we start a new attribute block,
#we can override the previous shader and color
Attribute "identifier" "name" ["nurbsSphere1"] #Name the sphere
ConcatTransform [2.1367 0 0 0 0 2.1367 0 0 0 0 2.1367 0 0 0 0 1] #Apply a transform to the sphere's coordinate system
Surface "rudycplasmaball" "float additive" 0.75 #Change the current shader
Color [0.5 0.7 0.8] #Change the current color
Sphere 1 -1 1 360 #Declare a sphere
AttributeEnd #The end of the attribute block, we go back to the
#original Surface and Color
Sphere 1 -1 1 360 #This sphere will use plastic and the color [1 0 1]
WorldEnd #End of our world
No comments:
Post a Comment