RenderMan Shading Language - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

RenderMan Shading Language

Description:

created and defined by Pixar at 1987. a postscript for 3D. a Scene Description Language ... specularcolor * Ks * specular(Nf,V,roughness) ); 21 / 23. Daniel Scherzer ... – PowerPoint PPT presentation

Number of Views:301
Avg rating:3.0/5.0
Slides: 23
Provided by: antonlf
Category:

less

Transcript and Presenter's Notes

Title: RenderMan Shading Language


1
RenderManShading Language
  • Daniel Scherzer
  • Vienna University of Technology

2
abstraction
SW
RenderMan
Real-Time Shading Languages
OpenGL 2.0
OpenGL
HW Shader
time
HW
1987
2002
1998
1992
3
What is RenderMan (1)?
MonstersInc by Pixar
Entropy image contest winner by Claude Schitter
A Bugs Life by Pixar
4
What is RenderMan (2)?
  • created and defined by Pixar at 1987
  • a postscript for 3D
  • a Scene Description Language
  • not a modeling program
  • not a rendering program
  • interface between modeling and rendering
  • a standard not a product
  • implementations Photorealistic RenderMan, BMRT,
    Entropy

5
RenderMan Structure
  • RIB (RenderMan Interface Bytestream)
  • ASCII, binary
  • API
  • function calls
  • Shading Language
  • C-style with specialized datatypes (vector,
    color) and functions (reflect, normalize)

6
RIB Example
  • Display "RenderMan" "framebuffer" "rgb"
  • Format 256 192 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

7
RIB Example
  • Display "RenderMan" "framebuffer" "rgb"
  • Format 256 192 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
API Example
  • 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)
  • RiWorldBegin()
  • RiSurface("constant", RI_NULL)
  • RiPolygon( (RtInt) 4, / Declare
    the square /
  • RI_P, (RtPointer) Square,
    RI_NULL)
  • RiWorldEnd()
  • RiEnd() / Clean up /

9
Shading Language Example
  • surface clouds(float vfreq .8 )
  • float sum
  • float i
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq vfreq
  • 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 /

10
Shading Language Example
  • surface clouds(float vfreq .8 )
  • float sum
  • float i
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq vfreq
  • 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 /

11
Shading Language Example
  • surface clouds(float vfreq .8 )
  • float sum
  • float i
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq vfreq
  • 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 /

12
Shading Language Example
  • surface clouds(float vfreq .8 )
  • float sum
  • float i
  • color white color(1.0, 1.0, 1.0)
  • point Psh transform("shader", P)
  • sum 0
  • freq vfreq
  • 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 /

13
Shading Language 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
RIB with Shader Example
  • Display "RenderMan" "framebuffer" "rgb"
  • Format 256 192 1
  • WorldBegin
  • Surface "clouds"
  • 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

15
Result
16
RenderMan Structur (2)
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
17
RenderMan Shading Language (1)
  • C-style
  • C operators cross-product scalar-product
  • datatypes float, vector, matrix, color
  • functions geometry functions (length, distance,
    normalize, reflect), math functions (clamp,
    random)
  • no pointers
  • implicit parameters and results (P, N, u, v,
    time, Cs, Os, Ci, Oi)
  • implicit execution

18
RenderMan Shading Language (2)
  • Shader types
  • surface
  • light
  • volume
  • displacement
  • transformation
  • image

19
RenderMan Shading Language (3)
  • 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
Surface Shader Example
  • 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() Kddiffuse(Nf))
  • specularcolor Ks specular(Nf,V,roughness)
    )

uniform varying
21
Light Shader Example
  • light
  • pointlight(
  • float intensity 1
  • color lightcolor 1
  • point from point "camera" (0,0,0) )
  • illuminate( from )
  • Cl intensity lightcolor / L.L

22
Results
23
Results
24
Results
Write a Comment
User Comments (0)
About PowerShow.com