46
Texturering & Modeling a Procedual Approach 김김김

120427 celluar texture

Embed Size (px)

DESCRIPTION

 

Citation preview

  • 1. Texturering & Modeling a Procedual Approach

2. Chapter 4CELLULAR TEXTURING 3. Agenda The New Bases Implementation Strategy Dicing Space Neighbor Testing The Subtle Population Table Extensions and Alternatives Sample Code 3 4. Cellular TexturingThe function that launched a thousand textures.4 5. Cellular TexturingPerlins Noise Function Steve WorleyCEO, founderWorley Laboratories1995 Present (17 years) Menlo Park, CaliforniaResearch and development of graphics toolsDeveloped and released 6 different software products:Gaffer: lighting snad shading methodsPolk, Taft: collections of artist utilitiesSasquatch: procedural hair and fur modeler and rendererG2: interactive lighting and shading systemFPrime: the industrys first real-time render-accurate preview renderer, using interactive raytracing. 5 6. Cellular TexturingPerlins 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 .< Perlins 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 , Perlins 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 Perlins 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 : 12, (3F ( x)) Fnn 1 ( x) The gradient of Fn(x): x n feature point unit direction vector 11 12. The New BasesVoronoi 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 13. The New Baseshttp://www.snibbe.com/projects/interactive/boundaryfunctions 13 14. The New Bases14 15. The New Bases15 16. Implementation Strategy Cellular 0 17. Implementation Strategy Feature Points basis function function 17 18. Dicing Space Feature Point 18 19. Dicing Space Sample LocationFeature Point 19 20. Dicing SpaceFeature Points Seed SolutionFast Random Number Generator Seed 32 (hash)20 21. Dicing Spaceshort lookup table of 256 possibilitiesSeed Possible point populations Magic PropertyPoints Isotropic Precomputed 21 22. Neighbor Testing 22 23. Neighbor Testing 23 24. The Subtle Population Table , , point () point , cube point , feature point , texture function grid bias Poisson distribution 24 25. The Subtle Population Tableunit 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; )Biasedstretched 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 Tori32 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, bumpedmap plane .(f) More Distance Metrics - Manhattan Metric (lower) - A radial coordinate version : Death Star33 34. Extensions and Alternatives(g) Spatially Varying Density - Object Geometry - algorithm 3D compute , 2D variants . - 4D variants animated .34 35. Sample Codestatic 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.398150static 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 thefirst real sample tests. Note well be storing and comparing theSQUARED distance from the feature points to avoid lots of slowsqrt() calls. Well use sqrt() only on the final answer. */ for (i=0; i>24]; /* 256 element lookup table. Use MSB */ seed=1402024253*seed+586950981; /* churn the seed with good Knuth LCG */ for (j=0; j0 && d2 *//* 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 points 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 . Perlins fractal noise , noise algorithm ACellular 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/5013759505244 45. Q&A 46.