'RenderMan'에 해당되는 글 3건

  1. 2013.01.18 RenderMan Functions Definition
  2. 2012.12.13 Renderman Macro Function
  3. 2012.10.14 RSL 관련 튜토

함수를 사용할 때, 함수의 정의 부분을 보는것은 지극히 당연한 일인데.. 여태까지 왜 간과하고 있었지!!

여하튼... 어떤 함수든 간에 그 함수의 정의 부분을 보는것은 당연한 일이다. 

그래야 확실히 어떻게 작동되는지를 판단할 수 있고, 적시적지에 그 함수를 활용할 수 있다고 생각한다.

물론, 함수의 정의를 안보고 몇번의 테스트만으로도 그 함수가 어떤 기능을 하는지를 가늠할 수 있다. 하지만 완벽히 이해를

하지 못하였으니 자기것이 되지는 않는다고 생각한다... 그런데, 엄청난 수학공식이 들어가는 함수라면...일단.. ㅜ.ㅜ


지금부터 하나씩 함수의 정의를 써 내려갈 생각이다.


지금까지 함수의 정의를 찾아볼 생각도 않은채 써 보면서 대략적인 기능을 가늠하였는데...

함수의 정의를 보니까 내부적으로 어떻게해서 작동이 되는지를 확실히 알겠다. 

그리고 RenderMan 랑 Mantra 랑 함수 이름만 살짝씩 다르지 기능적으론 같으니까 이것을 이해하면,

Mantra 도 이해하는 것이다. 


참고로 Mantra ( RenderMan Extra




faceforward

함수의 정의




diffuse

함수의 정의




specular

함수의 정의




'RenderMan > PRM Data' 카테고리의 다른 글

RSL 관련 튜토  (0) 2012.10.14
Posted by scii
:

Renderman Macro Function

RenderMan/RSL 2012. 12. 13. 05:01 |

/* rmannotes.sl
 * 
 * macros to be used in conjunction with shaders described in
 * the RManNotes web pages. 
 *   http://www.cgrg.ohio-state.edu/~smay/RManNotes
 *
 */

#define pulse(a,b,fuzz,x) (smoothstep((a)-(fuzz),(a),(x)) - \
			   smoothstep((b)-(fuzz),(b),(x)))

#define boxstep(a,b,x)    clamp(((x) - (a))/((b) - (a)), 0, 1)

#define repeat(x,freq)    (mod((x) * (freq), 1.0))

#define odd(x)            (mod((x), 2) == 1)
#define even(x)           (mod((x), 2) == 0)

#define whichtile(x,freq) (floor((x) * (freq)))

/* rotate2d()
 *
 * 2D rotation of point (x,y) about origin (ox,oy) by an angle rad.
 * The resulting point is (rx, ry).
 *
 */
#define rotate2d(x,y,rad,ox,oy,rx,ry) \
  rx = ((x) - (ox)) * cos(rad) - ((y) - (oy)) * sin(rad) + (ox); \
  ry = ((x) - (ox)) * sin(rad) + ((y) - (oy)) * cos(rad) + (oy)

/* topolar2d()
 * 
 * 2D cartesian -> polar coordinates
 * converts the point (x,y) to radius 'r' and angle 'theta' (in radians).
 * theta will be in the range [-PI,PI].
 *
 */
#define topolar2d(x, y, r, theta) \
  r = sqrt((x) * (x) + (y) * (y)); \
  theta = atan(y, x) 

/* boolean ops (from Perlin85)
 *
 */
#define intersection(a,b) ((a) * (b))
#define union(a,b)        ((a) + (b) - (a) * (b))
#define difference(a,b)   ((a) - (a) * (b))
#define complement(a)     (1 - (a))


/* blend() and lerp() are equivalent. blend() is used as a substitute for
 * mix because it allows non-scalar 3rd arguments.
 *
 */
#define blend(a,b,x) ((a) * (1 - (x)) + (b) * (x))
#define lerp(a,b,x)  ((a) * (1 - (x)) + (b) * (x))

/* signed noise
 *
 */
#define snoise(x)    (noise(x) * 2 - 1)
#define snoise2(x,y) (noise(x,y) * 2 - 1)

/* uniformly distributed noise
 *
 */
#define udn(x,lo,hi) (smoothstep(.25, .75, noise(x)) * ((hi) - (lo)) + (lo))
#define udn2(x,y,lo,hi) (smoothstep(.25, .75, noise(x,y)) * ((hi)-(lo))+(lo))

/* sample rate metrics (from Apodaca92)
 *
 */
#define MINFILTERWIDTH  1e-7
#define MINDERIV        0.0003    /* sqrt(MINFILTERWIDTH) */

#define filterwidth(x) (max(abs(Du(x) * (du)) + (Dv(x) * (dv)),MINFILTERWIDTH))
#define filterwidth_point(p) (max(sqrt(area(p)), MINFILTERWIDTH))

Posted by scii
:

RSL 관련 튜토

RenderMan/PRM Data 2012. 10. 14. 03:41 |

http://cafe.naver.com/houdinistudio/5376

'RenderMan > PRM Data' 카테고리의 다른 글

RenderMan Functions Definition  (0) 2013.01.18
Posted by scii
: