a gpu accelerated node based framework for hair
play

A GPU-Accelerated Node Based Framework for Hair Simulation and - PowerPoint PPT Presentation

double negative visual effects double negative visual effects A GPU-Accelerated Node Based Framework for Hair Simulation and Rendering Francesco Giordana Sarah Macdonald Gianluca Vatinno Double Negative VFX SIGGRAPH 2013 1 double negative


  1. double negative visual effects double negative visual effects A GPU-Accelerated Node Based Framework for Hair Simulation and Rendering Francesco Giordana Sarah Macdonald Gianluca Vatinno Double Negative VFX SIGGRAPH 2013 1

  2. double negative visual effects Hair • Creatures: • Digi-doubles hair / facial hair (100k - 150k) • Digital creatures fur and feathers (few Ms) • Environments: • Grass, moss, seaweed, etc.. (many Ms) SIGGRAPH 2013 2

  3. double negative visual effects Hair Pros Why hair on the GPU? • A lot of repetitions of very similar data • Each hair can be computed in parallel • Partially uniform domain • No need for high precision SIGGRAPH 2013 3

  4. double negative visual effects Hair Cons Why NOT hair on the GPU? • Inter-dependency between hairs • Walk down the hair to propagate constraints • Number of curves can change • Arbitrary spatial extension SIGGRAPH 2013 4

  5. double negative visual effects What language / library ? Thrust : • Fast and easy to use: STL -style containers and algorithms • Has lots of fancy iterators to keep code cleaner • Can handle host code: makes code reuse easier • CUDA backend quite optimized (sorts out automatically grid size, block size, shared mem usage) • Has CPU backends ( TBB and OpenMP ) • Limitation: no streams, no manual control of shared mem • We quickly prototype in thrust , then if needed we optimize writing specific CUDA kernels SIGGRAPH 2013 5

  6. double negative visual effects Furball • Procedural node-graph • Custom node graph editor • Embedded in existing 3D sw packages (Maya, Houdini, ...) • High-quality previews in viewport • Modular • C++ Core • Qt / PyQT UI Historical first render with Furball SIGGRAPH 2013 6

  7. double negative visual effects Furball Framework C++ Python qFurball pyFurball dnFurball dnQt PyQT dnPublishing dnSubdiv dnSynapse Qt GPU Accelerated Tools integration Maya PRMan Houdini SIGGRAPH 2013 7

  8. double negative visual effects FurShop - Maya Integration Embedded in Maya Dependency Graph Real-time preview in Maya viewport Custom Graph Editor SIGGRAPH 2013 8

  9. double negative visual effects FurShop - Tools Mask painting tool Attribute publishing Interactive brush tool Custom UI elements SIGGRAPH 2013 9

  10. double negative visual effects FurShop - Example Workflow Static geometry Density mask Follicles Guides Final Hairs SIGGRAPH 2013 10

  11. double negative visual effects FurShop - Example workflow Blue : • external inputs (maya curves, houdini simulation data, curve manipulation tools, etc) • stored in data caches Red : • procedural networks • GPU accelerated elements Purple : • rendering environment (PRMan DSO, OpenGL, etc.) Extra Dynamic Inputs Curves Groom Curves Groom Dynamic LookDev Render Network Network Network Node Static Mesh Anim Mesh SIGGRAPH 2013 11

  12. double negative visual effects FurShop - Maya Nodes MPxNode FurNetworkNode MPxNode MPxNode FurNode FurConversionNode FurNetwork FurRenderNode FurNode FurNode FurCache FurSystem MPxData Merged computation chain FurAttributePtr SIGGRAPH 2013 12

  13. double negative visual effects dnSynapse Enable / disable node Enable / disable CUDA • DAG with lazy-pull computation model • Two types of objects: Node, Attribute • Data flow through Attributes • Nodes for computation • SubGraphs: nodes can contain an entire graph inside • Proxy attributes: attributes from subgraph can be exposed to the upper layer Make output node SIGGRAPH 2013 13

  14. double negative visual effects dnSynapse - Device Controller • Initialize and select device • Create CUDA Context • Handle resources (e.g. available memory) • Enable / disable GPU acceleration struct DeviceController { void enableGPU ( bool enable ); void isEnabledGPU (); void selectBestDevice (); bool canHandle ( const DataGPU * data ); } SIGGRAPH 2013 14

  15. double negative visual effects dnSynapse - Dual Data • Abstract Data wrapper with interface exposed to user struct DataCPU • Two separate implementations for CPU and GPU { thrust::host_vector< ... > ...; • Data conversion triggered with getDataGPU() or getDataCPU() void clear() ; void save ( char * filename ); void load ( char * filename ); }; struct Data { DataCPU* dataCPU ; struct DataGPU DataGPU* dataGPU ; { thrust::device_vector< ... > ...; void clear() ; void clear() ; ... void copyTo ( DataCPU* dst ); void copyFrom ( const DataCPU* src ); DataCPU* getDataCPU() ; }; DataGPU* getDataGPU() ; }; SIGGRAPH 2013 15

  16. double negative visual effects dnSynapse - Dual Nodes • Nodes have a CPU compute and a GPU compute (optional) • Try GPU compute first, fallback to CPU compute • At first GPU compute data is transferred to Device • Data will stay on Device until the next CPU compute • Can enable / disable GPU computation with flags (for debugging) void compute ( Data* outData, Context* inContext ) { bool result_CUDA = false; if ( cudaEnabled () && canUseCUDA () ) result_CUDA = computeCUDA ( outData-> getDataGPU (), context ); if ( ! result_CUDA ) computeCPU ( outData-> getDataCPU (), context ); } SIGGRAPH 2013 16

  17. double negative visual effects Furball - Hair • Follicles • Surface Patch ID • Surface Patch ST • Surface Reference Orient • Follicle Position • Follicle Orient • Follicle Reference Position • Follicle Reference Orient • Follicle UV • Curves • n Curve Points SIGGRAPH 2013 17

  18. double negative visual effects Main families of operators • Per-point: • Each point in a separate thread • No need for info about neighbors • Example: scale • Per-curve: • Compute a whole curve in a single thread • Accumulate constraints walking along the curve • Example: curl • One-curve-to-many: • Relationships between one curve and a set of curves • Per-curve kernel with information about neighbors • Example: guide interpolation • Many-curves-to-many: • Potentially constraints between all curves in a set • Example: hair-hair collisions SIGGRAPH 2013 18

  19. double negative visual effects Memory Layout • Follicles sorted per-patch • Curves sorted per patch, same order as follicles • Curve points are ordered per curve, root to tip • Each attribute to separate compact array • Can split components to separate arrays to maximize memory access efficiency • 1 million curves, 32 segments: 36ms on per-point operator, 96ms on per-curve operator Thread1 Thread2 { { for (int i=0; i<n; ++i) for (int i=0; i<n; ++i) float3 p = points[i+n]; float3 p = points[i + 2*n] } } curve1 curve2 points Coalesced access Uncoalesced access SIGGRAPH 2013 19

  20. double negative visual effects Caching • Problem : Caching occupies memory resources • Must cache on Host: Need transfer H->D when reading cache (slow) • Can’t use too much pinned memory, or system performance will degrade • Solution : cache follicles • Limited data set: no curve points • Can build kdtree and cache it along • Transfer of follicles data is quick, smaller data set so we can use pinned memory • Recompute hairs on the device • 1 million curves, 32 segments per curve: • Follicles and hairs on host, non-pinned memory, Size: 420MB , H->D: 120ms • Follicles on host, hairs on device, pinned, Size: 50MB , H->D: 10ms , Hair Generation: 14ms SIGGRAPH 2013 20

  21. double negative visual effects Test Computer Mirrors current artists’ computers: Xeon X5690 @ 3.47 GHz 6 Cores 48 GB RAM Quadro 4000 CPU - Single threaded using STL containers CUDA - compute 2.0, using thrust Soon to test multi-threaded CPU and CUDA on Tesla K20 SIGGRAPH 2013 21

  22. double negative visual effects Filter Frizz Inputs : Hairs Ramp Mask Randomization Steps: 1) Generate random sequence per-hair 2) Generate random sequence per-point 3) Apply random displacement to each curve point 4) Weigh the effect of the frizz by mask value, ramp value and random sequences Improvement : • Combine mask and random values per-curve before launching main kernel • Reduce texture accesses from (numSegments x numCurves) to numCurves • 10% performance gain SIGGRAPH 2013 22

  23. double negative visual effects FilterFrizz • Total 4-5x speedup • More data -> more performance gain CPU-60seg 264 CPU-30seg 137 CUDA-60seg 240k 74 CUDA-30seg Num Hairs 60 1340 690 1.2M 512 402 0 375 750 1125 1500 Time (millisec) SIGGRAPH 2013 23

  24. double negative visual effects Wisps Inputs : Hairs Wisps center curves Envelope profiles Masks Randomization Steps : 1) Generate envelope for each wisp 2) Distance computation hair follicle - wisp root 3) Randomly pick one of the overlapping wisps for each hair 4) Parallel transport of distance vector along the curve 5) Rescale vector so that it fits the envelope SIGGRAPH 2013 24

  25. double negative visual effects Wisps CPU kdtree - CUDA brute force 10x speedup 10k Wisps 100 Wisps CPU-60seg CPU-60seg 672 210 CPU-30seg CPU-30seg CUDA-60seg CUDA-60seg 530 118 50k CUDA-30seg CUDA-30seg 50k 142 20 Num Hairs Num Hairs 125 13 2580 855 2000 485 200k 200k 500 78 450 50 0 750 1500 2250 3000 0 225 450 675 900 Time (millisec) Time (millisec) SIGGRAPH 2013 25

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend