RenderMan Lecture 2 - Vision & Media Research LAB

Download Report

Transcript RenderMan Lecture 2 - Vision & Media Research LAB

RenderMan Lecture 2
A Language for Shading and
Lighting Calculations
Abstract
• Design of a new shading language
– based on “Shade Tree”(Cook and Perlin)
– Light sources and surface reflectance
– Interface to the rendering system
• Shading language ( RenderMan )
– shading and lighting
Introduction
• Shading refers to the combination
– light, shade, texture, color ( object )
• Modular rendering program ( PRMan )
– geometric processing + optical processing
• Describes ( shading language )
– types of materials
– light sources
– based on a simple subset of C
• Goals : ( “Shade Tree” + “pixel stream” )
– Develop : abstract shading model based
on ray optics( independent of anything )
– Define : interface between the rendering
program and the shading modules.
– Provide : high-level language is easy to
use.
• The RenderMan interface, PIXAR 1989
Model of the Shading Process
Kajiya: transportof light through theenvirnment
i ( x, x ' )  v( x, x ' )[l ( x, x ' )   r ( x, x ' , x '' )i ( x ' , x '' )dx'' ]
solutoni ( x, x ' ), is intensit yof light at x which comesfrom x ' .
major type
s of shaders
1. Light Source Shaders
- terml ( x, x ' ) : color and intensit yof light
2.Surface Reflectance Shaders
- termr ( x, x ' , x '' )i ( x ' , x '' )
3. Volume or AtmosphereShaders
- termv( x, x ' ) : scatteringeffects( raysintersecting )
• 쉐이딩 언어에 의한 procedures : called shaders
• Surface shader
– 들어오는 빛의 관한 부분은 상관하지 않음
– 렌더러가 제공하는 정보를 기반으로 응답
•
Light Source shader
– 표면에 관한 부분과 무관
– 빛의 방사 계산
• Kajiya : standard rendering tech
– 빛은 방사, 표면 반사, 눈의 방향으로 조정
• Whitted : ray tracing algorithm
– 빛의 이동은 합해진다.
• 쉐이딩 언어에서 쉐이더는 많은 다른 종류의 렌더링 알고
리즘을 사용할 수 있다.
Language Features
• Modeled
– 다른 언어와 비슷하게 디자인 ( under UNIX )
– high-level design : each feature
• Features
– color and point data types
– meta types ( uniform, varying )
– 시스템에서 제공하는 부분들과 사용자 제어
Features ( Types )
• 많은 고정 데이터 타입 제공
– float, strings, colors, points
– 새로운 타입이나 데이터 구조는 정의 할 수
없다.
Shader
Render
Points
Colors
Types ( Colors )
• Colors : represents a sampled spectra.
– light combination : +, *
Cd * ( La  Ld )  Cs * Ls  Ct * Lt
colorsof a mat erial
Cd : diffuse color,Cs : specular color
light reflectedfromsurface
La : ambient,Ld : diffuse, Ls : specular
mat erial(amountof light )
Ct : transparency,Lt : transmitt
– between 0 and 1.
Types ( Points )
• Represent : three component vector.
– standard vector algebra
C * max(0, L.N )
".": dot product
C : color
L : light vectors
N : normalvectors
– different coordinate systems.
– standard named coordinate system ( accessing )
• “camera”, “eye”, “world”
Variables, Shader Class
• All variables : uniform and varying
– uniform : independent of position ( constant )
– varying : change as a function of position.
• Shader Classes
surface
metal( float Ka  1, Ks  1, roughness .1 )
RiSurface( " metal", " Ka", 0.5 );
light
point light( ...;
pointfrom  point" shader"(0,0,0);
... )
Most general class of
shading procedures.
Definition by keyword :
- surface
- light
- volume
state
u,v
Shading System
Rendering System
- 입력 (U,V)
- 새로운 제질 사용
- 속성을 매개 변수화
- 각 surface parameter (U,V) 제공
- Runtime 환경하에 계산
color
Modules communicate
Two general principles
- 제질 정보의 최소화, 확장 가능
- geometric and optical 정보는 전부 갖춤
Light Sources
• Description
– L : 빛의 방향, Cl : 색과 강도
– “solar”, “illuminate” 광원 제공
• “illuminate” : 유한 광원의 빛의 색
– 빛이 방사되는 정점에서의 원뿔
• “solar” : 무한, 거리 있는 광원의 빛의 색
– 조명되는 점의 중심 위치, 빛과의 거리
• 여러 모델이 있으며, 절차적으로 정의 할
수 있으며, 각 다른 위치에서 계산된다.
Surface Reflectance
• 정의 된 반사 함수와 입사된 빛으로 통합된다.
– controlled : using an “illuminance” state.
– define upper hemisphere centered at the point being shaded.
color C  0;
illuminance ( P, N, Pi/2){
L  normalize(L);
C   Kd * Cd * Cl * length(L^T );
}
털에 관한 이방성 쉐이딩 모델의 diffuse component
Implementation
Compilation
Loading
Instancing
Evaluation
Elaboration
Binding
Life cycle : shader passes 과정
Compile : 실시간 해석기를 위한 코드를 만든다.
Load : 현재 요구되는 쉐이더가 캐쉬에 위치되어 진다. ( key )
Instance : 쉐이더의 매개 변수 리스트를 캐쉬에 삽입한다.( index )
Bind : 쉐이더의 매개 변수 성질 결정하여 캐쉬에 저장한다.
Elaborate : 매개 변수들은 표현에 따른 값으로 바뀌어 진다.
Evaluate : 표면의 각 위치에서 값을 구한다.