Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

25
Fast Simulation of Fast Simulation of Lightning for 3D Lightning for 3D Games Games Jeremy Bryan Jeremy Bryan Advisor: Sudhanshu Semwal Advisor: Sudhanshu Semwal
  • date post

    15-Jan-2016
  • Category

    Documents

  • view

    219
  • download

    0

Transcript of Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Page 1: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Fast Simulation of Lightning Fast Simulation of Lightning for 3D Gamesfor 3D Games

Jeremy BryanJeremy Bryan

Advisor: Sudhanshu SemwalAdvisor: Sudhanshu Semwal

Page 2: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

OverviewOverview IntroductionIntroductionApplicationsApplicationsPrevious ResearchPrevious ResearchDesignDesign ImplementationImplementationResultsResultsFuture WorkFuture WorkConclusionConclusion

Page 3: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

IntroductionIntroduction

Realistic cloud-to-ground lightning strikeRealistic cloud-to-ground lightning strike3D game emphasis3D game emphasisReal-time requirementReal-time requirementCellular Automata implementationCellular Automata implementation

Page 4: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Introduction (cont.)Introduction (cont.)

Lightning BasicsLightning BasicsStrong electrical fieldStrong electrical fieldStepped leaderStepped leaderUpward positive leaderUpward positive leaderAttachment processAttachment processReturn strokeReturn stroke

Page 5: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

ApplicationsApplications

3D Games3D GamesMoviesMoviesPhysical modelingPhysical modeling??????

Page 6: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Previous ResearchPrevious Research

ReedReed ““Visual Simulation of Lightning”Visual Simulation of Lightning”Emphasis on rendering with ray-tracingEmphasis on rendering with ray-tracingSimple 3D model generationSimple 3D model generation

Page 7: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Previous Research (cont.)Previous Research (cont.)

Page 8: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Previous Research (cont.)Previous Research (cont.)

DobashiDobashi Identical modeling technique as ReedIdentical modeling technique as ReedTakes scattering effect due to atmospheric Takes scattering effect due to atmospheric

particles and clouds into accountparticles and clouds into account

Page 9: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Previous Research (cont.)Previous Research (cont.)

Page 10: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Previous Research (cont.)Previous Research (cont.)UCCS Physics websiteUCCS Physics website

Find largest breakdown number Find largest breakdown number (X)(X)

X=EX=Eααrr

r is a generated random number that represents atmospheric properties.

E is the electric field and can be found by using Maxwell’s Equations.

α controls the weight of E on r.

Page 11: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Cellular AutomataCellular Automata

Discreet latticeDiscreet latticeDiscreet time-steps drive simulationDiscreet time-steps drive simulationEach cell has finite set of valuesEach cell has finite set of valuesEach cell evolves according to same set of Each cell evolves according to same set of

rulesrulesEvolution of cell depends only upon local Evolution of cell depends only upon local

neighborhood interactionneighborhood interaction

Page 12: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

DesignDesign

Complex Lightning AlgorithmComplex Lightning AlgorithmGround upGround upAssign values on the flyAssign values on the fly

Random numbers for “r”Random numbers for “r”

Make the calculationsMake the calculationsFind largest breakdown number (X)Find largest breakdown number (X)X=EX=E

ααrr

Segment lengthSegment length

Page 13: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Design (cont.)Design (cont.) PseudocodePseudocode

Proc GenerateComplexLightningProc GenerateComplexLightning

// Load the starting coordinates// Load the starting coordinates

list.add target.coordslist.add target.coords

while height <= MAX_ALTITUDEwhile height <= MAX_ALTITUDE

Assign r to 26 neighbor cells if they do not have oneAssign r to 26 neighbor cells if they do not have one

Calculate E for 26 neighbor cells if not done previouslyCalculate E for 26 neighbor cells if not done previously

Find maximum XFind maximum X

list.add maxE.coordslist.add maxE.coords

end whileend while

for each voxel in listfor each voxel in list

temp = rand()temp = rand()

if temp < BRANCH_PROBABILITY thenif temp < BRANCH_PROBABILITY then

GenerateComplexBranch()GenerateComplexBranch()

end ifend if

end forend for

end procend proc

Page 14: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Design (cont.)Design (cont.)

Page 15: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Design (cont.)Design (cont.)

Complex Branch AlgorithmComplex Branch AlgorithmParent iterationParent iterationUniformly distributed probability functionUniformly distributed probability functionRecursiveRecursiveRandom branch lengthRandom branch length

Page 16: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Design (cont.)Design (cont.)

PseudocodePseudocodeProc GenerateComplexBranchProc GenerateComplexBranch

BranchLength = rand()BranchLength = rand()

while (BranchHeight >= 0 And BranchLength >=0)while (BranchHeight >= 0 And BranchLength >=0)Assign r to neighbor cells if they do not have oneAssign r to neighbor cells if they do not have oneCalculate E for cells if not done previouslyCalculate E for cells if not done previouslyFind maximum XFind maximum XBranchList.add maxE.coordsBranchList.add maxE.coords

end whileend while

for each coord in BranchList.coordsfor each coord in BranchList.coordsif (rand() < BRANCH_PROBABILITY) thenif (rand() < BRANCH_PROBABILITY) then

GenerateComplexBranch()GenerateComplexBranch()end ifend if

end forend for

end procend proc

Page 17: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

ImplementationImplementation

Object-Oriented DesignObject-Oriented DesignProgramming LanguagesProgramming LanguagesSupporting packagesSupporting packages

HeightMap TutorialHeightMap TutorialLinked list libraryLinked list libraryOpenGL car tutorialOpenGL car tutorial

Page 18: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Implementation (cont.)Implementation (cont.)Development modelDevelopment modelClass structuresClass structures

CCameraCCameraCVoxelCVoxel

LightningLightningCameraCameraTargetTargetCarCarExplosionExplosion

Page 19: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Implementation (cont.)Implementation (cont.)

ObservationsObservations1.1. Run-time dependent on max branch depth Run-time dependent on max branch depth

and probability of branchingand probability of branching

2.2. Large branch clusters detract from final Large branch clusters detract from final product and are time intensiveproduct and are time intensive

3.3. Number of voxels in a given dimension Number of voxels in a given dimension match map size. Increasing resolution match map size. Increasing resolution would not enhance results.would not enhance results.

Page 20: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

ResultsResults

Page 21: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Results (cont.)Results (cont.)

Page 22: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Results (cont.)Results (cont.)

SurveySurvey

Page 23: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Results (cont.)Results (cont.)

Glassner Bryan Reed Dobashi

Mean 3.171875 2.25 2.28125 2.296875

Median 4 2 2.5 2

Mode 4 1 3 2

StdDev 0.96863 1.140871 1.075982 1.03402

Sample Size = 64

Page 24: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

Future WorkFuture Work

EfficiencyEfficiencySupport for light sourcesSupport for light sourcesBranch modelingBranch modelingControl point supportControl point support??????

Page 25: Fast Simulation of Lightning for 3D Games Jeremy Bryan Advisor: Sudhanshu Semwal.

ConclusionConclusion

Aesthetically pleasing resultsAesthetically pleasing resultsNo discernable lag-timeNo discernable lag-time3D game environment3D game environment