Displaz.jl - OpenGL display of large point clouds (and other geometry)

680 views
Skip to first unread message

Chris Foster

unread,
Mar 15, 2014, 1:17:46 PM3/15/14
to juli...@googlegroups.com
Hi all,

I've been working on a project - https://github.com/c42f/displaz - for the
interactive display of large point clouds - on the order of 1e8 points and
upward.

Originally displaz was focussed on displaying point clouds as generated
from lidar scans, stemming from my utter frustration with matlab's 3D
graphics. It's now slowly morphing into a generic 3D display system for
technical computing. Displaz is primarily written in C++ / Qt, but I'm
particularly interested in interfacing with technical computing
environments. I've just completed a first cut of some naive julia
bindings, and will probably follow these up with bindings for matlab and
numpy.

I've not seen much discussion of interactive 3D display here on the julia
list (until today!), so I hoped displaz might fill a hole in existing
functionality.
Obviously the GSoC discussion around 3D is relevant, so I figured
I'd better announce what I'm working on so we can collaborate if possible -
it would be great to pool efforts :-)


<rant>

I've been pretty disappointed by the state of interactive 3D graphics in
technical computing languages. *Especially* when it comes to displaying
lots of data interactively. For example, a modern computer with a
resonable graphics card should probably be able to display 1e9 points, but
with matlab you get barely 1e6 before it becomes unbearably laggy! On the
python side, matplotlib (which I very much respect btw), seems to be
squarely in the "publication quality graphics" camp rather than the "please
draw large amounts of geometry interactively" camp and IIRC isn't much
better in this regard. There's various solutions which I'm no doubt
woefully underinformed about, but when I looked a couple of years ago
my impression was that most of them were rigid frameworks around legacy
OpenGL, which is a lot less flexible than what we have available today.

I started in graphics with the aqsis renderer project - now sadly obsolete,
more or less - which implements the Pixar RenderMan API. The RenderMan
approach of giving geometry arbitrary scalar/vector fields and making these
available in shaders is extremely powerful, and IMHO sadly underappreciated
in the technical computing world. Lucikly modern OpenGL makes such
functionality quite accessible without needing to write and maintain a
whole shader compiler toolchain yourself. If only someone would do the
work to hide the low level details of the OpenGL API, put a flexible GUI
around it and write a nice API so that everyone can work in their favourite
technical computing language. That's roughly what I've been hoping to do
with displaz.

</rant>


Anyway, there's a whole heap to say about what graphics APIs and the
best architecture for the job; I won't say it all here though since I want
to just get this out there for now. Some quick notes:

* The displaz architecture is an out of process socket-based solution based
on message passing. Reasons to do this:

- It gives a stable interface to accumulate results between batch runs,
(and even between code written in disparate programming languages).

- Decoupling forces you to think carefully about the API, and makes the
different pieces reusable. A displaz desktop backend should be just as
usable from python, matlab and R as it is from julia. Not that I'm
claiming such a well thought through API is in place yet!

- It works for you cool kids who want to use the browser for everything:
just implement an alternative backend in javascript + WebGL.

People often try to embed the language into the display tool or embed the
display tool in the language. Both options are tempting but I think
they're mistakes because they limit the reusability of the system in the
absence of really good language interoperability. (Granted, julia is
/significantly/ better at language interop than any other language I've
ever come across.)


Quckstart guide:
---------------------

In case anyone actually wants to try it out, here's some quick instructions.

The external interface is brand new, so you'll need to compile the latest
source code. It should compile quite easily on linux.


Dependencies:
-------------

* cmake >= 2.8
* Qt >= 4.7 (not Qt >= 5.0 at this stage)
* GLEW >= 1.5.2 (or so)
* Python docutils (optional - required to build the html documentation)


Compile on linux:
-----------------

git clone https://github.com/c42f/displaz.git displaz

cd displaz
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=dist
-DQT_QMAKE_EXECUTABLE:PATH=/usr/bin/qmake-qt4 -DDISPLAZ_USE_LAS=OFF ..
make -j4

make install


Julia usage:
------------

Example plot of 1e7 points:

cd displaz/bindings/julia
julia

julia> using Displaz
julia> t = linspace(0,1, 10_000_000);
julia> P = (10.+0.2*rand(size(t))).*[exp(5*t).*cos(100*pi*t)
exp(5*t).*sin(100*pi*t) 100*t];
julia> C = [t (1 .- t) zeros(t)];
julia> plot(P; color=C)

The displaz window should pop up and the points load. Middle clicking
focusses on a vertex; right clicking zooms, and a left click rotates.
The shaders are fully editable (type shift+return to compile and run them),
and GUI controls for shader uniforms can be created on the fly by inserting
some very lightweight markup into the shader itself.


Cheers,
~Chris

Chris Foster

unread,
Mar 15, 2014, 1:30:34 PM3/15/14
to juli...@googlegroups.com
> cmake -DCMAKE_INSTALL_PREFIX:PATH=dist -DQT_QMAKE_EXECUTABLE:PATH=/usr/bin/qmake-qt4 -DDISPLAZ_USE_LAS=OFF ..

Hold on, that's got some system-specific stuff in it. It should probably be

cmake -DCMAKE_INSTALL_PREFIX:PATH=dist -DDISPLAZ_USE_LAS=OFF ..

Pardon any other minor mistakes, it's been a *long* night of hacking :)

~Chris

Tim Holy

unread,
Mar 15, 2014, 2:09:07 PM3/15/14
to juli...@googlegroups.com
I'm quite jazzed to see people tackling plotting with OpenGL! Definitely an
area of major interest.

--Tim
Reply all
Reply to author
Forward
0 new messages