SlideShare a Scribd company logo
Texturering & Modeling
               a Procedual Approach



              김정근
Chapter 4

CELLULAR TEXTURING
Agenda


 The New Bases

 Implementation Strategy

    –   Dicing Space

    –   Neighbor Testing

    –   The Subtle Population Table

    –   Extensions and Alternatives


 Sample Code




                                               3
Cellular Texturing




              The function that
                 launched a
             thousand textures.




                                  4
Cellular Texturing



Perlin’s Noise 를 보완할 수 있는 새로운 Function 제안


Steve Worley
CEO, founder
Worley Laboratories
1995 – Present (17 years) Menlo Park, California
Research and development of graphics tools

Developed and released 6 different software products:

Gaffer: lighting snad shading methods

Polk, Taft: collections of artist utilities

Sasquatch: procedural hair and fur modeler and renderer

G2: interactive lighting and shading system

FPrime: the industry's first real-time render-accurate preview renderer, using interactive raytracing.




                                                                                                         5
Cellular Texturing



Perlin’s Noise 를 보완할 수 있는 새로운 Function 제안


        Cell을 random하게 배열하여 공간을 나누는 것에 기초



      포장도로의 표면, 타일로 붙여진 표면, 생물의 딱딱한 피부나 껍
           질, 구겨진 종이, 얼음, 바위, 분화구 등을 표현



        미리 계산하거나 table storage 없이 효율적인 계산 가능




                                               6
Cellular Texturing



 R3 공간에서 정의되고, scalar value 로 return
   –   Point (x, y, z) 를 Input value 로 받아서 scalar value 을 얻음.

   –   이 scalar value 는 직접적으로 색의 값으로 표현되거나 regular pattern을 흐트러뜨리는 역할
       을 함.




  < Perlin‟s Noise Function(3D Basis) :
    (a) Wrinkles, (b) Color >


                                                                        7
Cellular Texturing


 Many Texture Algorithms 와 비교
    –   Fourier methods

    –   Reaction diffusion textures, An algorithm by Miyata

    -> Extensive Precomputation 이 요구되고, scalar value 로 return 이 되지 않아 매우 복잡하고 규
        모가 커서 일반적이지 못함.
                                            (a)               (b)


  < Many Texture Algorithms :
    (a) Reaction diffusion - horse ,
    (b) An algorithm by Miyata – Edo Castle >


    –   Many texture algorithms은 제한된 form 때문에 응용이 어려운 반면, Perlin‟s noise function은
        매우 단순하여 얼마든지 다양하고 쉽게 응용 가능.

     -> new texture function을 만들고, Basis Function으로 사용 가능.



                                                                                     8
The New Bases


 2가지 기초 개념

    –   “feature points” 를 R3영역에 흩어 뿌리는 것.

    –   “local points”의 분포도에 따른 scalar function을 만드는 것.

         • local points 의 분포를 사용하는 또 다른 예 ( Bombing, Lewis Methods…)



 The Perlin‟s noise basis function과 같이 precomputation 이나 table storage

   없이도 효과적인 noise의 표현과 계산이 가능


 기존의 noise function 보다 매우 다양하고 독특한 효과를 기대할 수 있음


                                                                          9
The New Bases


  Definition
       –    Randomly Distributed Feature Points in R3

       –    F1 (x) : Distance to Closest Feature Point from any Point x in R3
           (예를 들면 F1 (x) 를 이용해 R3공간에 일반적인 Voronoi region을 형성)

       –    F2(x): Distance to Second Closest Feature Point

       –    Fn(x): Distance to n th Closest Feature Point


                             (a)                    (b)                         (c)




< F1(x) Function :
 (a) 2D Plane On surface,
 (b) 2D Plane Off surface,
 (c) 3D plane >

                                                                                      10
The New Bases


 Fn(x) Properties
    –     Fn(x) 는 항상 continuous 함.

    –     Fn(x) 는 n에 비례하여 항상 증가.( 감소하지 않음)

     ->    0 F ( x) F ( x) F ( x)Ingeneral :
                 1      2  , (    3            F ( x)) F
                                                n      n 1
                                                             ( x)

    –     The gradient of Fn(x)

          : x 에 n번째로 가까운 feature point 를 가르키는 간단하게 unit direction vector




                                                                           11
The New Bases

                        Voronoi diagram


두 점 p와 q 사이의 유클리안 거리를 dist(p, q),,                                한 평면상에
          n개의 분리된 점들의 집합 P를 P={p1, p2, p3, ..., pn} 라고 할때

P의 Voronoi Diagram은 그 평면을 P에 있는 각각의 점에 대해서 n개의 cell로 나누는 것 만
           일, dist(pi, q) < dist(pj, q) 를 만족하면 q는 p1 cell에 포함되며

        평면상의 점들은 P에 있는 점들 중 가장 가까운 점이 속한 cell에 포함




                                                                           12
The New Bases




http://www.snibbe.com/projects/interactive/boundaryfunctions
                                                               13
The New Bases




                14
The New Bases




                15
Implementation Strategy



이것을 사용 하기 위해
Cellular 텍스처 기반 기능을
구현하는 방법을 이해할 필요는 없다




                         기초의 주요 알고리즘의 수정 및 각색은
                                    원래 노이즈 버전에서
                                    0
                            새로운 효과를 생성할수 있게 한다
Implementation Strategy




 Feature Points가 공간을 통해 확산되는 방법을 정의




밀도 및 포인트의 분포는 basis function 의 성격을 변화




      첫번째 가정은 월드의 축에 부합하는

    기본 패턴을 피하는 등방성 function이 필요



                                        17
Dicing Space




                      큐브 안에
한정된 영역을
                    공간을 자르고
 생성하고
                    각 큐브 안의
 테스트             Feature Point 를 계산




                                      18
Dicing Space




                               Sample Location


Feature Point




                                                 19
Dicing Space




Feature Points가 스스로 생성하는 위치의      Seed         도 필요



                      Solution


Fast Random Number Generator에 대한 Seed로 사용하는 단일 32 비트 정수
           안에서 큐브의 월드 정수 좌표를 섞는 것(hash)




                                                          20
Dicing Space




short lookup table of 256 possibilities


    Seed                 큐브에 있는 점 개수를 계산




  Possible point populations의 고정배열은 Magic Property

    “Points Isotropic 을 유지”해주고 Precomputed 됨



                                                     21
Neighbor Testing




                   22
Neighbor Testing




                   23
The Subtle Population Table



포와송 분포는 주어진 평균 밀도에서, 해당 범위내에서, 특정 point
             개수를 찾을 확률(가능성)을 제공


 불연속 포와송 분포 함수를 사용하면 영역내에 point 가 얼마나
            있을지에 대한 정확한 확률을 계산


만약 포와송 확률을 바탕으로 한 모집단을 가지고, 각각의 cube 내에 있는 point
들을 랜덤하게 생성한다면, feature point 들은 모두 등방성 일 것이고, texture
           function 은 grid bias를 전혀 가지지 않을 것




     이상적인 데이터를 얻기 위해 Poisson distribution 을 사용




                                                        24
The Subtle Population Table




    “unit volume 한개당 feature point 평균 밀도를 λ라고 하고,
unit cube 하나에 m 개의 feature point 가 존재할 확률은 다음과 같다.”



     (P(λ,m) : unit cube 하나에 m 개의 feature point 가 존재할 확률, 즉 Poisson 확률)




        P(λ,m) = λ^(m)/{ e^(λ)* m!)}


                                                                          25
The Subtle Population Table



 “X는 어느 대학의 월요일 오전 9시 수업에 결석하는 학생수를 나타낸다고 가정,
보통 기대값은 2.5명으로 알려져 있다 만약 5명을 초과한 수의 학생이 결석할 확률은?”




                                                    26
The Subtle Population Table


 특징
  –   λ 값이 크다는 건 Cube 내에 Feature Point 가 많다는 의미 Point를 생성하고 테스트하는데 시
      간이 걸림

  –   λ 값이 낮다는건 더 많은 Neighbor Cube를 조사하는데 시간이 걸림

  –   λ 값을 선택하는 가장 확실한 방법은 다른 값을 넣어보고 빠른 속도를 가지는지 찾아서 그값
      을 λ 값으로 선택하는 것

  –   최상의 밸런스는 Input Constant로 나누어 간단하게 Scaling 함으로서 Scale 값을 변경시켜
      보면서 밸런스를 찾음 텍스쳐 제작자의 편의를 위해 Normalize 하는 것이 좋음




                                                                     27
Extensions and Alternatives




           확장성이 크고 커스터마이즈가 용이함
Ken Musgrave 가 소개한 다양한 방법의 프랙탈 조차도 기본형태에서 Noise의 기
                            본 Function을 사용




      distance 의 정의 자체를 변경할수 있다는것.
 (간단하게 Euclidean distance d2=dx*dx+dy*dy+dz*dz; )                    Biased
“stretched” A*dx*dx+B*dy*dy+C*dz*dz                       Manhattan distance
       fabs(dx)+fabs(dy)+fabs(dz)                     Radial Manhattan:
      A*fabs(dR)+B*fabs(dTheta)+C*dz                     Superquadratic:
             pow(fabs(dx), A) + pow(fabs(dy), B) + pow(fabs(dz),C)




                                                                               28
Extensions and Alternatives


       (a) F1(x)

         -   매우 simple
         -   직접 color spline and bump 로 map 가능
         -   feature points 주위로 분포 -> 기본적인 voronoi 영역
         -   example : Polka Dots (물방울 무늬)




                            (b) F2(x)(좌) & F2(x)(우)

                              - 빠른 변화와 내부구조를 형성
                              - 직접 color spline and bump 로 map 가능하지만
                                linear combination 을 형성함으로써 더 흥미로운
                                패턴 생성.




                                                                       29
Extensions and Alternatives

         (c) F2(x) – F1(x) ; 2D


           -   모든 x에 있어서 F2(x) > F1(x)
           -   직접 color spline and bump 로 map 가능
           -   F2(x) = F1(x) 에서 0 값을 가지고 voronoi boundaries 에서 나타남
           -   to make latticework of connected ridges, forming a vein-like tracery




                     (d) Constant Base Color plus Fractal Noise over F1 Regions,
                         F2(x) – F1(x) Bump Mapping ; 3D Flagstone texture

                       - F1 function이 가장 가까운 feature point 의 identity 를 나타내는
                         고유의 ID number를 return 시키면, 이 number는 voronoi cell 에
                         걸쳐 일정한 values를 만들게 됨. -> 즉 하나의 cell 을 일정한 색으로
                         shade 가 가능.
                       - F2(x) - F1(x) 에 기초한 Bump Mapping 적용
                       - 각 cell 에서 fractal noise 로 얼룩 표현




                                                                                      30
Extensions and Alternatives

                        (e) Linear Combination of Fn
                           : C1F1 + C2F2 + C3F3 + C4F4
                           (Flagstone-like area)

                         - low n basis function 의 combinations
                         - Cn의 변화를 주어 생성.




                                                                 31
Extensions and Alternatives

                        (f) Fractal Version

                         - noise 로 fractal noise 를 만드는 것과
                           같음.
                         - different weight & Scaling factors 를
                           이용하여 다양한 표현
                         - computing a function
                          : range of i (i=0~5)


                         - 위의 Gn 을 color and bumps에 대한
                           index로 사용

                        * upper
                        - spotted pattern, F1의 fractal version
                        - tongue : fractal noise 사용
                        - body : linear gradient 가 color variation
                          을 위해 적용

                        * lower
                         - More Fractal versions ; Cut Tori




                                                                  32
Extensions and Alternatives


                (g) F1 Fractal Crumple : Seawater (upper)

                 - 가장 유용한 version
                 - Bump Map 으로만 응용 시, 종이나 tinfoil(쵸코렛이나
                  담배 등을 싸는 은종이) 처럼 surface 를 ‘crumple’ 시킴.
                 - 부드러운 surface 를 break up 하는 방법으로 예술가들
                   에게 굉장히 인기.
                 - fractal noise bumps 와는 달리 subtle roughening을 제
                  공.
                 - 이 crumple appearance를 가진 reflective, bumped
                  map plane은 바닷물과 매우 흡사하게 나타남.




                (f) More Distance Metrics

                 - Manhattan Metric (lower)
                 - A radial coordinate version : ‘Death Star’




                                                                    33
Extensions and Alternatives




                  (g) Spatially Varying Density

                   - Object Geometry
                   - 보통 algorithm 은 3D에서 compute 되지만, 2D
                     variants는 속도를 빠르게 함.
                   - 4D variants 는 animated 분야에 사용될 수 있지만
                    속도가 매우 떨어짐.




                                                            34
Sample Code



static int Poisson_count[256]=
{4,3,1,1,1,2,4,2,2,2,5,1,0,2,1,2,2,0,4,3,2,1,2,1,3,2,2,4,2,2,5,1,2,3,2,2,2,2,2,3,
 2,4,2,5,3,2,2,2,5,3,3,5,2,1,3,3,4,4,2,3,0,4,2,2,2,1,3,2,2,2,3,3,3,1,2,0,2,1,1,2,
 2,2,2,5,3,2,3,2,3,2,2,1,0,2,1,1,2,1,2,2,1,3,4,2,2,2,5,4,2,4,2,2,5,4,3,2,2,5,4,3,
 3,3,5,2,2,2,2,2,3,1,1,4,2,1,3,3,4,3,2,4,3,3,3,4,5,1,4,2,4,3,1,2,3,5,3,2,1,3,1,3,
 3,3,2,3,1,5,5,4,2,2,4,1,3,4,1,5,3,3,5,3,4,3,2,2,1,1,1,1,1,2,4,5,4,5,4,2,1,5,1,1,
 2,3,3,3,2,5,2,3,3,2,0,2,1,1,4,2,1,3,2,1,2,2,3,2,5,5,3,4,5,5,2,4,4,5,3,2,2,2,1,4,
 2,3,3,4,2,5,4,2,4,2,2,2,4,5,3,2};

#define DENSITY_ADJUSTMENT 0.398150

static void AddSamples(long xi, long yi, long zi, long max_order,
double at[3], double *F,
double (*delta)[3], unsigned long *ID);




                                                                                    35
Sample Code

/* The main function! */
void Worley(double at[3], long max_order,
    double *F, double (*delta)[3], unsigned long *ID)
{
  double x2,y2,z2, mx2, my2, mz2;
  double new_at[3];
  long int_at[3], i;

 /* Initialize the F values to "huge" so they will be replaced by the
    first real sample tests. Note we'll be storing and comparing the
    SQUARED distance from the feature points to avoid lots of slow
    sqrt() calls. We'll use sqrt() only on the final answer. */
 for (i=0; i<max_order; i++) F[i]=999999.9;

 /* Make our own local copy, multiplying to make mean(F[0])==1.0 */
 new_at[0]=DENSITY_ADJUSTMENT*at[0];
 new_at[1]=DENSITY_ADJUSTMENT*at[1];
 new_at[2]=DENSITY_ADJUSTMENT*at[2];

 /* Find the integer cube holding the hit point */
 int_at[0]=(long)floor(new_at[0]); /* A macro could make this slightly faster */
 int_at[1]=(long)floor(new_at[1]);
 int_at[2]=(long)floor(new_at[2]);

 /* A simple way to compute the closest neighbors would be to test all
    boundary cubes exhaustively. This is simple with code like:
    {
      long ii, jj, kk;
      for (ii=-1; ii<=1; ii++) for (jj=-1; jj<=1; jj++) for (kk=-1; kk<=1; kk++)
      AddSamples(int_at[0]+ii,int_at[1]+jj,int_at[2]+kk,
      max_order, new_at, F, delta, ID);
    }
    But this wastes a lot of time working on cubes which are known to be
    too far away to matter! So we can use a more complex testing method
    that avoids this needless testing of distant cubes. This doubles the
    speed of the algorithm. */
                                                                                   36
Sample Code

/* Test the central cube for closest point(s). */
  AddSamples(int_at[0], int_at[1], int_at[2], max_order, new_at, F, delta, ID);

 /* We test if neighbor cubes are even POSSIBLE contributors by examining the
    combinations of the sum of the squared distances from the cube's lower
    or upper corners.*/
 x2=new_at[0]-int_at[0];
 y2=new_at[1]-int_at[1];
 z2=new_at[2]-int_at[2];
 mx2=(1.0-x2)*(1.0-x2);
 my2=(1.0-y2)*(1.0-y2);
 mz2=(1.0-z2)*(1.0-z2);
 x2*=x2;
 y2*=y2;
 z2*=z2;

 /* Test 6 facing neighbors of center cube. These are closest and most
    likely to have a close feature point. */
 if (x2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1] , int_at[2] ,
    max_order, new_at, F, delta, ID);
 if (y2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]-1, int_at[2] ,
    max_order, new_at, F, delta, ID);
 if (z2<F[max_order-1]) AddSamples(int_at[0] , int_at[1] , int_at[2]-1,
    max_order, new_at, F, delta, ID);

 if (mx2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1] , int_at[2] ,
    max_order, new_at, F, delta, ID);
 if (my2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]+1, int_at[2] ,
    max_order, new_at, F, delta, ID);
 if (mz2<F[max_order-1]) AddSamples(int_at[0] , int_at[1] , int_at[2]+1,
    max_order, new_at, F, delta, ID);




                                                                                  37
Sample Code



/* Test 12 "edge cube" neighbors if necessary. They're next closest. */
  if ( x2+ y2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]-1, int_at[2] ,
 max_order, new_at, F, delta, ID);
  if ( x2+ z2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1] , int_at[2]-1,
 max_order, new_at, F, delta, ID);
  if ( y2+ z2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]-1, int_at[2]-1,
 max_order, new_at, F, delta, ID);
  if (mx2+my2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]+1, int_at[2] ,
 max_order, new_at, F, delta, ID);
  if (mx2+mz2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1] , int_at[2]+1,
 max_order, new_at, F, delta, ID);
  if (my2+mz2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]+1, int_at[2]+1,
 max_order, new_at, F, delta, ID);
  if ( x2+my2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]+1, int_at[2] ,
 max_order, new_at, F, delta, ID);
  if ( x2+mz2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1] , int_at[2]+1,
 max_order, new_at, F, delta, ID);
  if ( y2+mz2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]-1, int_at[2]+1,
 max_order, new_at, F, delta, ID);
  if (mx2+ y2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]-1, int_at[2] ,
 max_order, new_at, F, delta, ID);
  if (mx2+ z2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1] , int_at[2]-1,
 max_order, new_at, F, delta, ID);
  if (my2+ z2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]+1, int_at[2]-1,
 max_order, new_at, F, delta, ID);




                                                                                 38
Sample Code


/* Final 8 "corner" cubes */
 if ( x2+ y2+ z2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]-1, int_at[2]-1,
    max_order, new_at, F, delta, ID);
 if ( x2+ y2+mz2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]-1, int_at[2]+1,
    max_order, new_at, F, delta, ID);
 if ( x2+my2+ z2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]+1, int_at[2]-1,
    max_order, new_at, F, delta, ID);
 if ( x2+my2+mz2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]+1, int_at[2]+1,
    max_order, new_at, F, delta, ID);
 if (mx2+ y2+ z2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]-1, int_at[2]-1,
    max_order, new_at, F, delta, ID);
 if (mx2+ y2+mz2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]-1, int_at[2]+1,
    max_order, new_at, F, delta, ID);
 if (mx2+my2+ z2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]+1, int_at[2]-1,
    max_order, new_at, F, delta, ID);
 if (mx2+my2+mz2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]+1, int_at[2]+1,
    max_order, new_at, F, delta, ID);

    /* We're done! Convert everything to right size scale */
    for (i=0; i<max_order; i++)
      {
        F[i]=sqrt(F[i])*(1.0/DENSITY_ADJUSTMENT);
        delta[i][0]*=(1.0/DENSITY_ADJUSTMENT);
        delta[i][1]*=(1.0/DENSITY_ADJUSTMENT);
        delta[i][2]*=(1.0/DENSITY_ADJUSTMENT);
      }

    return;
}




                                                                                     39
Sample Code

static void AddSamples(long xi, long yi, long zi, long max_order,
     double at[3], double *F,
     double (*delta)[3], unsigned long *ID)
{
  double dx, dy, dz, fx, fy, fz, d2;
  long count, i, j, index;
  unsigned long seed, this_id;

 /* Each cube has a random number seed based on the cube's ID number.
    The seed might be better if it were a nonlinear hash like Perlin uses
    for noise but we do very well with this faster simple one.
    Our LCG uses Knuth-approved constants for maximal periods. */
 seed=702395077*xi + 915488749*yi + 2120969693*zi;

 /* How many feature points are in this cube? */
 count=Poisson_count[seed>>24]; /* 256 element lookup table. Use MSB */

 seed=1402024253*seed+586950981; /* churn the seed with good Knuth LCG */

 for (j=0; j<count; j++) /* test and insert each point into our solution */
  {
    this_id=seed;
    seed=1402024253*seed+586950981; /* churn */

   /* compute the 0..1 feature point location's XYZ */
   fx=(seed+0.5)*(1.0/4294967296.0);
   seed=1402024253*seed+586950981; /* churn */
   fy=(seed+0.5)*(1.0/4294967296.0);
   seed=1402024253*seed+586950981; /* churn */
   fz=(seed+0.5)*(1.0/4294967296.0);
   seed=1402024253*seed+586950981; /* churn */

   /* delta from feature point to sample location */
   dx=xi+fx-at[0];
   dy=yi+fy-at[1];
   dz=zi+fz-at[2];
                                                                              40
Sample Code



/* Distance computation! Lots of interesting variations are
possible here!
Biased "stretched" A*dx*dx+B*dy*dy+C*dz*dz
Manhattan distance fabs(dx)+fabs(dy)+fabs(dz)
Radial Manhattan: A*fabs(dR)+B*fabs(dTheta)+C*dz
Superquadratic:    pow(fabs(dx), A) + pow(fabs(dy), B) + pow(fabs(dz),C)

Go ahead and make your own! Remember that you must insure that
new distance function causes large deltas in 3D space to map into
large deltas in your distance function, so our 3D search can find
them! [Alternatively, change the search algorithm for your special
cases.]
   */

      d2=dx*dx+dy*dy+dz*dz; /* Euclidian distance, squared */

      if (d2<F[max_order-1]) /* Is this point close enough to rememember? */
{
    /* Insert the information into the output arrays if it's close enough.
       We use an insertion sort. No need for a binary search to find
       the appropriate index.. usually we're dealing with order 2,3,4 so
       we can just go through the list. If you were computing order 50
       (wow!!) you could get a speedup with a binary search in the sorted
       F[] list. */




                                                                               41
Sample Code



index=max_order;
 while (index>0 && d2<F[index-1]) index--;

    /* We insert this new point into slot # <index> */

    /* Bump down more distant information to make room for this new point. */
    for (i=max_order-1; i-->index;)
      {
        F[i+1]=F[i];
        ID[i+1]=ID[i];
        delta[i+1][0]=delta[i][0];
        delta[i+1][1]=delta[i][1];
        delta[i+1][2]=delta[i][2];
      }
    /* Insert the new point's information into the list. */
    F[index]=d2;
    ID[index]=this_id;
    delta[index][0]=dx;
    delta[index][1]=dy;
    delta[index][2]=dz;
}
     }

    return;
}




                                                                                42
Conclusion


 실질적인 texture design 에서 매우 유용함.



 Perlin‟s fractal noise 를 보완하며, noise 가 사용되는 어떤 algorithm 에도 „A
  Cellular Texture Basis Function‟ 을 적용가능.



 시각적인 효과가 늘 똑같지 않고, image 를 더 다양하게 한다는 점에서 가치
  가 있음.




                                                               43
Reference

•   Worley, Steven (1996). A cellular texture basis function. Proceedings of the 23rd annual conference on Computer graphics and interactive techniques

•   http://www.gutgames.com/post/Cellular-Textures.aspx

•   http://www.blackpawn.com/texts/cellular/default.html

•   http://codevania.springnote.com/pages/3175790.xhtml

•   http://demonstrations.wolfram.com/FractalCellularTextures/

•   http://fgiesen.wordpress.com/2010/03/28/how-to-generate-cellular-textures/

•   http://hq.scene.ro/blog/read/cellular-texture/

•   http://my.opera.com/community/forums/topic.dml?id=1300002

•   http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/cellular-textures-the-light-speed-approach-r2668

•   http://www.drx.dk/cel.phphttp://cell-auto.com/optimisation/

•   http://petewarden.com/notes/archives/2005/05/testing.htm

•   http://www.cs.unc.edu/~blloyd/comp238/shader.html

•   http://mathworld.wolfram.com/VoronoiDiagram.html

•   http://www.snibbe.com/projects/interactive/boundaryfunctions

•   http://www.snibbe.com/index.php/projects/interactive/bubbleharp/

•   http://gogocj2012.blog.me/50137595052




                                                                                                                                                          44
Q&A
감사합니다

More Related Content

What's hot

알기쉬운 Variational autoencoder
알기쉬운 Variational autoencoder알기쉬운 Variational autoencoder
알기쉬운 Variational autoencoder
홍배 김
 
3D 컴퓨터 그래픽스 기초
3D 컴퓨터 그래픽스 기초3D 컴퓨터 그래픽스 기초
3D 컴퓨터 그래픽스 기초
Seung Joon Choi
 
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field종빈 오
 
논문-정규분포변환
논문-정규분포변환논문-정규분포변환
논문-정규분포변환
jdo
 
Improved techniques for grid mapping with rao blackwellized particle filters 번역
Improved techniques for grid mapping with rao blackwellized particle filters 번역Improved techniques for grid mapping with rao blackwellized particle filters 번역
Improved techniques for grid mapping with rao blackwellized particle filters 번역
jdo
 
Bump Mapping
Bump MappingBump Mapping
Bump Mapping
Sukwoo Lee
 
Deep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNetDeep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNet
Hyojun Kim
 
머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical Model머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical ModelJungkyu Lee
 
Visualizing data using t-SNE
Visualizing data using t-SNEVisualizing data using t-SNE
Visualizing data using t-SNE
홍배 김
 
Anomaly Detection with GANs
Anomaly Detection with GANsAnomaly Detection with GANs
Anomaly Detection with GANs
홍배 김
 
Data Visualization and t-SNE
Data Visualization and t-SNEData Visualization and t-SNE
Data Visualization and t-SNE
Hyeongmin Lee
 
언차티드4 테크아트 파트2 mipFog
언차티드4 테크아트 파트2 mipFog언차티드4 테크아트 파트2 mipFog
언차티드4 테크아트 파트2 mipFog
Dae Hyek KIM
 
[0529 박민근] 전역조명(global illumination)
[0529 박민근] 전역조명(global illumination)[0529 박민근] 전역조명(global illumination)
[0529 박민근] 전역조명(global illumination)MinGeun Park
 
Post processing in_color
Post processing in_colorPost processing in_color
Post processing in_color
민웅 이
 
2018.02.03 이미지 텍스처링
2018.02.03 이미지 텍스처링2018.02.03 이미지 텍스처링
2018.02.03 이미지 텍스처링
Sukwoo Lee
 
XAI recent researches
XAI recent researchesXAI recent researches
XAI recent researches
seungwoo kim
 
Real-Time Global Illumination Techniques
Real-Time Global Illumination TechniquesReal-Time Global Illumination Techniques
Real-Time Global Illumination TechniquesJangho Lee
 
노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)
QooJuice
 
언차티드4 테크아트 파트3 MicroShadowBRDF Term
언차티드4 테크아트 파트3 MicroShadowBRDF Term언차티드4 테크아트 파트3 MicroShadowBRDF Term
언차티드4 테크아트 파트3 MicroShadowBRDF Term
Dae Hyek KIM
 

What's hot (20)

알기쉬운 Variational autoencoder
알기쉬운 Variational autoencoder알기쉬운 Variational autoencoder
알기쉬운 Variational autoencoder
 
3D 컴퓨터 그래픽스 기초
3D 컴퓨터 그래픽스 기초3D 컴퓨터 그래픽스 기초
3D 컴퓨터 그래픽스 기초
 
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
 
논문-정규분포변환
논문-정규분포변환논문-정규분포변환
논문-정규분포변환
 
Improved techniques for grid mapping with rao blackwellized particle filters 번역
Improved techniques for grid mapping with rao blackwellized particle filters 번역Improved techniques for grid mapping with rao blackwellized particle filters 번역
Improved techniques for grid mapping with rao blackwellized particle filters 번역
 
Bump Mapping
Bump MappingBump Mapping
Bump Mapping
 
20120824
2012082420120824
20120824
 
Deep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNetDeep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNet
 
머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical Model머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical Model
 
Visualizing data using t-SNE
Visualizing data using t-SNEVisualizing data using t-SNE
Visualizing data using t-SNE
 
Anomaly Detection with GANs
Anomaly Detection with GANsAnomaly Detection with GANs
Anomaly Detection with GANs
 
Data Visualization and t-SNE
Data Visualization and t-SNEData Visualization and t-SNE
Data Visualization and t-SNE
 
언차티드4 테크아트 파트2 mipFog
언차티드4 테크아트 파트2 mipFog언차티드4 테크아트 파트2 mipFog
언차티드4 테크아트 파트2 mipFog
 
[0529 박민근] 전역조명(global illumination)
[0529 박민근] 전역조명(global illumination)[0529 박민근] 전역조명(global illumination)
[0529 박민근] 전역조명(global illumination)
 
Post processing in_color
Post processing in_colorPost processing in_color
Post processing in_color
 
2018.02.03 이미지 텍스처링
2018.02.03 이미지 텍스처링2018.02.03 이미지 텍스처링
2018.02.03 이미지 텍스처링
 
XAI recent researches
XAI recent researchesXAI recent researches
XAI recent researches
 
Real-Time Global Illumination Techniques
Real-Time Global Illumination TechniquesReal-Time Global Illumination Techniques
Real-Time Global Illumination Techniques
 
노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)
 
언차티드4 테크아트 파트3 MicroShadowBRDF Term
언차티드4 테크아트 파트3 MicroShadowBRDF Term언차티드4 테크아트 파트3 MicroShadowBRDF Term
언차티드4 테크아트 파트3 MicroShadowBRDF Term
 

Similar to 120427 celluar texture

FCN to DeepLab.v3+
FCN to DeepLab.v3+FCN to DeepLab.v3+
FCN to DeepLab.v3+
Whi Kwon
 
CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)
CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)
CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)
Lee Seungeun
 
[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments종빈 오
 
Reflective Shadow Maps
Reflective Shadow MapsReflective Shadow Maps
Reflective Shadow Maps
Bongseok Cho
 
[14.10.21] Far Cry and DX9 번역(shaderstudy)
[14.10.21] Far Cry and DX9 번역(shaderstudy)[14.10.21] Far Cry and DX9 번역(shaderstudy)
[14.10.21] Far Cry and DX9 번역(shaderstudy)
해강
 
Texture Modeling a Procedual Approach #01
Texture Modeling a Procedual Approach #01Texture Modeling a Procedual Approach #01
Texture Modeling a Procedual Approach #01CARROTCG
 
Cheap realisticskinshading kor
Cheap realisticskinshading korCheap realisticskinshading kor
Cheap realisticskinshading kor
민웅 이
 
Lecture 4: Neural Networks I
Lecture 4: Neural Networks ILecture 4: Neural Networks I
Lecture 4: Neural Networks I
Sang Jun Lee
 
120413 making noises
120413 making noises120413 making noises
120413 making noisesCARROTCG
 
A Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding AutoencoderA Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding Autoencoder
Lee Seungeun
 
3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)
Haesun Park
 
3.unsupervised learing
3.unsupervised learing3.unsupervised learing
3.unsupervised learing
Haesun Park
 
Real-time near-field global illumination based on a voxel model
Real-time near-field global illumination based on a voxel modelReal-time near-field global illumination based on a voxel model
Real-time near-field global illumination based on a voxel modelJaeyun Lee
 
Deep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural NetworkDeep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural Network
agdatalab
 
Voxel based game_optimazation_relelase
Voxel based game_optimazation_relelaseVoxel based game_optimazation_relelase
Voxel based game_optimazation_relelase
YEONG-CHEON YOU
 
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
강 민우
 
Convolutional neural networks
Convolutional neural networksConvolutional neural networks
Convolutional neural networks
HyunjinBae3
 
제노블레이도 2 ray marching을사용한 구름 표현
제노블레이도 2 ray marching을사용한 구름 표현제노블레이도 2 ray marching을사용한 구름 표현
제노블레이도 2 ray marching을사용한 구름 표현
민웅 이
 
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
Ki Hyunwoo
 

Similar to 120427 celluar texture (20)

FCN to DeepLab.v3+
FCN to DeepLab.v3+FCN to DeepLab.v3+
FCN to DeepLab.v3+
 
CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)
CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)
CNN 초보자가 만드는 초보자 가이드 (VGG 약간 포함)
 
[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments
 
Reflective Shadow Maps
Reflective Shadow MapsReflective Shadow Maps
Reflective Shadow Maps
 
[14.10.21] Far Cry and DX9 번역(shaderstudy)
[14.10.21] Far Cry and DX9 번역(shaderstudy)[14.10.21] Far Cry and DX9 번역(shaderstudy)
[14.10.21] Far Cry and DX9 번역(shaderstudy)
 
Texture Modeling a Procedual Approach #01
Texture Modeling a Procedual Approach #01Texture Modeling a Procedual Approach #01
Texture Modeling a Procedual Approach #01
 
Cheap realisticskinshading kor
Cheap realisticskinshading korCheap realisticskinshading kor
Cheap realisticskinshading kor
 
Lecture 4: Neural Networks I
Lecture 4: Neural Networks ILecture 4: Neural Networks I
Lecture 4: Neural Networks I
 
120413 making noises
120413 making noises120413 making noises
120413 making noises
 
A Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding AutoencoderA Beginner's guide to understanding Autoencoder
A Beginner's guide to understanding Autoencoder
 
3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)
 
3.unsupervised learing
3.unsupervised learing3.unsupervised learing
3.unsupervised learing
 
Real-time near-field global illumination based on a voxel model
Real-time near-field global illumination based on a voxel modelReal-time near-field global illumination based on a voxel model
Real-time near-field global illumination based on a voxel model
 
Gan
GanGan
Gan
 
Deep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural NetworkDeep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural Network
 
Voxel based game_optimazation_relelase
Voxel based game_optimazation_relelaseVoxel based game_optimazation_relelase
Voxel based game_optimazation_relelase
 
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
 
Convolutional neural networks
Convolutional neural networksConvolutional neural networks
Convolutional neural networks
 
제노블레이도 2 ray marching을사용한 구름 표현
제노블레이도 2 ray marching을사용한 구름 표현제노블레이도 2 ray marching을사용한 구름 표현
제노블레이도 2 ray marching을사용한 구름 표현
 
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
 

More from CARROTCG

20120713 ch13
20120713 ch1320120713 ch13
20120713 ch13CARROTCG
 
20120713 ch12
20120713 ch1220120713 ch12
20120713 ch12CARROTCG
 
Procedural synthesis of geometry
Procedural synthesis of geometryProcedural synthesis of geometry
Procedural synthesis of geometryCARROTCG
 
Texture Modeling a Procedual Approach Chater 2 : Building Procedural Textures
Texture Modeling a Procedual Approach Chater 2 : Building Procedural TexturesTexture Modeling a Procedual Approach Chater 2 : Building Procedural Textures
Texture Modeling a Procedual Approach Chater 2 : Building Procedural TexturesCARROTCG
 
Volumetric cloud modeling with implicit functions web
Volumetric cloud modeling with implicit functions webVolumetric cloud modeling with implicit functions web
Volumetric cloud modeling with implicit functions webCARROTCG
 
120216 ch 12_creating_elements
120216 ch 12_creating_elements120216 ch 12_creating_elements
120216 ch 12_creating_elementsCARROTCG
 
120119 ch 7_time_and_temporal_manipulations
120119 ch 7_time_and_temporal_manipulations120119 ch 7_time_and_temporal_manipulations
120119 ch 7_time_and_temporal_manipulationsCARROTCG
 
120106 ch 6_matte_creation_and_manipulation_web
120106 ch 6_matte_creation_and_manipulation_web120106 ch 6_matte_creation_and_manipulation_web
120106 ch 6_matte_creation_and_manipulation_webCARROTCG
 
120106 ch 5_basic image compositing_re
120106 ch 5_basic image compositing_re120106 ch 5_basic image compositing_re
120106 ch 5_basic image compositing_reCARROTCG
 
111118 ch 4_basic image manipulation_web
111118 ch 4_basic image manipulation_web111118 ch 4_basic image manipulation_web
111118 ch 4_basic image manipulation_webCARROTCG
 
111028 ch 3_the digital representation of visual information
111028 ch 3_the digital representation of visual information111028 ch 3_the digital representation of visual information
111028 ch 3_the digital representation of visual informationCARROTCG
 
The Art and Science of Digital Compositing Chapter 1,2
The Art and Science of Digital Compositing Chapter 1,2The Art and Science of Digital Compositing Chapter 1,2
The Art and Science of Digital Compositing Chapter 1,2CARROTCG
 

More from CARROTCG (14)

20120921
2012092120120921
20120921
 
20120810
2012081020120810
20120810
 
20120713 ch13
20120713 ch1320120713 ch13
20120713 ch13
 
20120713 ch12
20120713 ch1220120713 ch12
20120713 ch12
 
Procedural synthesis of geometry
Procedural synthesis of geometryProcedural synthesis of geometry
Procedural synthesis of geometry
 
Texture Modeling a Procedual Approach Chater 2 : Building Procedural Textures
Texture Modeling a Procedual Approach Chater 2 : Building Procedural TexturesTexture Modeling a Procedual Approach Chater 2 : Building Procedural Textures
Texture Modeling a Procedual Approach Chater 2 : Building Procedural Textures
 
Volumetric cloud modeling with implicit functions web
Volumetric cloud modeling with implicit functions webVolumetric cloud modeling with implicit functions web
Volumetric cloud modeling with implicit functions web
 
120216 ch 12_creating_elements
120216 ch 12_creating_elements120216 ch 12_creating_elements
120216 ch 12_creating_elements
 
120119 ch 7_time_and_temporal_manipulations
120119 ch 7_time_and_temporal_manipulations120119 ch 7_time_and_temporal_manipulations
120119 ch 7_time_and_temporal_manipulations
 
120106 ch 6_matte_creation_and_manipulation_web
120106 ch 6_matte_creation_and_manipulation_web120106 ch 6_matte_creation_and_manipulation_web
120106 ch 6_matte_creation_and_manipulation_web
 
120106 ch 5_basic image compositing_re
120106 ch 5_basic image compositing_re120106 ch 5_basic image compositing_re
120106 ch 5_basic image compositing_re
 
111118 ch 4_basic image manipulation_web
111118 ch 4_basic image manipulation_web111118 ch 4_basic image manipulation_web
111118 ch 4_basic image manipulation_web
 
111028 ch 3_the digital representation of visual information
111028 ch 3_the digital representation of visual information111028 ch 3_the digital representation of visual information
111028 ch 3_the digital representation of visual information
 
The Art and Science of Digital Compositing Chapter 1,2
The Art and Science of Digital Compositing Chapter 1,2The Art and Science of Digital Compositing Chapter 1,2
The Art and Science of Digital Compositing Chapter 1,2
 

120427 celluar texture

  • 1. Texturering & Modeling a Procedual Approach 김정근
  • 3. Agenda  The New Bases  Implementation Strategy – Dicing Space – Neighbor Testing – The Subtle Population Table – Extensions and Alternatives  Sample Code 3
  • 4. Cellular Texturing The function that launched a thousand textures. 4
  • 5. Cellular Texturing Perlin’s Noise 를 보완할 수 있는 새로운 Function 제안 Steve Worley CEO, founder Worley Laboratories 1995 – Present (17 years) Menlo Park, California Research and development of graphics tools Developed and released 6 different software products: Gaffer: lighting snad shading methods Polk, Taft: collections of artist utilities Sasquatch: procedural hair and fur modeler and renderer G2: interactive lighting and shading system FPrime: the industry's first real-time render-accurate preview renderer, using interactive raytracing. 5
  • 6. Cellular Texturing Perlin’s Noise 를 보완할 수 있는 새로운 Function 제안 Cell을 random하게 배열하여 공간을 나누는 것에 기초 포장도로의 표면, 타일로 붙여진 표면, 생물의 딱딱한 피부나 껍 질, 구겨진 종이, 얼음, 바위, 분화구 등을 표현 미리 계산하거나 table storage 없이 효율적인 계산 가능 6
  • 7. Cellular Texturing  R3 공간에서 정의되고, scalar value 로 return – Point (x, y, z) 를 Input value 로 받아서 scalar value 을 얻음. – 이 scalar value 는 직접적으로 색의 값으로 표현되거나 regular pattern을 흐트러뜨리는 역할 을 함. < Perlin‟s Noise Function(3D Basis) : (a) Wrinkles, (b) Color > 7
  • 8. Cellular Texturing  Many Texture Algorithms 와 비교 – Fourier methods – Reaction diffusion textures, An algorithm by Miyata -> Extensive Precomputation 이 요구되고, scalar value 로 return 이 되지 않아 매우 복잡하고 규 모가 커서 일반적이지 못함. (a) (b) < Many Texture Algorithms : (a) Reaction diffusion - horse , (b) An algorithm by Miyata – Edo Castle > – Many texture algorithms은 제한된 form 때문에 응용이 어려운 반면, Perlin‟s noise function은 매우 단순하여 얼마든지 다양하고 쉽게 응용 가능. -> new texture function을 만들고, Basis Function으로 사용 가능. 8
  • 9. The New Bases  2가지 기초 개념 – “feature points” 를 R3영역에 흩어 뿌리는 것. – “local points”의 분포도에 따른 scalar function을 만드는 것. • local points 의 분포를 사용하는 또 다른 예 ( Bombing, Lewis Methods…)  The Perlin‟s noise basis function과 같이 precomputation 이나 table storage 없이도 효과적인 noise의 표현과 계산이 가능  기존의 noise function 보다 매우 다양하고 독특한 효과를 기대할 수 있음 9
  • 10. The New Bases  Definition – Randomly Distributed Feature Points in R3 – F1 (x) : Distance to Closest Feature Point from any Point x in R3 (예를 들면 F1 (x) 를 이용해 R3공간에 일반적인 Voronoi region을 형성) – F2(x): Distance to Second Closest Feature Point – Fn(x): Distance to n th Closest Feature Point (a) (b) (c) < F1(x) Function : (a) 2D Plane On surface, (b) 2D Plane Off surface, (c) 3D plane > 10
  • 11. The New Bases  Fn(x) Properties – Fn(x) 는 항상 continuous 함. – Fn(x) 는 n에 비례하여 항상 증가.( 감소하지 않음) -> 0 F ( x) F ( x) F ( x)Ingeneral : 1 2 , ( 3 F ( x)) F n n 1 ( x) – The gradient of Fn(x) : x 에 n번째로 가까운 feature point 를 가르키는 간단하게 unit direction vector 11
  • 12. The New Bases Voronoi diagram 두 점 p와 q 사이의 유클리안 거리를 dist(p, q),, 한 평면상에 n개의 분리된 점들의 집합 P를 P={p1, p2, p3, ..., pn} 라고 할때 P의 Voronoi Diagram은 그 평면을 P에 있는 각각의 점에 대해서 n개의 cell로 나누는 것 만 일, dist(pi, q) < dist(pj, q) 를 만족하면 q는 p1 cell에 포함되며 평면상의 점들은 P에 있는 점들 중 가장 가까운 점이 속한 cell에 포함 12
  • 16. Implementation Strategy 이것을 사용 하기 위해 Cellular 텍스처 기반 기능을 구현하는 방법을 이해할 필요는 없다 기초의 주요 알고리즘의 수정 및 각색은 원래 노이즈 버전에서 0 새로운 효과를 생성할수 있게 한다
  • 17. Implementation Strategy Feature Points가 공간을 통해 확산되는 방법을 정의 밀도 및 포인트의 분포는 basis function 의 성격을 변화 첫번째 가정은 월드의 축에 부합하는 기본 패턴을 피하는 등방성 function이 필요 17
  • 18. Dicing Space 큐브 안에 한정된 영역을 공간을 자르고 생성하고 각 큐브 안의 테스트 Feature Point 를 계산 18
  • 19. Dicing Space Sample Location Feature Point 19
  • 20. Dicing Space Feature Points가 스스로 생성하는 위치의 Seed 도 필요 Solution Fast Random Number Generator에 대한 Seed로 사용하는 단일 32 비트 정수 안에서 큐브의 월드 정수 좌표를 섞는 것(hash) 20
  • 21. Dicing Space short lookup table of 256 possibilities Seed 큐브에 있는 점 개수를 계산 Possible point populations의 고정배열은 Magic Property “Points Isotropic 을 유지”해주고 Precomputed 됨 21
  • 24. The Subtle Population Table 포와송 분포는 주어진 평균 밀도에서, 해당 범위내에서, 특정 point 개수를 찾을 확률(가능성)을 제공 불연속 포와송 분포 함수를 사용하면 영역내에 point 가 얼마나 있을지에 대한 정확한 확률을 계산 만약 포와송 확률을 바탕으로 한 모집단을 가지고, 각각의 cube 내에 있는 point 들을 랜덤하게 생성한다면, feature point 들은 모두 등방성 일 것이고, texture function 은 grid bias를 전혀 가지지 않을 것 이상적인 데이터를 얻기 위해 Poisson distribution 을 사용 24
  • 25. The Subtle Population Table “unit volume 한개당 feature point 평균 밀도를 λ라고 하고, unit cube 하나에 m 개의 feature point 가 존재할 확률은 다음과 같다.” (P(λ,m) : unit cube 하나에 m 개의 feature point 가 존재할 확률, 즉 Poisson 확률) P(λ,m) = λ^(m)/{ e^(λ)* m!)} 25
  • 26. The Subtle Population Table “X는 어느 대학의 월요일 오전 9시 수업에 결석하는 학생수를 나타낸다고 가정, 보통 기대값은 2.5명으로 알려져 있다 만약 5명을 초과한 수의 학생이 결석할 확률은?” 26
  • 27. The Subtle Population Table  특징 – λ 값이 크다는 건 Cube 내에 Feature Point 가 많다는 의미 Point를 생성하고 테스트하는데 시 간이 걸림 – λ 값이 낮다는건 더 많은 Neighbor Cube를 조사하는데 시간이 걸림 – λ 값을 선택하는 가장 확실한 방법은 다른 값을 넣어보고 빠른 속도를 가지는지 찾아서 그값 을 λ 값으로 선택하는 것 – 최상의 밸런스는 Input Constant로 나누어 간단하게 Scaling 함으로서 Scale 값을 변경시켜 보면서 밸런스를 찾음 텍스쳐 제작자의 편의를 위해 Normalize 하는 것이 좋음 27
  • 28. Extensions and Alternatives 확장성이 크고 커스터마이즈가 용이함 Ken Musgrave 가 소개한 다양한 방법의 프랙탈 조차도 기본형태에서 Noise의 기 본 Function을 사용 distance 의 정의 자체를 변경할수 있다는것. (간단하게 Euclidean distance d2=dx*dx+dy*dy+dz*dz; ) Biased “stretched” A*dx*dx+B*dy*dy+C*dz*dz Manhattan distance fabs(dx)+fabs(dy)+fabs(dz) Radial Manhattan: A*fabs(dR)+B*fabs(dTheta)+C*dz Superquadratic: pow(fabs(dx), A) + pow(fabs(dy), B) + pow(fabs(dz),C) 28
  • 29. Extensions and Alternatives (a) F1(x) - 매우 simple - 직접 color spline and bump 로 map 가능 - feature points 주위로 분포 -> 기본적인 voronoi 영역 - example : Polka Dots (물방울 무늬) (b) F2(x)(좌) & F2(x)(우) - 빠른 변화와 내부구조를 형성 - 직접 color spline and bump 로 map 가능하지만 linear combination 을 형성함으로써 더 흥미로운 패턴 생성. 29
  • 30. Extensions and Alternatives (c) F2(x) – F1(x) ; 2D - 모든 x에 있어서 F2(x) > F1(x) - 직접 color spline and bump 로 map 가능 - F2(x) = F1(x) 에서 0 값을 가지고 voronoi boundaries 에서 나타남 - to make latticework of connected ridges, forming a vein-like tracery (d) Constant Base Color plus Fractal Noise over F1 Regions, F2(x) – F1(x) Bump Mapping ; 3D Flagstone texture - F1 function이 가장 가까운 feature point 의 identity 를 나타내는 고유의 ID number를 return 시키면, 이 number는 voronoi cell 에 걸쳐 일정한 values를 만들게 됨. -> 즉 하나의 cell 을 일정한 색으로 shade 가 가능. - F2(x) - F1(x) 에 기초한 Bump Mapping 적용 - 각 cell 에서 fractal noise 로 얼룩 표현 30
  • 31. Extensions and Alternatives (e) Linear Combination of Fn : C1F1 + C2F2 + C3F3 + C4F4 (Flagstone-like area) - low n basis function 의 combinations - Cn의 변화를 주어 생성. 31
  • 32. Extensions and Alternatives (f) Fractal Version - noise 로 fractal noise 를 만드는 것과 같음. - different weight & Scaling factors 를 이용하여 다양한 표현 - computing a function : range of i (i=0~5) - 위의 Gn 을 color and bumps에 대한 index로 사용 * upper - spotted pattern, F1의 fractal version - tongue : fractal noise 사용 - body : linear gradient 가 color variation 을 위해 적용 * lower - More Fractal versions ; Cut Tori 32
  • 33. Extensions and Alternatives (g) F1 Fractal Crumple : Seawater (upper) - 가장 유용한 version - Bump Map 으로만 응용 시, 종이나 tinfoil(쵸코렛이나 담배 등을 싸는 은종이) 처럼 surface 를 ‘crumple’ 시킴. - 부드러운 surface 를 break up 하는 방법으로 예술가들 에게 굉장히 인기. - fractal noise bumps 와는 달리 subtle roughening을 제 공. - 이 crumple appearance를 가진 reflective, bumped map plane은 바닷물과 매우 흡사하게 나타남. (f) More Distance Metrics - Manhattan Metric (lower) - A radial coordinate version : ‘Death Star’ 33
  • 34. Extensions and Alternatives (g) Spatially Varying Density - Object Geometry - 보통 algorithm 은 3D에서 compute 되지만, 2D variants는 속도를 빠르게 함. - 4D variants 는 animated 분야에 사용될 수 있지만 속도가 매우 떨어짐. 34
  • 35. Sample Code static int Poisson_count[256]= {4,3,1,1,1,2,4,2,2,2,5,1,0,2,1,2,2,0,4,3,2,1,2,1,3,2,2,4,2,2,5,1,2,3,2,2,2,2,2,3, 2,4,2,5,3,2,2,2,5,3,3,5,2,1,3,3,4,4,2,3,0,4,2,2,2,1,3,2,2,2,3,3,3,1,2,0,2,1,1,2, 2,2,2,5,3,2,3,2,3,2,2,1,0,2,1,1,2,1,2,2,1,3,4,2,2,2,5,4,2,4,2,2,5,4,3,2,2,5,4,3, 3,3,5,2,2,2,2,2,3,1,1,4,2,1,3,3,4,3,2,4,3,3,3,4,5,1,4,2,4,3,1,2,3,5,3,2,1,3,1,3, 3,3,2,3,1,5,5,4,2,2,4,1,3,4,1,5,3,3,5,3,4,3,2,2,1,1,1,1,1,2,4,5,4,5,4,2,1,5,1,1, 2,3,3,3,2,5,2,3,3,2,0,2,1,1,4,2,1,3,2,1,2,2,3,2,5,5,3,4,5,5,2,4,4,5,3,2,2,2,1,4, 2,3,3,4,2,5,4,2,4,2,2,2,4,5,3,2}; #define DENSITY_ADJUSTMENT 0.398150 static void AddSamples(long xi, long yi, long zi, long max_order, double at[3], double *F, double (*delta)[3], unsigned long *ID); 35
  • 36. Sample Code /* The main function! */ void Worley(double at[3], long max_order, double *F, double (*delta)[3], unsigned long *ID) { double x2,y2,z2, mx2, my2, mz2; double new_at[3]; long int_at[3], i; /* Initialize the F values to "huge" so they will be replaced by the first real sample tests. Note we'll be storing and comparing the SQUARED distance from the feature points to avoid lots of slow sqrt() calls. We'll use sqrt() only on the final answer. */ for (i=0; i<max_order; i++) F[i]=999999.9; /* Make our own local copy, multiplying to make mean(F[0])==1.0 */ new_at[0]=DENSITY_ADJUSTMENT*at[0]; new_at[1]=DENSITY_ADJUSTMENT*at[1]; new_at[2]=DENSITY_ADJUSTMENT*at[2]; /* Find the integer cube holding the hit point */ int_at[0]=(long)floor(new_at[0]); /* A macro could make this slightly faster */ int_at[1]=(long)floor(new_at[1]); int_at[2]=(long)floor(new_at[2]); /* A simple way to compute the closest neighbors would be to test all boundary cubes exhaustively. This is simple with code like: { long ii, jj, kk; for (ii=-1; ii<=1; ii++) for (jj=-1; jj<=1; jj++) for (kk=-1; kk<=1; kk++) AddSamples(int_at[0]+ii,int_at[1]+jj,int_at[2]+kk, max_order, new_at, F, delta, ID); } But this wastes a lot of time working on cubes which are known to be too far away to matter! So we can use a more complex testing method that avoids this needless testing of distant cubes. This doubles the speed of the algorithm. */ 36
  • 37. Sample Code /* Test the central cube for closest point(s). */ AddSamples(int_at[0], int_at[1], int_at[2], max_order, new_at, F, delta, ID); /* We test if neighbor cubes are even POSSIBLE contributors by examining the combinations of the sum of the squared distances from the cube's lower or upper corners.*/ x2=new_at[0]-int_at[0]; y2=new_at[1]-int_at[1]; z2=new_at[2]-int_at[2]; mx2=(1.0-x2)*(1.0-x2); my2=(1.0-y2)*(1.0-y2); mz2=(1.0-z2)*(1.0-z2); x2*=x2; y2*=y2; z2*=z2; /* Test 6 facing neighbors of center cube. These are closest and most likely to have a close feature point. */ if (x2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1] , int_at[2] , max_order, new_at, F, delta, ID); if (y2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]-1, int_at[2] , max_order, new_at, F, delta, ID); if (z2<F[max_order-1]) AddSamples(int_at[0] , int_at[1] , int_at[2]-1, max_order, new_at, F, delta, ID); if (mx2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1] , int_at[2] , max_order, new_at, F, delta, ID); if (my2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]+1, int_at[2] , max_order, new_at, F, delta, ID); if (mz2<F[max_order-1]) AddSamples(int_at[0] , int_at[1] , int_at[2]+1, max_order, new_at, F, delta, ID); 37
  • 38. Sample Code /* Test 12 "edge cube" neighbors if necessary. They're next closest. */ if ( x2+ y2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]-1, int_at[2] , max_order, new_at, F, delta, ID); if ( x2+ z2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1] , int_at[2]-1, max_order, new_at, F, delta, ID); if ( y2+ z2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]-1, int_at[2]-1, max_order, new_at, F, delta, ID); if (mx2+my2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]+1, int_at[2] , max_order, new_at, F, delta, ID); if (mx2+mz2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1] , int_at[2]+1, max_order, new_at, F, delta, ID); if (my2+mz2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]+1, int_at[2]+1, max_order, new_at, F, delta, ID); if ( x2+my2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]+1, int_at[2] , max_order, new_at, F, delta, ID); if ( x2+mz2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1] , int_at[2]+1, max_order, new_at, F, delta, ID); if ( y2+mz2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]-1, int_at[2]+1, max_order, new_at, F, delta, ID); if (mx2+ y2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]-1, int_at[2] , max_order, new_at, F, delta, ID); if (mx2+ z2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1] , int_at[2]-1, max_order, new_at, F, delta, ID); if (my2+ z2<F[max_order-1]) AddSamples(int_at[0] , int_at[1]+1, int_at[2]-1, max_order, new_at, F, delta, ID); 38
  • 39. Sample Code /* Final 8 "corner" cubes */ if ( x2+ y2+ z2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]-1, int_at[2]-1, max_order, new_at, F, delta, ID); if ( x2+ y2+mz2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]-1, int_at[2]+1, max_order, new_at, F, delta, ID); if ( x2+my2+ z2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]+1, int_at[2]-1, max_order, new_at, F, delta, ID); if ( x2+my2+mz2<F[max_order-1]) AddSamples(int_at[0]-1, int_at[1]+1, int_at[2]+1, max_order, new_at, F, delta, ID); if (mx2+ y2+ z2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]-1, int_at[2]-1, max_order, new_at, F, delta, ID); if (mx2+ y2+mz2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]-1, int_at[2]+1, max_order, new_at, F, delta, ID); if (mx2+my2+ z2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]+1, int_at[2]-1, max_order, new_at, F, delta, ID); if (mx2+my2+mz2<F[max_order-1]) AddSamples(int_at[0]+1, int_at[1]+1, int_at[2]+1, max_order, new_at, F, delta, ID); /* We're done! Convert everything to right size scale */ for (i=0; i<max_order; i++) { F[i]=sqrt(F[i])*(1.0/DENSITY_ADJUSTMENT); delta[i][0]*=(1.0/DENSITY_ADJUSTMENT); delta[i][1]*=(1.0/DENSITY_ADJUSTMENT); delta[i][2]*=(1.0/DENSITY_ADJUSTMENT); } return; } 39
  • 40. Sample Code static void AddSamples(long xi, long yi, long zi, long max_order, double at[3], double *F, double (*delta)[3], unsigned long *ID) { double dx, dy, dz, fx, fy, fz, d2; long count, i, j, index; unsigned long seed, this_id; /* Each cube has a random number seed based on the cube's ID number. The seed might be better if it were a nonlinear hash like Perlin uses for noise but we do very well with this faster simple one. Our LCG uses Knuth-approved constants for maximal periods. */ seed=702395077*xi + 915488749*yi + 2120969693*zi; /* How many feature points are in this cube? */ count=Poisson_count[seed>>24]; /* 256 element lookup table. Use MSB */ seed=1402024253*seed+586950981; /* churn the seed with good Knuth LCG */ for (j=0; j<count; j++) /* test and insert each point into our solution */ { this_id=seed; seed=1402024253*seed+586950981; /* churn */ /* compute the 0..1 feature point location's XYZ */ fx=(seed+0.5)*(1.0/4294967296.0); seed=1402024253*seed+586950981; /* churn */ fy=(seed+0.5)*(1.0/4294967296.0); seed=1402024253*seed+586950981; /* churn */ fz=(seed+0.5)*(1.0/4294967296.0); seed=1402024253*seed+586950981; /* churn */ /* delta from feature point to sample location */ dx=xi+fx-at[0]; dy=yi+fy-at[1]; dz=zi+fz-at[2]; 40
  • 41. Sample Code /* Distance computation! Lots of interesting variations are possible here! Biased "stretched" A*dx*dx+B*dy*dy+C*dz*dz Manhattan distance fabs(dx)+fabs(dy)+fabs(dz) Radial Manhattan: A*fabs(dR)+B*fabs(dTheta)+C*dz Superquadratic: pow(fabs(dx), A) + pow(fabs(dy), B) + pow(fabs(dz),C) Go ahead and make your own! Remember that you must insure that new distance function causes large deltas in 3D space to map into large deltas in your distance function, so our 3D search can find them! [Alternatively, change the search algorithm for your special cases.] */ d2=dx*dx+dy*dy+dz*dz; /* Euclidian distance, squared */ if (d2<F[max_order-1]) /* Is this point close enough to rememember? */ { /* Insert the information into the output arrays if it's close enough. We use an insertion sort. No need for a binary search to find the appropriate index.. usually we're dealing with order 2,3,4 so we can just go through the list. If you were computing order 50 (wow!!) you could get a speedup with a binary search in the sorted F[] list. */ 41
  • 42. Sample Code index=max_order; while (index>0 && d2<F[index-1]) index--; /* We insert this new point into slot # <index> */ /* Bump down more distant information to make room for this new point. */ for (i=max_order-1; i-->index;) { F[i+1]=F[i]; ID[i+1]=ID[i]; delta[i+1][0]=delta[i][0]; delta[i+1][1]=delta[i][1]; delta[i+1][2]=delta[i][2]; } /* Insert the new point's information into the list. */ F[index]=d2; ID[index]=this_id; delta[index][0]=dx; delta[index][1]=dy; delta[index][2]=dz; } } return; } 42
  • 43. Conclusion  실질적인 texture design 에서 매우 유용함.  Perlin‟s fractal noise 를 보완하며, noise 가 사용되는 어떤 algorithm 에도 „A Cellular Texture Basis Function‟ 을 적용가능.  시각적인 효과가 늘 똑같지 않고, image 를 더 다양하게 한다는 점에서 가치 가 있음. 43
  • 44. Reference • Worley, Steven (1996). A cellular texture basis function. Proceedings of the 23rd annual conference on Computer graphics and interactive techniques • http://www.gutgames.com/post/Cellular-Textures.aspx • http://www.blackpawn.com/texts/cellular/default.html • http://codevania.springnote.com/pages/3175790.xhtml • http://demonstrations.wolfram.com/FractalCellularTextures/ • http://fgiesen.wordpress.com/2010/03/28/how-to-generate-cellular-textures/ • http://hq.scene.ro/blog/read/cellular-texture/ • http://my.opera.com/community/forums/topic.dml?id=1300002 • http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/cellular-textures-the-light-speed-approach-r2668 • http://www.drx.dk/cel.phphttp://cell-auto.com/optimisation/ • http://petewarden.com/notes/archives/2005/05/testing.htm • http://www.cs.unc.edu/~blloyd/comp238/shader.html • http://mathworld.wolfram.com/VoronoiDiagram.html • http://www.snibbe.com/projects/interactive/boundaryfunctions • http://www.snibbe.com/index.php/projects/interactive/bubbleharp/ • http://gogocj2012.blog.me/50137595052 44
  • 45. Q&A