RenderMan Tutorial - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

RenderMan Tutorial

Description:

Geometry code can be run directly, or output to RIB file. Shading ... http://howto.tucows.com/LDP/LDP/LG/issue15/bmrt-part1.html. http://howto.tucows.com/LDP ... – PowerPoint PPT presentation

Number of Views:130
Avg rating:3.0/5.0
Slides: 36
Provided by: anselmo9
Category:

less

Transcript and Presenter's Notes

Title: RenderMan Tutorial


1
RenderMan Tutorial
  • COMP238 Fall 2000

2
Overview
  • Two languages
  • Geometry - set of C subroutines
  • Shading - a C-like language
  • Geometry code can be run directly, or output to
    RIB file
  • Shading code is compiled to byte-code

3
Process
RIB File
Rman Geom Code
Rman Program
cc
render Program
Rman Shader .sl
shader
Byte-code Shader .slo
Image File
txmake
TIFF image
Rman texture
4
Local Configuration
  • Files are in /usr/local/prman
  • On Suns, SGI, Linux
  • File /usr/local/prman/rendermn.ini has default
    values (file paths, etc).
  • You can make your own .rendermn.ini to override
  • Blue Moon now does Windows

5
Resources
  • RenderMan Companion copies in Glab
  • Pixar web pages
  • http//www.pixar.com/products/renderman/toolkit/To
    olkit/user.html
  • Look on course resources web page for links

6
RenderMan code
  • include ltri.hgt
  • RtPoint Square4 .5,.5,.5, .5,-.5,.5,
    -.5,-.5,.5, -.5,.5,.5
  • main(void)
  • RiBegin(RI_NULL) / Start the renderer /
  • RiDisplay("RenderMan", RI_FRAMEBUFFER,
    "rgb", RI_NULL)
  • RiFormat((RtInt) 256, (RtInt) 192, -1.0)
  • RiShadingRate(1.0)
  • RiWorldBegin()
  • RiSurface("constant", RI_NULL)
  • RiPolygon( (RtInt) 4, /
    Declare the square /
  • RI_P, (RtPointer) Square,
    RI_NULL)
  • RiWorldEnd()
  • RiEnd() / Clean up /

7
RIB
  • Display "RenderMan" "framebuffer" "rgb"
  • Format 256 192 -1
  • ShadingRate 1
  • WorldBegin
  • Surface "constant"
  • Polygon "P" 0.5 0.5 0.5 0.5 -0.5 0.5 -0.5 -0.5
    0.5 -0.5 0.5 0.5
  • WorldEnd

8
Output to a File
  • Examples have display output
  • RiDisplay("RenderMan", RI_FRAMEBUFFER, "rgb",
    RI_NULL)
  • Change to
  • RiDisplay("filename", RI_FILE, RI_RGBA,
    RI_NULL)
  • or RIB to
  • Display "filename" "file" "rgba"

9
Making a Model
  • Procedural
  • RIB files on web
  • Look at my resources page
  • Many programs output RIB
  • Format converter

10
Parameter Lists
  • Variable length
  • Name/Value pairs or vector
  • RiPatch(RI_BICUBIC, RI_P, (RtPointer)
  • Patch, RI_NULL)

11
Surface Shader Specification
  • ks 0.5 ka kd 0
  • RiSurface("plastic",
  • (RtToken)"Ka", (RtPointer)ka,
  • (RtToken)"Kd", (RtPointer)kd,
  • (RtToken)"Ks", (RtPointer)ks,
  • RI_NULL)
  • RiCylinder(0.5, -0.5, 0.5, 360.0, RI_NULL)

12
Shader Instances
  • ks 0.5 ka kd 0
  • RiSurface("plastic",
  • (RtToken)"Ka", (RtPointer)ka,
  • (RtToken)"Kd", (RtPointer)kd,
  • (RtToken)"Ks", (RtPointer)ks,
  • RI_NULL)
  • RiCylinder(0.5, -0.5, 0.5, 360.0, RI_NULL)
  • ks 0.2 ka 0.3 kd 0.1
  • RiSurface("plastic",
  • (RtToken)"Ka", (RtPointer)ka,
  • (RtToken)"Kd", (RtPointer)kd,
  • (RtToken)"Ks", (RtPointer)ks,
  • RI_NULL)

13
Shader Example
  • surface clouds(float Kd.8, Ka.2 )
  • float sum
  • float i, freq
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq 4.0
  • for (i 0 i lt 6 i i 1)
  • sum sum 1/freq abs(.5 - noise(freq
    Psh))
  • freq 2 freq
  • Ci mix(Cs, white, sum4.0)
  • Oi 1.0 / Always make the
    surface opaque /

14
Result
15
Shader Example (defaults)
Must have default values
  • surface clouds(float Kd.8, Ka.2 )
  • float sum
  • float i, freq
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq 4.0
  • for (i 0 i lt 6 i i 1)
  • sum sum 1/freq abs(.5 - noise(freq
    Psh))
  • freq 2 freq
  • Ci mix(Cs, white, sum4.0)
  • Oi 1.0 / Always make the
    surface opaque /

16
Why?
  • Because youre not required to specify
    parameters
  • RiWorldBegin()
  • RiColor(color)
  • RiSurface("clouds", RI_NULL)
  • RiPolygon( (RtInt) 4,
  • RI_P, (RtPointer) Square, RI_NULL)
  • RiWorldEnd()

17
Shader Example (data types)
  • surface clouds(float Kd.8, Ka.2 )
  • float sum
  • float i, freq
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq 4.0
  • for (i 0 i lt 6 i i 1)
  • sum sum 1/freq abs(.5 - noise(freq
    Psh))
  • freq 2 freq
  • Ci mix(Cs, white, sum4.0)
  • Oi 1.0 / Always make the
    surface opaque /

Specialized data types
18
Data Types
  • Float (no integer!)
  • String
  • Point
  • Color
  • New in latest RenderMan
  • Vector, matrix
  • Also arrays of any type

19
Uniform vs. Varying
  • Uniform means that the parameter is the same
    across surface
  • More efficient
  • default
  • Varying variables can be attached to vertices
  • Interpolated across surface

20
Shader (magic variables)
  • surface clouds(float Kd.8, Ka.2 )
  • float sum
  • float i, freq
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq 4.0
  • for (i 0 i lt 6 i i 1)
  • sum sum 1/freq abs(.5 - noise(freq
    Psh))
  • freq 2 freq
  • Ci mix(Cs, white, sum4.0)
  • Oi 1.0 / Always make the
    surface opaque /

Surface position
Color and opacity
21
Predefined Global Variables
  • Position P
  • Normal N
  • Surface color Cs
  • Output color Ci
  • Output opacity Oi
  • Others P.292 of RenderMan Companion

22
Shader (built-in functions)
  • surface clouds(float Kd.8, Ka.2 )
  • float sum
  • float i, freq
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq 4.0
  • for (i 0 i lt 6 i i 1)
  • sum sum 1/freq abs(.5 - noise(freq
    Psh))
  • freq 2 freq
  • Ci mix(Cs, white, sum4.0)
  • Oi 1.0 / Always make the
    surface opaque /

23
Built-in Functions
  • Trig functions
  • Standard math
  • Texture, bump, environment, and shadow mapping
    functions
  • Geometric - area(), normalize(V)
  • printf()

24
Shader (return value Ci, Oi)
  • surface clouds(float Kd.8, Ka.2 )
  • float sum
  • float i, freq
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq 4.0
  • for (i 0 i lt 6 i i 1)
  • sum sum 1/freq abs(.5 - noise(freq
    Psh))
  • freq 2 freq
  • Ci mix(Cs, white, sum4.0)
  • Oi 1.0 / Always make the
    surface opaque /

25
Constant Shader
  • surface
  • constant()
  • Oi Os
  • Ci Os Cs

26
Lighting
  • illuminance(point , axis, angle)
  • Executes each light within specified angle
  • Rarely used.
  • Returns Cl, L

27
Alternate Approach
  • Usually shortcut with ambient(), diffuse(),
    specular()
  • Examples next

28
Diffuse Surface
  • surface
  • matte( float Ka 1,
  • Kd 1 )
  • normal Nf faceforward(normalize(N),I)
  • Oi Os
  • Ci Os Cs (Kaambient() Kddiffuse(Nf))

29
Plastic
  • surface plastic( float Ks .5, Kd .5,
  • Ka 1, roughness .1
  • color specularcolor 1 )
  • normal Nf faceforward(normalize(N), I )
  • vector V normalize(-I)
  • Oi Os
  • Ci Os( Cs (Kaambient() Zddiffuse(Nf))
  • specularcolor Ks specular(Nf,V,roughness)
    )

30
Lights
  • The light shaders generate Cl, the intensity of
    the light
  • Also control cone of light

31
Ambient Light
  • light
  • ambientlight(
  • float intensity 1
  • color lightcolor 1 )
  • Cl intensity lightcolor

32
Point Light
  • light
  • pointlight(
  • float intensity 1
  • color lightcolor 1
  • point from point "camera" (0,0,0) )
  • illuminate( from )
  • Cl intensity lightcolor / L.L

33
illuminate
  • illuminate(position , axis, angle)
  • Position specifies apex of cone
  • Axis direction of center of cone
  • Angle of cone

34
What Next?
  • Look at Chapter 16 of RenderMan Companion
  • Compile and modify some of the examples
  • http//www.pixar.com/products/rendermandocs/toolki
    t/Toolkit/tut.html
  • will help you with compilation, etc.

35
Other Resources
  • RenderMan Docs (PDF and HTML)
  • http//www.pixar.com/products/renderman/toolkit/To
    olkit/
  • Articles
  • http//www.cgrg.ohio-state.edu/smay/RManNotes/
  • http//howto.tucows.com/LDP/LDP/LG/issue15/bmrt-pa
    rt1.html
  • http//howto.tucows.com/LDP/LDP/LG/issue17/bmrt-pa
    rt2.html
Write a Comment
User Comments (0)
About PowerShow.com