Fast Simulation of Lightning Fast Simulation of Lightning for 3D Gamesfor 3D Games
Jeremy BryanJeremy Bryan
Advisor: Sudhanshu SemwalAdvisor: Sudhanshu Semwal
OverviewOverview IntroductionIntroductionApplicationsApplicationsPrevious ResearchPrevious ResearchDesignDesign ImplementationImplementationResultsResultsFuture WorkFuture WorkConclusionConclusion
IntroductionIntroduction
Realistic cloud-to-ground lightning strikeRealistic cloud-to-ground lightning strike3D game emphasis3D game emphasisReal-time requirementReal-time requirementCellular Automata implementationCellular Automata implementation
Introduction (cont.)Introduction (cont.)
Lightning BasicsLightning BasicsStrong electrical fieldStrong electrical fieldStepped leaderStepped leaderUpward positive leaderUpward positive leaderAttachment processAttachment processReturn strokeReturn stroke
ApplicationsApplications
3D Games3D GamesMoviesMoviesPhysical modelingPhysical modeling??????
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
Previous Research (cont.)Previous Research (cont.)
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
Previous Research (cont.)Previous Research (cont.)
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.
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
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
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
Design (cont.)Design (cont.)
Design (cont.)Design (cont.)
Complex Branch AlgorithmComplex Branch AlgorithmParent iterationParent iterationUniformly distributed probability functionUniformly distributed probability functionRecursiveRecursiveRandom branch lengthRandom branch length
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
ImplementationImplementation
Object-Oriented DesignObject-Oriented DesignProgramming LanguagesProgramming LanguagesSupporting packagesSupporting packages
HeightMap TutorialHeightMap TutorialLinked list libraryLinked list libraryOpenGL car tutorialOpenGL car tutorial
Implementation (cont.)Implementation (cont.)Development modelDevelopment modelClass structuresClass structures
CCameraCCameraCVoxelCVoxel
LightningLightningCameraCameraTargetTargetCarCarExplosionExplosion
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.
ResultsResults
Results (cont.)Results (cont.)
Results (cont.)Results (cont.)
SurveySurvey
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
Future WorkFuture Work
EfficiencyEfficiencySupport for light sourcesSupport for light sourcesBranch modelingBranch modelingControl point supportControl point support??????
ConclusionConclusion
Aesthetically pleasing resultsAesthetically pleasing resultsNo discernable lag-timeNo discernable lag-time3D game environment3D game environment