Fast Simulation of Lightning for 3D Games
Download
Report
Transcript Fast Simulation of Lightning for 3D Games
Fast Simulation of Lightning
for 3D Games
Jeremy Bryan
Advisor: Sudhanshu Semwal
Overview
Introduction
Applications
Previous Research
Design
Implementation
Results
Future Work
Conclusion
Introduction
Realistic cloud-to-ground lightning strike
3D game emphasis
Real-time requirement
Cellular Automata implementation
Introduction (cont.)
Lightning Basics
Strong electrical field
Stepped leader
Upward positive leader
Attachment process
Return stroke
Applications
3D Games
Movies
Physical modeling
???
Previous Research
Reed
“Visual Simulation of Lightning”
Emphasis on rendering with ray-tracing
Simple 3D model generation
Previous Research (cont.)
Previous Research (cont.)
Dobashi
Identical modeling technique as Reed
Takes scattering effect due to atmospheric
particles and clouds into account
Previous Research (cont.)
Previous Research (cont.)
UCCS Physics website
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.
Find largest breakdown number
(X)
α
Cellular Automata
Discreet lattice
Discreet time-steps drive simulation
Each cell has finite set of values
Each cell evolves according to same set of
rules
Evolution of cell depends only upon local
neighborhood interaction
Design
Complex Lightning Algorithm
Ground up
Assign values on the fly
Random
numbers for “r”
Make the calculations
Find
largest breakdown number (X)
α
X=E r
Segment length
Design (cont.)
Pseudocode
Proc GenerateComplexLightning
// Load the starting coordinates
list.add target.coords
while height <= MAX_ALTITUDE
Assign r to 26 neighbor cells if they do not have one
Calculate E for 26 neighbor cells if not done previously
Find maximum X
list.add maxE.coords
end while
for each voxel in list
temp = rand()
if temp < BRANCH_PROBABILITY then
GenerateComplexBranch()
end if
end for
end proc
Design (cont.)
Design (cont.)
Complex Branch Algorithm
Parent iteration
Uniformly distributed probability function
Recursive
Random branch length
Design (cont.)
Pseudocode
Proc GenerateComplexBranch
BranchLength = rand()
while (BranchHeight >= 0 And BranchLength >=0)
Assign r to neighbor cells if they do not have one
Calculate E for cells if not done previously
Find maximum X
BranchList.add maxE.coords
end while
for each coord in BranchList.coords
if (rand() < BRANCH_PROBABILITY) then
GenerateComplexBranch()
end if
end for
end proc
Implementation
Object-Oriented Design
Programming Languages
Supporting packages
HeightMap Tutorial
Linked list library
OpenGL car tutorial
Implementation (cont.)
Development model
Class structures
CCamera
CVoxel
Lightning
Camera
Target
Car
Explosion
Implementation (cont.)
Observations
1.
2.
3.
Run-time dependent on max branch depth
and probability of branching
Large branch clusters detract from final
product and are time intensive
Number of voxels in a given dimension
match map size. Increasing resolution
would not enhance results.
Results
Results (cont.)
Results (cont.)
Survey
Results (cont.)
Glassner
Mean
Bryan
Reed
Dobashi
3.171875
2.25
2.28125
2.296875
Median
4
2
2.5
2
Mode
4
1
3
2
0.96863
1.140871
1.075982
1.03402
StdDev
Sample Size = 64
Future Work
Efficiency
Support for light sources
Branch modeling
Control point support
???
Conclusion
Aesthetically pleasing results
No discernable lag-time
3D game environment