Hi,

As some may have seen already, Avogadro 2 has a Van der Waals spheres
display type with Ambient Occlusion. However, this is not nicely integrated
with the overall rendering code and this mail contains information on how I
plan to integrate this. I'm currently moving so I plan to start working on
this in january.

The current technique is briefly outlined below:

1) Ambient Occlusion (using textures)
* needs UV or other texture mapping for occluded geometry
* occluding geometry does not need this mapping (allows for mixed approach)
* texture stores visibility from all angles (uniformly sampled in
pre-processing step)

algorithm for "baking" occlusion maps:
for all viewing directions:
    render occluding geometry (depth map stored in texture)
    render to occlusion texture (lookup visibility in depth map)
        add 1 / n_sample_dirs if pixel is visible from current viewing
direction


Moving this code to the GLRenderer class should not be difficult. However,
for ambient occlusion to work on all geometry we would need UV texture
mapping for meshes. For protein and nucleic acid meshes this could easily
be generated together with the mesh but I don't have a solution yet for
handling surface meshes resulting from the marching cubes algorithm.

Another technique is Screen Space Ambient Occlusion.

2) Screen Space Ambient Occlusion
* post-processing step
* samples depth map to compute occlusion
* from wikipedia: "Rather local and in many cases view-dependent, as it is
dependent on adjacent texel depths which may be generated by any geometry
whatsoever."

In short, I don't think SSAO is very useful for avogadro.


Below are the concrete steps I plan to implement:
* ambient occlusion will become global feature (on/off)
* enable GLRenderer to render depth map to texture
* add new rendering pass for depth only (same as opaque, but no lighting
calculations required)
* add support for post-processing steps on rendered image (for SSAO, also
useful for bluring, etc.)
* add UV-mapping for SphereGeometry and CylinderGeometry
* experiment with various methods to unwrap surfaces to 2D textures (this
is the most difficult part and suggestions are welcome)

references:
http://en.wikipedia.org/wiki/Ambient_occlusion
http://en.wikipedia.org/wiki/Screen_space_ambient_occlusion

Tim
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel

Reply via email to