SlideShare a Scribd company logo
1 of 38
Computational Methods
in Physics
PHYS 3437
Dr Rob Thacker
Dept of Astronomy & Physics (MM-301C)
thacker@ap.smu.ca
Today’s Lecture
 Visualization
 More on Opendx
 3d visualization methods
 Isosurfaces
 Volume rendering
 Making movies
 makempeg script & the Berkeley mpeg encoder
 References:
 Some overheads borrowed from a presentations by Tamara
Munzner, Gordon Kindlmann
Getting started with Opendx
 Using Import Data is perhaps
the simplest way to get started
with Opendx
 Selecting it will take you to the
Data Prompter
Data Prompter
 The data prompter will
create a .general file
which the import module
can read
 We’ll look at importing
gridded data
 Will take many different
types
 Let’s look at the simplest –
a regular grid
Datafile description
Using an engineering example in this case
Once the data is described, use “save as” in the
File menu to save the general description used by dx
Simplest tool
 Default viz option will allow
you to see the data
immediately
 Ensure everything loaded in OK
Note on Windows version
 The windows version has problems with spaces in file names
 Don’t save files with names such as
 C:Programs and somethingmyfilesand so on
 Helpful to set up an Opendx directory right at the top of the
directory tree
 e.g. C:Opendx
 Also, the default viewer in the data prompter did not work for
me
 But could just be my laptop running out of memory
 One of the drawbacks of Opendx is that it rapidly consumes memory
 A workstation dedicated to visualization usually needs ~2 GB or more of
memory
 Will exploit multiple processors though – good news!
 Everything else seems fine though, the VPE works without a problem
Checking data
 You can test that your loaded data is correct in a
couple of ways
 Try the test import button
 Will give information about range and so forth
 Examine the data directly with the browse data
button
 Lastly, go directly to the visualization system
described on the previous page
 Unfortunately, if something is wrong it won’t tell you
much quantitative information about the problem
Creating a program
 The default visualization system
is useful, but most of the time
we’ll want to create our own
programs
 When we used the data
prompter we saved a description
of the file called fan.64_ascii
in fan.general
 We can load this into our own
program
 The next few overheads walk
through a simple 3d
visualization
Creating the visualization program
Open the program editor and expand the ALL listing
of modules, place fileselector, import, isosurface, image
Link by left clicking
on tab and then
drawing a line to
the other box
Now double
click on fileselector
Fileselector
 This will bring up a control panel into which you can type the
name of the .general file saved when using the data prompter
Executing the program
Select Execute Once
from the execute menu
Image output
 Running the
program will
produce an
isosurface
output
Interacting with the image
 Under
options
select the
view
control:
Select rotate under mode
Rotate the image
 Click and drag
on the image
with the mouse
to rotate
 It isn’t that
fast though
 Note the globe
is turned on by
selecting it in
the options
menu
Algorithms for 3d visualization
 A bit of background to the algorithms used in
3d visualization will explain why it is such a
computationally expensive process
 Look briefly at
 Isosurface rendering
 Playing with it in Opendx using the isosurface module
 Volume rendering methods
 Volume rendering is part of the Image module
Voxel data
 The analogy of a pixel in 2d is the voxel in 3d
 Field values are described at the vertices rather than in
the center
 Field values along the edges and internally can be
derived by a number of interpolation functions
Isosurface Extraction
 Which choose a fixed iso-
value
 Then need to extract out
the contour (surface in
3d) corresponding to this
value
 The marching cubes
algorithm is the most
common method
 Patent has recently expired
on this algorithm
1 2 3 4 3
2 7 8 6 2
3 7 9 7 3
1 3 6 6 3
0 1 1 3 2
Iso-value = 5
First step of Marching cubes
 Classify the voxel by the values at the vertices
 Each vertex is either
- outside the surface (> isovalue)
- inside the surface (<= isovalue)
8
Iso=7
8
8
5
5
10
10
10
Iso=9
=inside
=outside
Marching Cubes: Triangle Example
a
b
c
Example Triangle configurations
 These 15 base examples can be used to derive the 28=256 total configurations
Surface Rendering
 2d surfaces are rendered within a
3d space & object appears “solid”
 Data must be converted into
geometrical primitives such as
triangles for rendering
 This process may lead to
information being lost or
disguised
 Makes sense for objects with a
solid surface
Volume Rendering
 Entire volume can be rendered
providing interior information
 data is not explicitly hidden
 Spatial data is mapped to a volume
of RGBA values using a transfer
function
 This volume is rendered directly
using a variety of techniques
 Makes sense for objects with
complex interior structure and no
solid boundaries
Surface vs volume rendering
compared
Improving on the earlier visual program
Add these new
modules
Set the opacity of
the 1st color module
to 0.3, for the second
0.7
New image is a combination of a
surface and a volume rendering
 Surface has
a reduced
opacity so
we can see
through it
 Interior
volume is
shown using
different
colours for
different
field values
Volume render alone
Volume Rendering Pipeline
 Data volumes are used as input to the transfer function,
which produces a sample volume of colors and
opacities as output
 Sample volume is rendered to produce a final image
transfer
function
data
volume(s)
sample
volume
rendering final
image
FRGBA(data)
Transfer Functions (TF’s)
 Map data value to color and opacity
Human Tooth CT
a(f)
RGB(f)
f
RGB
Shading,
Compositing…
a
Gordon Kindlmann
Choosing transfer functions
 This is one of the black arts of visualization
 Need to know fundamental scales of variation in your
problem (linear? Logarithmic?)
 Opacity can’t be too high otherwise we can’t see
through
 If it’s too low we don’t perceive enough information
 Colours should be chosen in sympathy with the data
 Volume rendering generally doesn’t cope well with too
much high frequency data
Examples
f
a
f
a
f
a
f
a
Gordon Kindlmann
Cutting out high values
has no effect
Moving to a lower value of
f doesn’t help
Sharply peaked to high opacity
effectively gives a surface render
Linear increase places too much
weight on mid range
Ray casting: one rendering technique
 The sample volume must now be rendered
 Vast body of literature on different techniques
 Simplest idea is ray casting
(1) Send ensemble of rays through the system corresponding to
image pixels
(2) Interpolate values along each ray from grid
(3) Local gradient is calculated to estimate amount of light
reflected back to image
(4) Values are composited together from back to front
Image source: Wikipedia
Trilinear Interpolation
 What is the effect of interpolation on the volume rendered image? Could
choose nearest neighbour value, or linear interpolation
 Below is a comparison of nearest neighbour to trilinear
 The additional expense of the interpolation removes a significant amount of
noise in the final image
Nearest Neighbor Trilinear Interpolation
Michael Knapp
Multiple layers in volume rendering
 Example using a
tool called “vfleet”
 Rendering of gas
density in one of
my simulations
 Transfer function
has been chosen to
pick out three
surfaces
 “See through”
isosurfaces
 Exactly the same
as having multiple
opaque isosurfaces
Making movies
 Some toolkits (e.g. AVS) will make movies from a bunch of
frames (images) for you
 Opendx unfortunately doesn’t
 First step in making a movie manually is to create a series of
frames with a fixed naming convention
 e.g. frame.00001.gif, frame.00002.gif, frame.00003.gif
 From this series of frames a number of freely available tools will
compile them into a movie for you
 Most tools rely on some kind of UNIX script to do this
 I’ll give explicit details for the “makempeg” script
 This makes MPEG-1 standard movies which are lossless
 Fairly low compression ratio, but no bad rectangular artifacts
 Ideal for scientific viz.
Makempeg
 I will put this Unix driver script on the class website (if
you are interested)
 Rather dated now, but it works effectively
 You need two other packages
 Berkeley MPEG encoder (will also put on website)
 This is the program that creates (encodes) the movie from your
images
 Compile this code, will create the “mpeg” executable
 netpbm image manipulation tools (can be installed in Linux)
 Need by the makempeg script to convert images into the format used
by the MPEG encoder
 Place the makempeg script and mpeg executable in the
same directory as your frames of name xxxx.yyyyy.ext
Running makempeg
 Example command:
 makempeg –fs 1 –fe 10 –fi 1 –base test –ext gif
 Will make a movie
 Starting at frame 1 (-fs)
 Ending at frame 10 (-fe)
 Increments between frames is 1 (-fi)
 Name of files is test.????.gif
 -base = base name
 -ext = filename extension (could be jpg, tiff…)
 Script expects 4 digit number for each frame
 i.e. test.0001.gif test.0002.gif test.0003.gif
 Script will convert to the “YUV” format and then launch the encoder
 Quite quick – may be up to 2 minutes for a larger movie, much faster for
smaller
Example movie made with
makempeg
Summary
 Use the data prompter to create the description file for
Opendx data
 Construct visual programs quickly and easily by linking
modules together in the visual program editor
 Isosurface and volume rendering techniques are both
supported by Opendx
 Selecting suitable transfer functions is non-trivial and takes
time
 Lastly, movies can be made quickly and easily from a
series of frames using a large number of freely available
tools
 I’ve provided codes for one method on the website
Student presentations
 No lectures March 24th, 26th, 31st
April 2nd
Mike Hiland
Ashley Campbell
Glen Hodge
Masaki Uchida
April 7th
Michael Palmer
Nick Presse
Cristina Collicott

More Related Content

Similar to Computational Methods in Physics for Students

Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java ProgrammingKaty Allen
 
ee8220_project_W2013_v5
ee8220_project_W2013_v5ee8220_project_W2013_v5
ee8220_project_W2013_v5Farhad Gholami
 
Unite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platformsUnite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platformsナム-Nam Nguyễn
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingAnkur Nanda
 
Computer Graphics Part1
Computer Graphics Part1Computer Graphics Part1
Computer Graphics Part1qpqpqp
 
Minko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSLMinko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSLMinko3D
 
Mathematics in the Digital Age
Mathematics in the Digital AgeMathematics in the Digital Age
Mathematics in the Digital AgeReva Narasimhan
 
Image processing using matlab
Image processing using matlabImage processing using matlab
Image processing using matlabdedik dafiyanto
 
Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...IRJET Journal
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make YASHU40
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoonmochimedia
 
Computer application
Computer applicationComputer application
Computer applicationSudamRaut2
 
nlp dl 1.pdf
nlp dl 1.pdfnlp dl 1.pdf
nlp dl 1.pdfnyomans1
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlabAman Gupta
 
Introduction to Machine Vision
Introduction to Machine VisionIntroduction to Machine Vision
Introduction to Machine VisionNasir Jumani
 

Similar to Computational Methods in Physics for Students (20)

Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
 
ee8220_project_W2013_v5
ee8220_project_W2013_v5ee8220_project_W2013_v5
ee8220_project_W2013_v5
 
Image compression
Image compressionImage compression
Image compression
 
Unite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platformsUnite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platforms
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Image compression and jpeg
Image compression and jpegImage compression and jpeg
Image compression and jpeg
 
Computer Graphics Part1
Computer Graphics Part1Computer Graphics Part1
Computer Graphics Part1
 
Minko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSLMinko - Targeting Flash/Stage3D with C++ and GLSL
Minko - Targeting Flash/Stage3D with C++ and GLSL
 
Getting started with R
Getting started with RGetting started with R
Getting started with R
 
Mathematics in the Digital Age
Mathematics in the Digital AgeMathematics in the Digital Age
Mathematics in the Digital Age
 
Image processing using matlab
Image processing using matlabImage processing using matlab
Image processing using matlab
 
Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make
 
Matlab dip
Matlab dipMatlab dip
Matlab dip
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoon
 
Computer application
Computer applicationComputer application
Computer application
 
nlp dl 1.pdf
nlp dl 1.pdfnlp dl 1.pdf
nlp dl 1.pdf
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
Introduction to Machine Vision
Introduction to Machine VisionIntroduction to Machine Vision
Introduction to Machine Vision
 
DIP.pptx
DIP.pptxDIP.pptx
DIP.pptx
 

More from MaheshPatil527151

Solution Selling Principles Primer Content
Solution Selling Principles Primer ContentSolution Selling Principles Primer Content
Solution Selling Principles Primer ContentMaheshPatil527151
 
T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...
T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...
T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...MaheshPatil527151
 
2021-5-May-20-Fort-Bend-EDC-Presentation.pptx
2021-5-May-20-Fort-Bend-EDC-Presentation.pptx2021-5-May-20-Fort-Bend-EDC-Presentation.pptx
2021-5-May-20-Fort-Bend-EDC-Presentation.pptxMaheshPatil527151
 
185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptx
185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptx185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptx
185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptxMaheshPatil527151
 
GEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptx
GEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptxGEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptx
GEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptxMaheshPatil527151
 

More from MaheshPatil527151 (7)

Solution Selling Principles Primer Content
Solution Selling Principles Primer ContentSolution Selling Principles Primer Content
Solution Selling Principles Primer Content
 
03_AgilePM.pptx
03_AgilePM.pptx03_AgilePM.pptx
03_AgilePM.pptx
 
T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...
T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...
T4AIML004_Indecomm Global Services uses Amazon Textract for document processi...
 
2021-5-May-20-Fort-Bend-EDC-Presentation.pptx
2021-5-May-20-Fort-Bend-EDC-Presentation.pptx2021-5-May-20-Fort-Bend-EDC-Presentation.pptx
2021-5-May-20-Fort-Bend-EDC-Presentation.pptx
 
185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptx
185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptx185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptx
185_Info_Tech_Research_Group___2019_CIO_Trend_Report.pptx
 
Plan.pptx
Plan.pptxPlan.pptx
Plan.pptx
 
GEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptx
GEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptxGEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptx
GEDY126-MANAGEMENT-INFORMATION-SYSTEM-Dr.S.Saravanan.pptx
 

Recently uploaded

Book Sex Workers Available Pune Call Girls Yerwada 6297143586 Call Hot India...
Book Sex Workers Available Pune Call Girls Yerwada  6297143586 Call Hot India...Book Sex Workers Available Pune Call Girls Yerwada  6297143586 Call Hot India...
Book Sex Workers Available Pune Call Girls Yerwada 6297143586 Call Hot India...Call Girls in Nagpur High Profile
 
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /WhatsappsBeautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsappssapnasaifi408
 
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一zul5vf0pq
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...Pooja Nehwal
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样qaffana
 
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...nagunakhan
 
Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaDubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaUnited Arab Emirates
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一ga6c6bdl
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...Pooja Nehwal
 
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...nagunakhan
 
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...Pooja Nehwal
 
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | DelhiFULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhisoniya singh
 
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一ga6c6bdl
 
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...Call Girls in Nagpur High Profile
 
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Pooja Nehwal
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service NashikLow Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Book Sex Workers Available Pune Call Girls Yerwada 6297143586 Call Hot India...
Book Sex Workers Available Pune Call Girls Yerwada  6297143586 Call Hot India...Book Sex Workers Available Pune Call Girls Yerwada  6297143586 Call Hot India...
Book Sex Workers Available Pune Call Girls Yerwada 6297143586 Call Hot India...
 
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /WhatsappsBeautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
 
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
 
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
 
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
 
Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaDubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
 
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
 
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
 
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...
 
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | DelhiFULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
 
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
 
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
 
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service NashikLow Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
 

Computational Methods in Physics for Students

  • 1. Computational Methods in Physics PHYS 3437 Dr Rob Thacker Dept of Astronomy & Physics (MM-301C) thacker@ap.smu.ca
  • 2. Today’s Lecture  Visualization  More on Opendx  3d visualization methods  Isosurfaces  Volume rendering  Making movies  makempeg script & the Berkeley mpeg encoder  References:  Some overheads borrowed from a presentations by Tamara Munzner, Gordon Kindlmann
  • 3. Getting started with Opendx  Using Import Data is perhaps the simplest way to get started with Opendx  Selecting it will take you to the Data Prompter
  • 4. Data Prompter  The data prompter will create a .general file which the import module can read  We’ll look at importing gridded data  Will take many different types  Let’s look at the simplest – a regular grid
  • 5. Datafile description Using an engineering example in this case Once the data is described, use “save as” in the File menu to save the general description used by dx
  • 6. Simplest tool  Default viz option will allow you to see the data immediately  Ensure everything loaded in OK
  • 7. Note on Windows version  The windows version has problems with spaces in file names  Don’t save files with names such as  C:Programs and somethingmyfilesand so on  Helpful to set up an Opendx directory right at the top of the directory tree  e.g. C:Opendx  Also, the default viewer in the data prompter did not work for me  But could just be my laptop running out of memory  One of the drawbacks of Opendx is that it rapidly consumes memory  A workstation dedicated to visualization usually needs ~2 GB or more of memory  Will exploit multiple processors though – good news!  Everything else seems fine though, the VPE works without a problem
  • 8. Checking data  You can test that your loaded data is correct in a couple of ways  Try the test import button  Will give information about range and so forth  Examine the data directly with the browse data button  Lastly, go directly to the visualization system described on the previous page  Unfortunately, if something is wrong it won’t tell you much quantitative information about the problem
  • 9. Creating a program  The default visualization system is useful, but most of the time we’ll want to create our own programs  When we used the data prompter we saved a description of the file called fan.64_ascii in fan.general  We can load this into our own program  The next few overheads walk through a simple 3d visualization
  • 10. Creating the visualization program Open the program editor and expand the ALL listing of modules, place fileselector, import, isosurface, image Link by left clicking on tab and then drawing a line to the other box Now double click on fileselector
  • 11. Fileselector  This will bring up a control panel into which you can type the name of the .general file saved when using the data prompter
  • 12. Executing the program Select Execute Once from the execute menu
  • 13. Image output  Running the program will produce an isosurface output
  • 14. Interacting with the image  Under options select the view control: Select rotate under mode
  • 15. Rotate the image  Click and drag on the image with the mouse to rotate  It isn’t that fast though  Note the globe is turned on by selecting it in the options menu
  • 16. Algorithms for 3d visualization  A bit of background to the algorithms used in 3d visualization will explain why it is such a computationally expensive process  Look briefly at  Isosurface rendering  Playing with it in Opendx using the isosurface module  Volume rendering methods  Volume rendering is part of the Image module
  • 17. Voxel data  The analogy of a pixel in 2d is the voxel in 3d  Field values are described at the vertices rather than in the center  Field values along the edges and internally can be derived by a number of interpolation functions
  • 18. Isosurface Extraction  Which choose a fixed iso- value  Then need to extract out the contour (surface in 3d) corresponding to this value  The marching cubes algorithm is the most common method  Patent has recently expired on this algorithm 1 2 3 4 3 2 7 8 6 2 3 7 9 7 3 1 3 6 6 3 0 1 1 3 2 Iso-value = 5
  • 19. First step of Marching cubes  Classify the voxel by the values at the vertices  Each vertex is either - outside the surface (> isovalue) - inside the surface (<= isovalue) 8 Iso=7 8 8 5 5 10 10 10 Iso=9 =inside =outside
  • 20. Marching Cubes: Triangle Example a b c
  • 21. Example Triangle configurations  These 15 base examples can be used to derive the 28=256 total configurations
  • 22. Surface Rendering  2d surfaces are rendered within a 3d space & object appears “solid”  Data must be converted into geometrical primitives such as triangles for rendering  This process may lead to information being lost or disguised  Makes sense for objects with a solid surface Volume Rendering  Entire volume can be rendered providing interior information  data is not explicitly hidden  Spatial data is mapped to a volume of RGBA values using a transfer function  This volume is rendered directly using a variety of techniques  Makes sense for objects with complex interior structure and no solid boundaries Surface vs volume rendering compared
  • 23. Improving on the earlier visual program Add these new modules Set the opacity of the 1st color module to 0.3, for the second 0.7
  • 24. New image is a combination of a surface and a volume rendering  Surface has a reduced opacity so we can see through it  Interior volume is shown using different colours for different field values
  • 26. Volume Rendering Pipeline  Data volumes are used as input to the transfer function, which produces a sample volume of colors and opacities as output  Sample volume is rendered to produce a final image transfer function data volume(s) sample volume rendering final image FRGBA(data)
  • 27. Transfer Functions (TF’s)  Map data value to color and opacity Human Tooth CT a(f) RGB(f) f RGB Shading, Compositing… a Gordon Kindlmann
  • 28. Choosing transfer functions  This is one of the black arts of visualization  Need to know fundamental scales of variation in your problem (linear? Logarithmic?)  Opacity can’t be too high otherwise we can’t see through  If it’s too low we don’t perceive enough information  Colours should be chosen in sympathy with the data  Volume rendering generally doesn’t cope well with too much high frequency data
  • 29. Examples f a f a f a f a Gordon Kindlmann Cutting out high values has no effect Moving to a lower value of f doesn’t help Sharply peaked to high opacity effectively gives a surface render Linear increase places too much weight on mid range
  • 30. Ray casting: one rendering technique  The sample volume must now be rendered  Vast body of literature on different techniques  Simplest idea is ray casting (1) Send ensemble of rays through the system corresponding to image pixels (2) Interpolate values along each ray from grid (3) Local gradient is calculated to estimate amount of light reflected back to image (4) Values are composited together from back to front Image source: Wikipedia
  • 31. Trilinear Interpolation  What is the effect of interpolation on the volume rendered image? Could choose nearest neighbour value, or linear interpolation  Below is a comparison of nearest neighbour to trilinear  The additional expense of the interpolation removes a significant amount of noise in the final image Nearest Neighbor Trilinear Interpolation Michael Knapp
  • 32. Multiple layers in volume rendering  Example using a tool called “vfleet”  Rendering of gas density in one of my simulations  Transfer function has been chosen to pick out three surfaces  “See through” isosurfaces  Exactly the same as having multiple opaque isosurfaces
  • 33. Making movies  Some toolkits (e.g. AVS) will make movies from a bunch of frames (images) for you  Opendx unfortunately doesn’t  First step in making a movie manually is to create a series of frames with a fixed naming convention  e.g. frame.00001.gif, frame.00002.gif, frame.00003.gif  From this series of frames a number of freely available tools will compile them into a movie for you  Most tools rely on some kind of UNIX script to do this  I’ll give explicit details for the “makempeg” script  This makes MPEG-1 standard movies which are lossless  Fairly low compression ratio, but no bad rectangular artifacts  Ideal for scientific viz.
  • 34. Makempeg  I will put this Unix driver script on the class website (if you are interested)  Rather dated now, but it works effectively  You need two other packages  Berkeley MPEG encoder (will also put on website)  This is the program that creates (encodes) the movie from your images  Compile this code, will create the “mpeg” executable  netpbm image manipulation tools (can be installed in Linux)  Need by the makempeg script to convert images into the format used by the MPEG encoder  Place the makempeg script and mpeg executable in the same directory as your frames of name xxxx.yyyyy.ext
  • 35. Running makempeg  Example command:  makempeg –fs 1 –fe 10 –fi 1 –base test –ext gif  Will make a movie  Starting at frame 1 (-fs)  Ending at frame 10 (-fe)  Increments between frames is 1 (-fi)  Name of files is test.????.gif  -base = base name  -ext = filename extension (could be jpg, tiff…)  Script expects 4 digit number for each frame  i.e. test.0001.gif test.0002.gif test.0003.gif  Script will convert to the “YUV” format and then launch the encoder  Quite quick – may be up to 2 minutes for a larger movie, much faster for smaller
  • 36. Example movie made with makempeg
  • 37. Summary  Use the data prompter to create the description file for Opendx data  Construct visual programs quickly and easily by linking modules together in the visual program editor  Isosurface and volume rendering techniques are both supported by Opendx  Selecting suitable transfer functions is non-trivial and takes time  Lastly, movies can be made quickly and easily from a series of frames using a large number of freely available tools  I’ve provided codes for one method on the website
  • 38. Student presentations  No lectures March 24th, 26th, 31st April 2nd Mike Hiland Ashley Campbell Glen Hodge Masaki Uchida April 7th Michael Palmer Nick Presse Cristina Collicott