Open-Source Viewpoint Computation Library [new DEMO]

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Open-Source Viewpoint Computation Library [new DEMO]

Post by robran »

Hi all,

this post is to showcase a new viewpoint computation library which we have just open sourced. What can it do?

Basically, it can compute the best viewpoint in a 3D scene that satisfies a set of visual properties, such as size, visibility or angle of selected objects in the scene. For example, say you have a scene like the following one:
building.jpeg
building.jpeg (155.63 KiB) Viewed 4680 times
and you would like a viewpoint that shows one of the computers in the rooms, say the one in the bottom left room. Let's suppose that "monitor", "keyboard", and "mouse" are the scene entities' names of that computer pieces. You then create a set of properties like:
  • monitor: should be entirely visible from the viewpoint
    monitor: should be not occluded by other objects
    monitor: should be rendered at a certain minimum size
and similarly for the other entities. The library will then compute a viewpoint satisfying those properties, such as:
computer.jpeg
computer.jpeg (143.01 KiB) Viewed 4680 times
The available properties include objects's size, angle, occlusion, and position in the image rendered from the viewpoint (also relative position of two objects, e.g. one at the right of another).

Although the library is not Ogre-specific, it comes with an Ogre interface that reads the Ogre scene graph to know about objects and their position.

The library is available at https://bitbucket.org/rranon/smart-view ... tation-lib and, besides source code, there is a binary demo for Win and Mac.
Last edited by robran on Thu Apr 18, 2013 10:49 am, edited 2 times in total.
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: New Viewpoint Computation Library

Post by TheSHEEEP »

That looks pretty useful, indeed :D

Does it have a big overhead or is it only "calculating" when a certain condition is requested (like your example with the monitor)?
My site! - Have a look :)
Also on Twitter - extra fluffy
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Re: New Viewpoint Computation Library

Post by robran »

The library constructs a Bullet collision world of the scene (which can be done at loading time), which needs to be updated if objects move or are added.

Besides that, no overhead. When you request a viewpoint, calculation starts, and you can set the time available to viewpoint search. The viewpoint showing the computer was found using a 20 milliseconds time budget. It depends on the spatial complexity of the scene, the number of properties, ... in general, solution quality increases with time.
Last edited by robran on Thu Mar 07, 2013 3:18 pm, edited 1 time in total.
User avatar
areay
Bugbear
Posts: 819
Joined: Wed May 05, 2010 4:59 am
Location: Auckland, NZ
x 69

Re: New Viewpoint Computation Library

Post by areay »

Good work! I bet you could do some really nice things with this, for example, if you wanted to setup dynamic Ogre::AnimationTrack's with keyframes that included certain scene viewpoints along the way.

Could it return a camera orientation from a fixed position? Ie. give me a camera rotation that I can apply to a camera scenenode (but don't intend to re-position).
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Re: New Viewpoint Computation Library

Post by robran »

In the library, a viewpoint is represented by 8 parameters:
  • 3 for position
    3 for look-at-point
    1 for roll
    1 for FOV
You can set allowed ranges for any of them, including e.g. fixing position (or even just y position). So yes, you could also just compute
orientation from a fixed position.
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Re: Open-Source Viewpoint Computation Library

Post by robran »

I've added a new demo of the library, whose binaries can be downloaded at http://bitbucket.org/rranon/smart-viewp ... /downloads.

The demo application can load any .scene file, and browse through all the entities, one at a time, by finding, for each entity, a viewpoint that shows it prominently on screen, and as much as possible with with no parts hidden by other objects. It can also do that automatically for each entity and save the results in a png file. For example, for the scene in the first post in this thread, it will save 201 images, which, if tiled together, will give the following image:

Image

Give it a try!
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by jacmoe »

The only negative I can come up with is the license. :)
It seems like an extremely useful library,
Did you consider licensing it under the Apache license?
That's a very popular license for companies/entities because it is basically BSD style license with legal disclaimers (IIRC).

The reason why I choose to mention the license is because this library is more like an utility library than it is stand-alone.

Oh, and what I really wanted to say (otherwise): extremely useful library! :D
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by jacmoe »

The reason why I'd be much more interested in using it with a more permissive license is because then it would be much easier to create an automatic viewpoint generator from a connected series of waypoints in a scene in a scene editor like Ogitor.
That could be used to create animations for interactive 'routes', for cut-scenes, etc.
LGPL forces me to first build your library, then build my plugin library, and then - finally - link the two with the editor and remember to have both shared libraries in the run path when executing them.


I might use it anyway, but why should I not ask when I've got the chance! :)

I didn't mean to whine about anything, though.
I just couldn't keep my mouth shut. :lol:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by robran »

Hi Jacmoe,

the reason for the LGPL license is that I would like people that make modifications to the library to share them back - but I am not a big expert in this area and I will think about your suggestion.

Using the library inside a scene editor came also to my mind - in fact we already did that :)

More specifically, we used an earlier version of the library to generate viewpoints of artworks in a virtual museum editor (http://www.ogre3d.org/forums/viewtopic. ... 31&start=0). The editor user could then graphically connect the
viewpoints to create interactive walkthroughs. If you are interested, this paper

http://hcilab.uniud.it/publications/2010-04.html

describes quite in detail how we did that.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by jacmoe »

Steve 'Sinbad' Streeting - the founder of Ogre3D - came to the conclusion, when he considered relicensing the project from LGPL to MIT, that people will contribute (or not) no matter what the license is. :)
LGPL is not a guarantee that people will make sure that their changes gets merged into upstream

What really makes people contribute is mainly because they want to have their modifications/fixes/additions in the main repository so that they don't have to reapply their patches each time they upgrade.
That is the reason.
Not because of the license.
People contribute because they like the project and are using it actively.

I don't think Ogre gets less code contributions than it did before when it was LGPL'ed.
However, I do think that more corporate people are using Ogre now that it is under a permissive non-copyleft license.

So to have more users, it would make sense to pick a license which is as permissive as possible. I think Apache would fit well if you're the lawyer type and still want a permissive license.
Otherwise it would be MIT or BSD, or Zlib.

It's up to you to decide, but I think one ought to put some thought into the choice of a license. Especially if you intend to be 'conquering the world' :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by vitefalcon »

I would like to expand a bit more about the licensing point. Basically, having it as LGPL also poses the following problem. Consider that a company (open-source/commercial/indie) would like to use your library as-is, but they have linked to Ogre3D statically, they would not be able to dynamically link to your library because the dynamically linked library would require Ogre DLL's (or .SO) and poses a problem to the end-user, because all the Ogre instances the DLL uses would be different from what the statically-linked Ogre application has, causing issues. It would be major overhaul for them to adopt your library and keep their commercially permissible application.

And just like what Jacmoe said, making it LGPL doesn't mean they would contribute back. In fact, anyone can sell your product without change, which applicable for even the stricter version of GPL! [1]. It is all about goodwill of faith.

Here is a story [2] about someone[3] stealing from GNU GPL licensed game server software, modifying it and selling it, after changing the header to give credit to the modifiers and not to the original authors. It's a real shame on them for doing so, but rAthena (the software owners) couldn't do anything against them legally. They couldn't even threaten them! I am not discouraging you from releasing your software as open-source. All I'm saying is that if you don't have any means to legally defend yourself, when someone violates your terms, it's of no use. It would be easier to release your software in a permissible license and have wider adoption and see good people contribute improvements back due the wide adoption.

[1] http://www.gnu.org/licenses/gpl-faq.en. ... AllowMoney
[2] http://browse.feedreader.com/c/rAthena_News/16723576
[3] http://dev.terra-gaming.com/
Image
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by robran »

Thanks to both of you for the constructive feedback, I appreciate it.

First, let me point out that to build the library, you don't need to link against Ogre. The library code is independent from the rendering engine. It's just one external file that contains code to get data from Ogre scene graph and convert between Ogre and library cameras. By releasing that single file under a public domain license (so it can be part of any closed source application code), would the linking problem mentioned by vitefalcon be solved? In that case, would it be enough just to change the heading text in that file?

Second, I am well aware that anyone can sell the code as it is, and that modifications have to be released only in the case the modified code is distributed. I haven't understood completely the Athena situation - but I am not surprised that, even with a legal department on your side (I work at a University), there are situations where you can't find a reasonable way to defend your rights. I will think about the license a little bit more, but if anyone is interested in having the code with a different kind of license for specific reasons, please talk to me.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by vitefalcon »

robran wrote:Thanks to both of you for the constructive feedback, I appreciate it.

First, let me point out that to build the library, you don't need to link against Ogre. The library code is independent from the rendering engine. It's just one external file that contains code to get data from Ogre scene graph and convert between Ogre and library cameras. By releasing that single file under a public domain license (so it can be part of any closed source application code), would the linking problem mentioned by vitefalcon be solved? In that case, would it be enough just to change the heading text in that file?
That, I believe, is a viable option. You will have to explicitly call out the license of that 'interchange' file in that case.
robran wrote:Second, I am well aware that anyone can sell the code as it is, and that modifications have to be released only in the case the modified code is distributed.
... and if and only if the user of the software with the modified code requests for the source. The code being GPL licensed and the willingness to distribute the code are different. In short, the code for the GPL licensed source code can only be requested by the someone who is using that software. As long as no one asks for it, it's perfectly fine to not make it public.
Image
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by robran »

Hi,

just to let all interested people know that I've changed the licensing terms of all the demo and "interface" code. The library is still LGPL, but at least
all code you need to compile with your application (connection to Ogre) is now public domain code. That means one can just compile the library as a
DLL and use it without any restriction on his code.
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by duststorm »

Very interesting, indeed. Thank you for the nice showcase of this library. :D
Developer @ MakeHuman.org
robran
Gnoblar
Posts: 8
Joined: Wed Mar 06, 2013 7:23 pm
x 4

Re: Open-Source Viewpoint Computation Library [new DEMO]

Post by robran »

Thanks!

I forgot to mention that, if you're interested in seeing how the library would perform with a scene or situation of your choice, but do not want to go through compiling and learning how to use it, I am happy to make some further testing - just send me the scene and what kind of viewpoint computation problems you would like to deal with.
Post Reply