• 검색 결과가 없습니다.

RenderMan for Artist 04 – Shader Examples on the Web

N/A
N/A
Protected

Academic year: 2021

Share "RenderMan for Artist 04 – Shader Examples on the Web"

Copied!
27
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

RenderMan For Artists #04

Wanho Choi

(wanochoi.com)

(2)

RenderMan for Artists wanochoi.com

(Math) Distance between two points

2 1 2 2 1 2 2 _____ ) ( ) (xxyyPQ 2 1 2 2 1 2 _____ ) ( ) (xxyy  PQ

2D

3D

2 1 2 2 1 2 2 1 2 _____ ) ( ) ( ) (xxyyzzPQ

(3)

RenderMan for Artists wanochoi.com

Polygonal Meshes

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin Translate 0 0 10 Rotate 60 1 0 0 Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] WorldEnd .rib x y 0

(4)

RenderMan for Artists wanochoi.com

Polygonal Meshes with Colors

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin Translate 0 0 10 Rotate 60 1 0 0 Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "Cs" [0 1 0 0 0 1 1 1 1 1 0 0] WorldEnd .rib

(5)

RenderMan for Artists wanochoi.com

Polygonal Meshes with Constant Color Shader

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" "surfaceColor" [1 0 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "Cs" [0 1 0 0 0 1 1 1 1 1 0 0] WorldEnd

.rib

surface myShader( color surfaceColor = color(1,1,1); ) {

Oi = Os;

Ci = Oi * surfaceColor; }

(6)

RenderMan for Artists wanochoi.com

RenderMan Help File

(7)

RenderMan for Artists wanochoi.com

mix(A,B,x) = A*(1-x)+B*x where 0≤x≤1

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "s" [0 0 1 1] "t" [1 0 0 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

color surfaceColor = mix( left, right, s ); Oi = Os; Ci = Oi * surfaceColor; } .sl A B x x) * 1 ( * B A   x 1 x  1

(8)

RenderMan for Artists wanochoi.com

step(a,x) = (x<a) ? 0 : 1

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

color surfaceColor = step( 0.5, s ); Oi = Os; Ci = Oi * surfaceColor; } .sl a x 1 0

(9)

RenderMan for Artists wanochoi.com

1 - step(a,x) = (x<a) ? 1 : 0

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

color surfaceColor = 1 - step( 0.5, s ); Oi = Os; Ci = Oi * surfaceColor; } .sl a x 1 0

(10)

RenderMan for Artists wanochoi.com

step(a,x) – step(b,x) = (x<a) ? 0 : ( (x<b) ? 1 : 0 )

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

color surfaceColor = step( 0.2, s ) - step ( 0.8, s ); Oi = Os; Ci = Oi * surfaceColor; } .sl a x 1 0 b

(11)

RenderMan for Artists wanochoi.com

step() + mix()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = step( 0.5, s ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(12)

RenderMan for Artists wanochoi.com

smoothstep(a,b,x)

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = smoothstep( 0.4, 0.6, s ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

.sl

a x

1

(13)

RenderMan for Artists wanochoi.com

1-smoothstep(a,b,x)

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = 1-smoothstep( 0.4, 0.6, s ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

.sl

a x

1

(14)

RenderMan for Artists wanochoi.com

smoothstep(a,b,x); a→b : smoothstep→step

(15)

RenderMan for Artists wanochoi.com

smoothstep(a,b,x) – smoothstep(c,d,x)

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = smoothstep( 0.2, 0.3, s ) - smoothstep( 0.7, 0.8, s ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(16)

RenderMan for Artists wanochoi.com

smoothstep(a,b,x) * ( 1 – smoothstep(c,d,x) )

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = smoothstep( 0.2, 0.3, s ) * ( 1 - smoothstep( 0.7, 0.8, s ) ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(17)

RenderMan for Artists wanochoi.com

2D smoothstep()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [0.878 0.996 0.474] “right" [0.580 0.690 0.988] Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1]

WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = smoothstep( 0.2, 0.3, s ) * ( 1 - smoothstep( 0.7, 0.8, s ) ) * smoothstep( 0.2, 0.3, t ) * ( 1 - smoothstep( 0.7, 0.8, t ) ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(18)

RenderMan for Artists wanochoi.com

abs(x) = (x<0) ? (-x) : (x)

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = abs( s – 0.5 ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(19)

RenderMan for Artists wanochoi.com

abs() + smoothstep()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float distance = abs( s - 0.5 );

float ratio = 1 - smoothstep( 0.005-0.025, 0.005+0.025, distance ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(20)

RenderMan for Artists wanochoi.com

mod() + abs() + smoothstep()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float repeat = 10;

float ss = mod( s*repeat, 1 ); float tt = mod( t*repeat, 1 ); float distanceS = abs( ss - 0.5 ); float distanceT = abs( tt - 0.5 );

float ratioS = 1 - smoothstep( 0.005-0.025, 0.005+0.025, distanceS ); float ratioT = 1 - smoothstep( 0.005-0.025, 0.005+0.025, distanceT ); Oi = Os;

Ci = Oi * ( mix( left, right, ratioS) + mix( left, right, ratioT ) ); }

(21)

RenderMan for Artists wanochoi.com

sqrt() + smoothstep()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float distance = sqrt( (s-0.5)*(s-0.5) + (t-0.5)*(t-0.5) );

float ratio = 1 - smoothstep( 0.3-0.025, 0.3+0.025, distance ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(22)

RenderMan for Artists wanochoi.com

mod() + sqrt() + smoothstep()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float repeat = 10;

float ss = mod( s*repeat, 1 ); float tt = mod( t*repeat, 1 );

float distance = sqrt( (ss-0.5)*(ss-0.5) + (tt-0.5)*(tt-0.5) ); float ratio = 1 - smoothstep( 0.3-0.025, 0.3+0.025, distance ); Oi = Os;

Ci = Oi * mix( left, right, ratio ); }

(23)

RenderMan for Artists wanochoi.com

sin()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float ratio = sin(PI*s); Oi = Os;

Ci = Oi * mix( left, right, ratio); }

(24)

RenderMan for Artists wanochoi.com

sin()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float distance = abs( t - 0.5*(sin(2*PI*s)+1) );

float ratio = 1 - smoothstep( 0.01, 0.02, distance ); Oi = Os;

Ci = Oi * mix( left, right, ratio); }

(25)

RenderMan for Artists wanochoi.com

mod() + step()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float repeat = 10;

float ratio = step( 0.5, mod(s*repeat,1) ); Oi = Os;

Ci = Oi * mix( left, right, ratio); }

(26)

RenderMan for Artists wanochoi.com

mod() + step()

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" 40 WorldBegin

Translate 0 0 10 Rotate 60 1 0 0

Surface "myShader" “left" [1 0 0] “right" [0 1 0]

Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "st" [0 1 0 0 1 0 1 1] WorldEnd

.rib

surface myShader( color left = 1, right = 0; ) {

float repeat = 10;

float ratioS = step( 0.5, mod(s*repeat,1) ); float ratioT = step( 0.5, mod(t*repeat,1) ); Oi = Os;

Ci = Oi * mix( left, right, mod(ratioS+ratioT,2) ); }

(27)

RenderMan for Artists wanochoi.com

References

Cook, Robert L., Loren Carpenter, Edwin Catmull, The Reyes Image Rendering Architecture, SIGGRAPH 87.Saty Raghavachary, Rendering for Beginners: Image synthesis using RenderMan, Focal Press, 2004

Rudy Cortes, Saty Raghavachary, The RenderMan Shading Language Guide, Thomson Course Technology, 2007Ian Stephenson, Essential RenderMan Fast, Springer, 2003

Anthony A. Apodaca, Larry Gritz, Advanced RenderMan: Creating CGI for Motion Pictures, Morgan Kaufmann, 1999Tony Apodaca and Darwyn Peachey, Writing RenderMan Shaders, Siggraph 1992 Course 21

http://renderman.or.krhttp://www.fundza.com

참조

관련 문서

~ depends on the relative importance of the turbulent transport terms For the turbulent jet motion, simulation of turbulence is important. For the horizontal motion in

You need to provide the document currency for writing to the new database table PRCD_ELEMENTS using the new pricing result API.. For more information, see the API

“With the MySQL Query Analyzer, we were able to identify and analyze problematic SQL code, and triple our database performance. More importantly, we were able to accomplish

In this study, through carrying out a whole class, small-group and an individual web-based English blogging project, students' scores on English writing

For the purposes, this study reviewed theses, national and international books, and web sites on Kodaly's Method to present the life of Kodaly, his educational philosophy

Crosslinker Dabco CL420 Non-fugitive novel cross-linker providing significantly improved humid aged physical properties9. Dabco T-12 Industry standard

training department Korean volunteer Office of X for free individual.. ※The language training course is a 10-week course and a paid course. Please apply and inquire

• Defenders need visibility into process and file telemetry, command line parameters, and Windows Event logs. • Subscribe to ETW logs to collect PowerShell cmdlets and