SlideServe
Menu
Préférences
© SlideServe · v2026

RenderMan - Shading Language: Concepts -

junius avatar
18 diapositives · 529 Views · Sep 07, 2014

RenderMan - Shading Language: Concepts - . Conventional Shading System. Fixed parameter shading system Disadvantages Built-in shading model is NOT enough New shading model Realistic shading model NPR Can be inefficient Flexible, extensible system is needed. New Shading System.

RenderMan		 - Shading Language: Concepts - - slide 1
01 / 18RenderMan - Shading Language: Concepts -
1 / 17

Télécharger la présentation

RenderMan - Shading Language: Concepts -
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. RenderMan - Shading Language: Concepts -

  2. Conventional Shading System • Fixed parameter shading system • Disadvantages • Built-in shading model is NOT enough • New shading model • Realistic shading model • NPR • Can be inefficient • Flexible, extensible system is needed

  3. New Shading System • Turner Whitted & David M. Weimer • 1980, Shading dispatch table • Robert Cook • 1984, Shade Trees • Ken Perlin • 1985, Pixel Stream • Pat Hanrahan & Jim Lawson • 1990, Shading Language

  4. Parameterized shading model • Phong illumination model • Does not change the fundamental form of the shading equation • Narrow range of appearances

  5. Quick tour of a Shader surface plastic(float Ka = 1, Kd = 1, Ks = 0.5, roughness = 0.1; color specularcolor = 1;) { /* simple plastic-like reflection model */ normal Nf = faceforward(normalize(N), I); vector V = -normalize(I); Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + Ks*specularcolor*specular(Nf, V, roughness); Oi = Os; Ci *= Oi; }

  6. Types of shaders • Surface shaders • Appearance of surface • How they react to the lights • Displacement shaders • How wrinkle or bump • Light shaders • Directions, amounts, and colors of illumination • Volume shaders • How light is affected as it passes through a participating medium • Imager shaders • Describe color transformation make to final pixel values before the are output

  7. Shading Language data type • Built-in types • Floats • Colors • Points, Vectors, Normals • Matrices • Strings • SL has no double or int types • SL does not support user-defined structures or pointer of any kind

  8. Shading Language Variables • Global variables • graphics state variables • [class] type variablename [=initializer] • Static 1D arrays are allowed • e.g.) • float a; • uniform float b; • float c = 1; • float d = b*a; • float e[10];

  9. P Surface position N Shading normal Ng Geometric normal I Incident vector E Vantage(eye) point Cs Surface color Os Surface Opacity s,t Texture coordinates L,Cl Light vector and color u,v Parametric coordinates du,dv Change in coordinates dPdu,dPdv Surface tangents Surface Graphics State Variables

  10. Geometry at the Surface

  11. Surface shader, Light shader

  12. Shader Parameters surface pitted (float Ka = 1, Kd = 1, Ks = 0.5; float angle = radiances(30); color spotcolor = 0; color strpicolor = color (.5, .5, .75); string texturename = ""; string dispmapname = "mydisp.tx"; vector up = vector "shader" (0, 0, 1); varying point Pref = point (0, 0, 0); ) { ... } Decalre "Kd" "float" Declare "stripecolor" "color" Surface "pitted" "Kd" [0.8] "stripecolor" [.2 .3 .8] Sphere 1 -1 1 360

  13. expressions • Unary – • Binary + * - / ^ . • ^ and . • Operators only work for vectors and normals • ^ (vector cross product) • . (vector dot product) • * and / for matrix type • * (matrix multiplication) • / (matrix multiplication by the inverse) • Type casts • Ternary operator ? : • Function calls

  14. Built-in functions • Angles & Trigonometry • Exponentials, etc. • Miscellaneous simple scalar functions • Color operations • Geometric functions • Strings • Matrix functions

  15. Built-in functions • 수학함수 • PI, radians, degree, sin, asin, cos, acos, tan, atan, pow, exp, sqrt, inversesqrt, log, mod, abs, sign, min, max, clamp, mix, floor, ceil, round, step, smoothstep, filterstep, spline, Du, Dv, Deriv, random, noise, pnoise, cellnoise, • 기하함수 • xcomp, ycomp, zcomp, setxcomp, setycomp, setzcomp, length, normalize, distance, ptlined, rotate, area, faceforward, reflect, refract, fresnel, transform, vtransform, ntransform, depth, calculatenormal • 색함수 • comp, setcomp, mix, ctransform • 행렬함수 • comp, setcomp, determinant

  16. Built-in functions • 문자열함수 • concat, printf, format, match, • 쉐이딩과 라이팅 함수 • ambient, diffuse, specular, specularbrdf, phong, trace, • 텍스쳐 매핑함수 • texture, environment, shadow, textureinfo • 메시지 전달 및 정보함수 • atmosphere, displacement, lightsource, surface, incident, opposite, attribute, option, rendererinfo, shadername • 추가된 함수 • gather, occlusion, indirectdiffuse, photonmap, iradiancecache, caustic, transmission, gridpattern, ambience, trace

  17. Writing SL functions • Only one return statement is allowed per function • Call by reference mechanism • You may not compile functions separately from the body of your shader returntype functionname(params) { do some computations; ... return return_value; } float myfunc ( float f; output float g; )

  18. 1.Polygons A.Polygon B.GeneralPolygon C.PointsPolygons D.PointsGeneralPolygons 2.Patches A.Basis B.Patch C.PatchMesh D.NuPatch E.TrimCurve 3.Subdivision Surfaces A.SubdivisionMesh 4.Quadrics A.Sphere B.Cone C.Cylinder D.Hyperboloid E.Paraboloid F.Disk G. Torus Homework