ambient occlusion and edge cueing for enhancing real time molecular visualization marco tarini,...
TRANSCRIPT
Ambient Occlusion and Edge Cueing for enhancing Real Time Molecular Visualization
Marco Tarini, Paolo Cignoni, Claudio Montani
2
Background:Molecular Graphics
The discipline and philosophy of studying molecules and their properties through graphical representations
Stereotypical Scientific Visualization task• 3D shape Molecule functionality
Long story• Long bibliography• Many established techniques and principles
[ Capstone after lunch by Jane Richardson! ]
image courtesy of Accelrys
Hemagglutinin
image courtesy of Riumplus
3
Background:Molecular Graphics
Many 3D Metaphors: Ball and Sticks "Licorice" modes Space Fill (CPK)
Solvent Excluded Surfaces (Connolly's) Various kind of isosurfaces
• (electron density, potential...)
Higher level abstractions: • e.g. ribbons
images(animations,
stereo images...)
insight,
understanding
3D
molecular
structure
3D represen-
tation(s)
modelling rendering
4
Background:Molecular Graphics
insight,
understanding
images(animations,
stereo images...)
Problems:
Readability:• Unfamiliar, awkward 3D structures• Hard to understand 3D shapes (spatial relationships, etc)
Efficiency:• Geometric complexity (need for real time)
(e.g. for very large proteins)
3D
molecular
structure
3D represen-
tation(s)
modelling rendering
5
Background:Molecular Graphics
insight,
understanding
images(animations,
stereo images...)
The content of this talk:
Advanced rendering techniques can be of great help here!
Advanced rendering techniques can be adapted to the specific case of molecular rendering
3D
molecular
structure
3D represen-
tation(s)
modelling rendering
6
The rest of this talk:ad-hoc Advanced Rendering Techniques
Impostors for spheres, cylindersAmbient occlusion (for impostors)
Depth aware borders (for impostors)Localized depth cueing effect (for impostors)
7
Impostor based rendering
For each primitive (sphere or cylinder): render a screen-oriented impostor quad
• per vertex:• displace vertex in screen space• preprocess all common sub-expressions
• for each fragment:• test membership (discard outliers fragments)• compute
– z – normal – lighting– texture coords (as we will see)
8
The rest of this talk:ad-hoc Advanced Rendering Techniques
Impostors for spheres, cylindersAmbient occlusion (for impostors)
Depth aware borders (for impostors)Localized depth cueing effect (for impostors)
9
Ambient Occlusion Global lighting technique
• Approximation of global illumination Concept:
• light each point p with normal np
with the irradiance I(p) (quantity of light directly reaching p from any direction)
dnLpI p
)()()(
in our case, L is:
k (a constant) if p visible from ω,
0 if p shadowed Effect:
• “lighted by daylight under a cloudy sky”:
10
Ambient Occlusion:why
Known to conceive realism (but, we don’t care)
Local lighting Ambient Occlusion
11
Ambient Occlusion:why
Known to conceive 3D shape understanding• perceptual study in [Langer & Bulthoff, TechRep 99]
Especially in our case (molecules)• large scale structures composed by multitudes of tiny shapes
→ normals ≈ noise
• see also: particle systems by [Bigler etAl. VCGT06]
12
Ambient Occlusion:why
Local lighting Ambient Occlusion
13
Ambient Occlusion:how
Store computed Irradiance of each point on molecule surface• (fast precomputation)
use it during rendering
PROBLEM: where do we store it?• use a texture…• for impostors!
14
Texturing the molecule
A B
DCG H
FE
A
B
C
D
x,y,z gnomicprojection
unfolding
y,z gnomicprojection
unfolding
x,y,z object space u,v texture space
[Praun and
Hoppe. TG03]
15
Texturing the molecule
A B
DCG H
FE
A
B
C
D
x,y,z object space u,v texture space
16
Texturing the molecule
A B
DCG H
FE
ABCD
x,y,z object space u,v texture space
texel replicationsbilinear filetering
17
Texturing the molecule
Global Texture for the molecule:
one texture patch for each:• atom (sphere) or• bond (cylinder)
in the scene
pack together all texture patches
(trivial)
ATOM1
BOND1
ATOM2
ATOM3
ATOM4
BOND2
ATOM5
ATOM6
ATOM7
BOND4
BOND2
BOND5
BOND6
BOND7
ATOM8
BOND8
ATOM9
ATOM10
ATOM11
BOND9
BOND10
BOND11
ATOM12
u
v
(unused)
18
Texturing the moleculeFor example:
small molecule:• ~80 patches
• ~40 atoms• ~40 bonds
• texture size: 512x512 texels• patch size: 50x50 texels
large molecule:• 120.000+ patches
• 60.000+ atoms• 60.000+ bonds
• texture size: 2048x2048 texels• patch size: 6x6 texels
u
v
IRRADIANCEMAP
19
Computing irradiance map on the GPU Get N directions w1..N sampling the unit sphere
For each i in (1..N) :1. render new depth-map
from view direction wi
2. render over irradiance-map: for each patch:
for each fragment (texel) f :1. invert (u,v) map
get pos p, normal np
2. project p over depth-map& check visibility (compare depths)
3. if visibile, accumulate light K(np∙wi) (if >0)
at f (with alpha blending)
project
depth-map wi
irradiance-map
20
Computing irradiance map on the GPU Get N directions w1..N sampling the unit sphere
For each i in (1..N) :1. render new depth-map
from view direction wi
2. render over irradiance-map: for each patch:
for each fragment (texel) f :1. invert (u,v) map
get pos p, normal np
2. project p over depth-map& check visibility (compare depths)
3. if visibile, accumulate light K(np∙wi) (if >0)
at f (with alpha blending)
depth-map wi
irradiance-map
Renderflat impostors!- mid z (better result)- no z-displacing (much faster)
21
Computing irradiance map on the GPU Get N directions w1..N sampling the unit sphere
For each i in (1..N) :1. render 2 new depth-map
from view directions wi & -wi
2. render over irradiance-map: for each patch:
for each fragment (texel) f :1. invert (u,v) map
get pos p, normal np
2. project p over depth-map& check visibility (compare depths)
3. if visibile, accumulate light K(np∙wi) (if >0)
at f (with alpha blending)
depth-map wi
irradiance-map
depth-map -wi
22
The rest of this talk:ad-hoc Advanced Rendering Techniques
Impostors for spheres, cylindersAmbient occlusion (for impostors)
Depth aware borders (for impostors)Localized depth cueing effect (for impostors)
23
Depth aware borders
Example• See demo
24
Depth aware borders:how
Single pass technique!
A
depth
impo
stor C
B
25
Depth aware borders:how
Single pass technique!
A
depth
impo
stor C
B
26
Depth aware borders:how
Single pass technique!
A
depth
impo
stor C
B
27
Depth aware borders:how
Single pass technique!
A
depth
impo
stor C
B
28
The rest of this talk:ad-hoc Advanced Rendering Techniques
Impostors for spheres, cylindersAmbient occlusion (for impostors)
Depth aware borders (for impostors)Localized depth cueing effect (for impostors)
29
Localized depth cueing (“halos”)Depth cueing (“fog”) common technique to visually separate far from near BUT:
1. far parts lose contrast (global loss of contrast)
2. cannot discriminate between too many planes
Our alternative: localized depth cueing (“halos”) like fog, but concentrate effects near depth jumps!
Similar to: [T.Luft, C.Colditz, O.Deussen. SIGGRAPH 2006] (parallel result)
See Demo!
Dal
ì
Pic
asso
Seu
ret
Mat
isse
30
Localized depth cueing (“halos”)
First pass:• render geometry and depth buffer
Second pass: (alpha blended)
• render coronas around each atom• choose alpha according to
• screen distance to atom• distance of current fragment depth
from destination depth
31
Putting all together
Combining:• Impostors for spheres, cylinders.• Ambient occlusion (for impostors)
• Depth aware borders (for impostors)• Localized depth cueing effect (for impostors)
with standard techniques• Direct light (Lambertian + Phong)
• Cast shadow• Standard depth cueing (fog)
• Toon shading (for illustrative renderings)
• Antialiasing (render to 2x, resample to screen)
32
Implementation
OpenSource project win installer unix, mac versions coming up reads PDB files exports hi res. images
(e.g. for print publications)
…and small animations (e.g. for web sites, presentations)
Just Google for
GIF animation