Code Monkey home page Code Monkey logo

visilib's Introduction

Visilib Overview

The Visilib project aims to provide an efficient and robust library for exact visibility computation in 3D.

Given a set of polygonal geometries that are treated as occluders, the library allows to determine if two primitives called sources are mutually visible. In case of mutual visibility, Visilib optionally computes the set of lines stabbing the two primitives, providing a complete description of the mutual visibility information.

The from-region visibility computations are computed in an exact way, without making any simplification.

The core algorithm is based on CSG (Constructive Solid Geometry) operations in a 5D projective space called Pücker space. If you are interested in implementation detail please refer to this technical paper describing the core algorithm. However, since this publication the library has been completely rewritten and benefits from several improvements (see Features).

Visilib is written in C++, it is cross-platform and distributed as a header only library.

Features

  • From-region visibility computations are exact: contrary to conservative or aggressive visibility methods, the Visilib library does not make any assumption and performs the complete penumbra fusion of the occluders
  • Visibility performed via CSG (Constructive Solid Geometry) operations in Plücker space:
    • Polytope splitting algorithm using only skeleton of polytopes (vertices and edges)
    • Silhouette optimization algortihm reducing drastically the number of CSG operations
    • Guided aperture sampling and early termination: rays are casted in the visibility apertures left by the previously processed occluders, leading to early termination in case of mutual visibility
    • Occluder selection using already computed visibility information
    • Computational geometry predicates in Plücker space

NEW (since paper publication)

  • The source primitives that can be used are polygons, segments and points, allowing to perform polygon-to-polygon, polygon-to-segment, polygon-to-point, and point-to-segment visibility query
  • Optimal minimum polytope building algorithm in Plucker space (as described in Charneau et al.),
  • Robust arithmetic computation based on CGAL and Leda libraries (multiple precision arithmetic combined with interval arithmetic computations)
  • Fast ray tracing based on Intel Embree library
  • Easy to deploy: header-only library
  • Filtering of small polytopes (next release)
  • Early stop or complete skeleton extraction
  • Watertight ray-triangle intersection
  • Pre-filtering of useless CGS splits
  • Output sensitive occluder selection using optimized convex hull construction
  • Lazy on-demand computation of occluders of silhouettes
  • Representative line sampling computation correction

Applications

  • Potentially Visible Set computation (PVS)
  • Sound propagation (edge diffraction)
  • Shadow and lighting computation

Dependencies

The only mandatory dependency is CMake used for cross-platform compilation.

The following dependencies are optional:

We also use Doxygen for documentation generation.

Unit tests

Visilib is partially unit tested, using the CMake framework. The implementation of the unit test is provided in the /test/src/ folder. The name of executable to run the unit tests is visilibTest.

How do I get set up?

  • Summary of set up

LINUX

#install required dependency
sudo apt-get install freeglut3-dev
sudo apt-get install cmake

#clone repository
git clone https://github.com/dhaumont/visilib.git

#configure 
cd visilib
source configure.sh

#build
cd build
make -j10

#Launch demo
demo/visilibDemo 

WINDOWS

Visilib License

Visilib is GNU GPL v3 licensed.

If you use Visilib in a publication, please refer to the project homepage (https://github.com/dhaumont/visilib) and cite the following paper:

@inproceedings{
  title     = {A Low Dimensional Framework for Exact Polygon-to-Polygon Occlusion Queries},
  author    = {Denis Haumont and
               Otso Makinen and
               Shaun Nirenstein}, 
  booktitle = {Proceedings of the Eurographics Symposium on Rendering Techniques,
               Konstanz, Germany, June 29 - July 1, 2005},
  pages     = {211--222},
  publisher = {Eurographics Association},
  year      = {2005}
}

Interactive Demo

visilibDemo is an interactive demo application provided with visilib library.

It allows to test the different library options interactively, by pressing the following keys:

Key Usage Description
f enable/disable detect aperture only When activated, the visibility computation stops as soon as the two sources are proven to be mutually visible. Otherwise, the computation continues until the complete visibility information has been computed
s enable/disable silhouette optimisation When activated, only the potential silhouette edges of the occluders wrt the source polygons are considered for CSG operations
n enable/disable hypersphere nomalization When activated, all the Plücker points are projected onto an unit hypersphere, in order to reduce numerical errors
r enable/disable representative line sampling strategy
f enable/disable fast silhouette rejection test
+ increase source size Increase the size of the source polygons
- decrease source size Decrease the size of the source polygons
1 decrease source vertex count Decrease the number of vertices of the first source polygon
2 increase source vertex count Increase the number of vertices of the first source polygon
w write config
o open config
space start/pause sources animation When animation is started, the source polygons will perform a rotation around the scene
Enter show/hide geometry For debugging purpose, allow to change the representation of the scene and of the query polygons
h display help Display the list of keys and their effect

Acknowledgements

We would like to thanks the following persons for their contribution to this library:

  • Otso Mäkinen for the silhouette computation implementation
  • Shaun Nirenstein for all the technical discussions
  • Eric Lengyel for the polygon clipping algorithm
  • Joseph O'Rourke and Cédric Laugerotte for the convex hull implementation
  • Sven Woop et al. for the watertight triangle intersection code
  • Bajaj and Patucci for the interpolation algorithm code
  • David Eberly for the AABB to ray intersection code
  • Jiry Bittner for the Plücker point anchor computation
  • Meshlab team for the obj reader code

We used several useful libraries and tools to implement Visilib (see Dependencies). We would like to especially thank their authors for their great work and publishing the code.

Who do I talk to?

For any question about this library, please contact Denis Haumont.

visilib's People

Contributors

dhaumont avatar kannoneer avatar ramcdona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

visilib's Issues

License question

Thanks for making Visilib available as open source and for all your work.

I am interested in calling Visilib from my program. While my program is open source, it is not GPL, and so it is not compatible with Visilib.

From what I can see so far, there are very few object-space 3D visibility libraries available -- do you know of any others?

I know Visilib uses CGAL (parts are GPL only, other parts are more permissive) and some other dependencies that may make changing licenses impossible. However, if it is possible, I would encourage you to consider that changing Visilib's license to LGPL would allow its use by more projects (open source and otherwise).

Crashes in demo

Demo crashes after scene changes.

Steps to reproduce:

  1. run visiblibDemo
  2. press 'x' seven times

Result:

Overflow detected: more than 200 recursive calls....
visilibDemo: /home/user/dev/foss/visilib/demo/../visilib/visibility_aperture_finder.h:104: visilib::VisibilityResult visilib::VisibilityApertureFinder<P, S>::resolveInternal(visilib::PluckerPolytope<P>*, const string&, const std::vector<visilib::Silhouette*>&, const std::vector<_Tp>&, int) [with P = visilib::MathPlucker6<double>; S = double; std::string = std::__cxx11::basic_string<char>]: Assertion `0' failed.
Aborted (core dumped)

System:

$ g++ --version
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

LEDA is unavailable

First of all, thanks for sharing this amazing piece of software. But I'm having problems compiling with exact arithmetic support because LEDA library is not available anymore.

The website at http://www.algorithmic-solutions.info/free/d5.php says

LEDA FREE EDITION IS NO LONGER DISTRIBUTED!

Is there any workaround for this? I can build and run the demo without exact arithmetic support though.

Occlusion errors in the second demo scene

Platform:
Win10, Visual Studio 2022, x64 build (debug and release), without exact arithmetic libraries

To reproduce:
Launch visilibDemo.exe, press X to skip to the second demo: Two triangles and a large mesh.
The initial view is correct. Press "Space" to enable animation. I'm observing three cases:

  • correct case where stablines only pass through the empty space
  • inverse case where stablines pass only though the occluding polygon
  • stablines pass through both the empty space and the occluding polygon

Is that a bug, or a side-effect of non-exact arithmetic?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.