Re: [osg-users] Dynamic Terrain

2011-02-21 Thread Torben Dannhauer
Hi Chris,

thanks to Rui's OpenSceneGRaph 3.0 book I do now understand how the Plugins 
work and implemented a pseudo loader as you recommended.

It works like a charm and now I can do the modification on load time but 
outside of my rendering loop.

My next step will be to go on learning how to determine which tile is affected 
of my modification and has to be altered.

Thanks you for your hints!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36916#36916





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-26 Thread Torben Dannhauer
Hi Robert,

ah, that might be the point: I have to ensure it is not rendered while updating 
it. I forgot it's multithreaded at that point :)

Due to the type of error, and when it happens, I think it is a multithreading 
issue.

Thank you!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34109#34109





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-26 Thread Robert Osfield
Hi Torben,

I can't really know what the problem might be, this type of
multi-threading issue really is something you'll need to debug and
think about at your end.  The specific warning you are getting
suggests that ref counting has gone amiss, perhaps a dangling pointer
somewhere.

As a general note, with updating a terrain in a multi-threaded app
you'll need to be careful about making sure that objects you are
modifying aren't being rendered at the same time, the use of DYNAMIC
DataVariance of StateSet and Drawable will be required.  The
alternative is to look at mutexing or double buffering.

Robert.

On Thu, Nov 25, 2010 at 9:27 PM, Torben Dannhauer  wrote:
> Hi Robert,
>
> This evening I played with the tileLoadcallback and it worked, it is called 
> for every loaded tile as desired.
> I can apply custom terrain technique for every tile ( it's more performance 
> consuming than I expected)
>
> I subclassed my customTerrainTechnique from geometryTechnique and overwrote 
> it's update function very simple (jsut calling the base implementation):
>
> Code:
>
> void myTerrainTechnique::update(osgUtil::UpdateVisitor* uv)
> {
>        GeometryTechnique::update( uv);
> }
>
>
>
>
> At the beginning this works, but when I fly around a little buit it crashes 
> alway in terrain::traverse( ..) but in arbitrary lines.
>
> Because my custom technique does currently nothing custom, it must be cause 
> by the way my loading callback or my custom terraintechnique is applied to 
> the tiles...
>
> One of the crashes finished with this output:
> [code]
> Warning: deleting still referenced object 084AD840 of type 'class 
> osg::Referenced *'
>         the final reference count was 1, memory corruption possible.
> [code]
>
> Any Idea what I'm doing wrong?
>
>
> Thank you!
>
> Cheers,
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34098#34098
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Torben Dannhauer
Hi Robert,

This evening I played with the tileLoadcallback and it worked, it is called for 
every loaded tile as desired.
I can apply custom terrain technique for every tile ( it's more performance 
consuming than I expected)

I subclassed my customTerrainTechnique from geometryTechnique and overwrote 
it's update function very simple (jsut calling the base implementation):

Code:

void myTerrainTechnique::update(osgUtil::UpdateVisitor* uv)
{
GeometryTechnique::update( uv);
}




At the beginning this works, but when I fly around a little buit it crashes 
alway in terrain::traverse( ..) but in arbitrary lines.

Because my custom technique does currently nothing custom, it must be cause by 
the way my loading callback or my custom terraintechnique is applied to the 
tiles...

One of the crashes finished with this output:
[code]
Warning: deleting still referenced object 084AD840 of type 'class 
osg::Referenced *'
 the final reference count was 1, memory corruption possible.
[code]

Any Idea what I'm doing wrong?


Thank you!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34098#34098





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Torben Dannhauer
Hi Robert,

absolutely great! I'll finish work quite early today so I can go home and try 
VPB :)

with the invoked custom terrainTechnique I can dive into it and learn how to 
use the terrainTechnique to fullfil my modification tasks :)

[quote]
I have also fixed VPB so that it writes out the external image files
when you write out to .osgx and .osgt. These text formats aren't ones
I'd expect users to deploy at run-time but they are both useful to
testing purposes.
[\quote]
I haven't used VPB to create .osgx or .osgt files yet so I'll see what you mean 
this evening :)

Thank you very very much for you help Robert et al.! :D


Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34079#34079





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Robert Osfield
Hi Torben et. al.,

I have now checked in my changes to VPB which ensure that it does
assign a GeometryTechnique.  I have tested the changes out by putting
debugging into the .ive plugin and TerrainTile::init(..) and things
look to be working correctly - no GeometryTechnique has been
pre-assigned, so in theory the Terrain::TerrainTechniquePrototype
should now be cloned as intended.

I haven't tested providing a custom TerrainTechnique yet though, I'll
leave this to other who are already champing at the bit ;-)

I have also fixed VPB so that it writes out the external image files
when you write out to .osgx and .osgt.  These text formats aren't ones
I'd expect users to deploy at run-time but they are both useful to
testing purposes.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Robert Osfield
Hi Torben,

On Thu, Nov 25, 2010 at 11:13 AM, Torben Dannhauer
 wrote:
> Is this removal already available in svn of VPB?

No not yet, it's turned out to be a bit complicated any of the
traversals of the scene graph prior to writing out has been invoking
the automatic osgTerrain::TerraiTile::init(..)  assignment of
GeometryTechnique when a TerrainTechnique isn't already assigned.
Avoiding traversal of TerrainTile in the NodeVisitors in VPB seems to
be the way to avoid this.

I'm currently doing testing of changes to VPB to avoid the
GeometryTechnique assignment and if it all works out will check it in.
 Expect another email update in the next half hour.

> I assume,with the re-adding of geometryTechnique you meant this function:
>
> Code:
>
> void TerrainTile::init(int dirtyMask, bool assumeMultiThreaded)

Yes, it's the TerrainTile::traverse() method that invokes the above
init(..) method.


> If VPB would not insert an terrainTechnique, the terrainTile would look for 
> an available terrainTechniquePrototype. If available: use that, otherwise: 
> use geometryTechnique.

Yep that is what should be happening.  VPB really should be creating
databases that don't have anything pre-assigned so that the init()
method can do the cloning or fallback to GeometryTechnique.  Given the
fallback already exists in osgTerrain we don't even need an option in
VPB to know whether to add a GeometryTechnique or not.

> Am I right that your VPB modification would work for all new compiled VPB 
> databases?

Yes.

> Prebuild VPB databases would still have to use the tileLoadCallback to 
> replace the trerrainTechnqie until they rebuild their databses, if they want 
> a custom terrainTEchnique.
>
> At all, this looks like a solution for me. I would try the tileLoadcallback 
> to learn more, but at the end I would rebuild my DB because it was build in 
> Nov '09 and ist still in the .ive format. I suppose the new .osgb would be 
> the fastest of the new formats.
>
> Thank you!
>
> Cheers,
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34074#34074
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Torben Dannhauer
Hi Robert,


> 
> I've removed the assignment of GeometryTechnique from VPB, but
> unfortunately osgTerrain is adding back in the GeometryTechnique
> automatically on the first traversal through the scene graph. 
> 

Is this removal already available in svn of VPB?

I assume,with the re-adding of geometryTechnique you meant this function:

Code:

void TerrainTile::init(int dirtyMask, bool assumeMultiThreaded)



?

If VPB would not insert an terrainTechnique, the terrainTile would look for an 
available terrainTechniquePrototype. If available: use that, otherwise: use 
geometryTechnique.

You are right, the terrain should provide a default terrianTechnique to be 
usable out of the box. The described approach would ensure that a 
terrainTechnqie is avaliable, at least the standart geometryTechnique

Am I right that your VPB modification would work for all new compiled VPB 
databases?
Prebuild VPB databases would still have to use the tileLoadCallback to replace 
the trerrainTechnqie until they rebuild their databses, if they want a custom 
terrainTEchnique.

At all, this looks like a solution for me. I would try the tileLoadcallback to 
learn more, but at the end I would rebuild my DB because it was build in Nov 
'09 and ist still in the .ive format. I suppose the new .osgb would be the 
fastest of the new formats.

Thank you!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34074#34074





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Robert Osfield
Hi Torben,

On Thu, Nov 25, 2010 at 10:16 AM, Torben Dannhauer
 wrote:
> Thats right, but does it make sense to correct VPB anyway for future DB 
> builds? Some kind of option to tell VPB whether it should note a "use 
> geometryTechnique" or "use terrainTechniquePrototype after loading"...

I've removed the assignment of GeometryTechnique from VPB, but
unfortunately osgTerrain is adding back in the GeometryTechnique
automatically on the first traversal through the scene graph.  This
automatic assignment scheme is good from the perspective that it
provides an implementation even when isn't otherwise used, but end up
with a TerrainTechnique assigned when we don't actually need or want
it.  I'm not sure yet how best to disable this automatic assignment
feature as it's really useful for making sure the Terrain is able to
be intersected and rendered.


> In mycase I can rebuild the database in some weeks, no reason to live with 
> workarounds forever.. ;)
>
> To your proposal of the callback: Do we need a readFileCallback to analyse 
> all read files in OSG, or do we "only" need a readTileCallback wich updates 
> all terrain tiles loaded?

A tile loaded callback might be sufficient for cleaning the
TerrainTile from it's pre-assigned GeometryTechnique.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Torben Dannhauer
Hi Robert,


> 
> For pre-built databases future changes to VPB will not help
> 

Thats right, but does it make sense to correct VPB anyway for future DB builds? 
Some kind of option to tell VPB whether it should note a "use 
geometryTechnique" or "use terrainTechniquePrototype after loading"...

In mycase I can rebuild the database in some weeks, no reason to live with 
workarounds forever.. ;)

To your proposal of the callback: Do we need a readFileCallback to analyse all 
read files in OSG, or do we "only" need a readTileCallback wich updates all 
terrain tiles loaded?



Cheers,
Torben[/quote]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34072#34072





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Robert Osfield
Hi Torben,

Good detective work.  The problem with the hardwired GeometryTechnique
doesn't come from the .ive plugin, it's just doing what is stored.
The problem comes from VPB hardwiring in the GeometryTechnique,
something we need to look at changing.

For pre-built databases future changes to VPB will not help, so in
this case a ReadFileCallback that removes/replaces the
TerrainTechnique will be required.  Another possibility is to have a
mode in Terrain/TerrainTile that allows you to override the
TerrainTechnique, but I think this could get overcomplicated.

Robert.

On Thu, Nov 25, 2010 at 9:33 AM, Torben Dannhauer  wrote:
> Hi Robert,
>
> I think I know why the TerrainTechnique Prototype is not loaded:
>
> The ive loader loads the the tile and its terrainTechnique via 
> TerrainTile::readTerrainTechnique(DataInputStream* in) in 
> \OpenSceneGraph-2.9.10_x86\src\osgPlugins\ive\TerrainTile.cpp   and ignores 
> the terrainTechnique prototype:
>
>
> Code:
>
> osgTerrain::TerrainTechnique* 
> TerrainTile::readTerrainTechnique(DataInputStream* in)
> {
>    bool hasTechnique = in->readBool();
>    if (!hasTechnique) return 0;
>
>    int id = in->readInt();
>    if (id==IVEGEOMETRYTECHNIQUE)
>    {
>        return new osgTerrain::GeometryTechnique;
>    }
>    else
>    {
>        return 0;
>    }
> }
>
>
>
>
> The reason why it is ignored seems to be this lines:
>
> Code:
>
>  int id = in->readInt();
>    if (id==IVEGEOMETRYTECHNIQUE)
>    {
>        return new osgTerrain::GeometryTechnique;
>    }
>
>
>
>
> -> To use the geometryTechnique instead of the terrainTechniquePrototype 
> seems to be compiled in the ive format.
>
> Before I start to work on the .ive format and breaking up the compatibility, 
> is there a change that the new osg file formats .(osgt, .osgb, .osgx) don't 
> have this hardwired terraintechnique?
>
> In my optinion the best solution would be that the loader looks if the file 
> contains any terrainTechnique and and if the osgTerrain node contains any 
> terrainTechniqueprototype.
> -> What should be the priority? Use prototype or use dataset terraintechnique 
> if both are available?
>
>
> I don't know in which files the loader of the other formats ( .osg, .osgt, 
> .osgb, .osgx) are located that I can dive into them.
>
> Any thoughts?
>
>
> Thank you!
>
> Cheers,
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34070#34070
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-25 Thread Torben Dannhauer
Hi Robert,

I think I know why the TerrainTechnique Prototype is not loaded:

The ive loader loads the the tile and its terrainTechnique via 
TerrainTile::readTerrainTechnique(DataInputStream* in) in 
\OpenSceneGraph-2.9.10_x86\src\osgPlugins\ive\TerrainTile.cpp   and ignores the 
terrainTechnique prototype:


Code:

osgTerrain::TerrainTechnique* 
TerrainTile::readTerrainTechnique(DataInputStream* in)
{
bool hasTechnique = in->readBool();
if (!hasTechnique) return 0;

int id = in->readInt();
if (id==IVEGEOMETRYTECHNIQUE)
{
return new osgTerrain::GeometryTechnique;
}
else
{
return 0;
}
}




The reason why it is ignored seems to be this lines:

Code:

 int id = in->readInt();
if (id==IVEGEOMETRYTECHNIQUE)
{
return new osgTerrain::GeometryTechnique;
}




-> To use the geometryTechnique instead of the terrainTechniquePrototype seems 
to be compiled in the ive format.

Before I start to work on the .ive format and breaking up the compatibility, is 
there a change that the new osg file formats .(osgt, .osgb, .osgx) don't have 
this hardwired terraintechnique?

In my optinion the best solution would be that the loader looks if the file 
contains any terrainTechnique and and if the osgTerrain node contains any 
terrainTechniqueprototype.
-> What should be the priority? Use prototype or use dataset terraintechnique 
if both are available?


I don't know in which files the loader of the other formats ( .osg, .osgt, 
.osgb, .osgx) are located that I can dive into them.

Any thoughts?


Thank you!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34070#34070





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Torben Dannhauer
Hi Robert,

I did exactly this. I used osg terrain and added this two lines:

Code:

osg::ref_ptr myT = new 
osgTerrain::myTerrainTechnique();
terrain->setTerrainTechniquePrototype( myT );




The example works, the database is displayed. Just the terrainTechnique is not 
used.

The terrainTechnique is:

Code:

#pragma once

#include 

namespace osgTerrain {

class myTerrainTechnique : public osgTerrain::TerrainTechnique
{
public:
myTerrainTechnique(void);

/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
myTerrainTechnique(const TerrainTechnique&,const osg::CopyOp& 
copyop=osg::CopyOp::SHALLOW_COPY);

META_Object(osgTerrain, myTerrainTechnique);

~myTerrainTechnique(void);

virtual void update(osgUtil::UpdateVisitor* nv);
};

}





Code:

#include "myTerrainTechnique.h"
#include 

using namespace osgTerrain;

myTerrainTechnique::myTerrainTechnique(void)
{
OSG_ALWAYSset
_terrainTile->osg::Group::traverse(*uv);
}
}


.

I tried to make it as simple as possible, just looking for the debug messages 
of the constructor / copy-constructor.



Thank you!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34056#34056





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Robert Osfield
Hi Torben,

I wouldn't rule out an OSG bug as the reason that what you are
attempting isn't working.  In principle it work, but almost all my
testing has been done with quite specific usage models, so there is a
chance I've missed something.  I don't have time to diving into
testing 3rd party codes right now.  Is there any chance you could
modify an example like osgterrain from svn/trunk and see if you can
recreate the problem there?

Robert.

On Wed, Nov 24, 2010 at 8:12 PM, Torben Dannhauer  wrote:
> Hi Robert, Hi Chris
>
> I have used the META_Object Macro, and using the copy constructor manually 
> works.
>
> I set the TerrainTechnique via this code:
>
> Code:
>
>  osg::Node* rootnode = osgDB::readNodeFiles(arguments);
>
>    osgTerrain::Terrain* terrain = 
> findTopMostNodeOfType(rootnode);
>    if (!terrain)
>    {
>        terrain = new osgTerrain::Terrain;
>        terrain->addChild(rootnode);
>
>        rootnode = terrain;
>    }
>
>        osg::ref_ptr myT = new 
> osgTerrain::myTerrainTechnique();
>        terrain->setTerrainTechniquePrototype( myT );
>
>
>
>
> The custom terrainTechniques constructor is a single time called when 
> creating the instance.
>
> The copy constructor is not called and the custom terrain technque is not 
> used.
>
> What is my error in setting the setTerrainTechniquePrototype?
>
> This is my project file: 
> http://www.osgvisual.org/projects/osgvisual/browser/experimental/TerrainTest/osgterrain.cpp
> This is my Terrain Technique (cpp): 
> http://www.osgvisual.org/projects/osgvisual/browser/experimental/TerrainTest/myTerrainTechnique.cpp
>
> This is my Terrain Technique (header): 
> http://www.osgvisual.org/projects/osgvisual/browser/experimental/TerrainTest/myTerrainTechnique.h
>
>
> Chris, such a basic overview would be great!
>
>
> Thank you,
>
>
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34051#34051
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Torben Dannhauer
Hi Robert, Hi Chris

I have used the META_Object Macro, and using the copy constructor manually 
works. 

I set the TerrainTechnique via this code:

Code:

 osg::Node* rootnode = osgDB::readNodeFiles(arguments);

osgTerrain::Terrain* terrain = 
findTopMostNodeOfType(rootnode);
if (!terrain)
{
terrain = new osgTerrain::Terrain;
terrain->addChild(rootnode);

rootnode = terrain;
}

osg::ref_ptr myT = new 
osgTerrain::myTerrainTechnique();
terrain->setTerrainTechniquePrototype( myT );




The custom terrainTechniques constructor is a single time called when creating 
the instance.

The copy constructor is not called and the custom terrain technque is not used.

What is my error in setting the setTerrainTechniquePrototype?

This is my project file: 
http://www.osgvisual.org/projects/osgvisual/browser/experimental/TerrainTest/osgterrain.cpp
This is my Terrain Technique (cpp): 
http://www.osgvisual.org/projects/osgvisual/browser/experimental/TerrainTest/myTerrainTechnique.cpp

This is my Terrain Technique (header): 
http://www.osgvisual.org/projects/osgvisual/browser/experimental/TerrainTest/myTerrainTechnique.h


Chris, such a basic overview would be great!


Thank you,


Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34051#34051





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Chris 'Xenon' Hanson
On 11/24/2010 10:14 AM, Torben Dannhauer wrote:
> Hi Chris,
> yes, you wrote about it in an other thread, but because I don't know what you 
> are doing in your loader or what the difference is to a usual loader (the 
> file extension of an VPB created database is not differnet I think - how do 
> you detect VPB created databases to load it via the pseudo loader plugin?) I 
> can't try to go your path.

  I have a pseudoloader name ".modifyterrain" that when invoked, loads a .osg 
or .ive file
(based on the filename it received, but without the "modifyterrain" suffix. It 
then runs a
visitor across the loaded graph, making various changes before returning it for 
use.

  These changes involve modifying all external references in the loaded graph 
to each have
a .modifyterrain suffix, to ensure the modifyterrain pseudoloader is always in 
control of
the final say when new branches are loaded. The changes also involve performing 
any
modifications to the terrain heightfield I desire, before the terrain is first 
displayed.
I don't currently do dynamic on-the-fly modifications of the terrain, because 
my client
didn't need or budget for it.

  I tried to submit a bunch of this last year, but it wasn't suitable for 
inclusion in
core OSG. I believe I had made some trivial changes to the PagedLOD node to 
facilitate
this operation. There's probably a way to accomplish it without these changes, 
but I
wasn't funded to pursue that alternative.

> Till now, for me a VPB database was just an blackbox (.ive file with lots of 
> subfolders/files) I only had to load via 

  I have an overview of osg VPB terrain structure that I wrote for a client a 
year or so
ago. I'll see if I am ok to publish it.


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
"There is no Truth. There is only Perception. To Perceive is to Exist." - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Robert Osfield
Hi Torben,

On Wed, Nov 24, 2010 at 5:14 PM, Torben Dannhauer
 wrote:
> Afterwards I set my TerrainTechnique and THEN set the terrain as scene data 
> to the viewer, but my terrainTechnique was not used.

You TerrainTechnique should be cloned, but otherwise not used
directly.  Make sure that you implement the appropriate copy
constructors that will be invoked by the cloning.  The META_Node(..)
method that you see in most osg::Node subclasses will use the copy
constructor to do the cloning.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Torben Dannhauer
Hi Chris,

yes, you wrote about it in an other thread, but because I don't know what you 
are doing in your loader or what the difference is to a usual loader (the file 
extension of an VPB created database is not differnet I think - how do you 
detect VPB created databases to load it via the pseudo loader plugin?) I can't 
try to go your path.

As Robert says, I load the database and set the terrainTechnique Prototype, but 
my modified TerrainTechnique was not called.

As my second try I searched in the VPB dataset for the first tile and set its 
terrain technique to my modified technique, and this worked. This way I would 
have to iterate through all tiles and set its TerrainTechnique to my custom 
one. As "runtime processing" this sounds a little bit ineffective for me on a 
.5 TB database , so I supposed the tile loading callback would be better.
But from Roberts answer I learn that there are other possibilities

The problem for me as an a osg beginner is to get an idea of the basic concept 
of osgTerrain and the most common methods to solve my problem. As soon as I 
have collected enough knowledge I'm sure that I can improve my autonomy in 
learning, but at the moment I'm quite stuck in learning osgTerrain. 

Till now, for me a VPB database was just an blackbox (.ive file with lots of 
subfolders/files) I only had to load via 
Code:
osgDB::readNodeFiles("myTerrainRoot.ive");



I converted the databases root file into .osg to get the basic structure. I 
discovered that the osgTerrain Node is included in the database, so I reused 
the example "osgTerrain", which already provides Roberts recommended step of 
searching for the terrain node.

Afterwards I set my TerrainTechnique and THEN set the terrain as scene data to 
the viewer, but my terrainTechnique was not used.

I think I have to use a custom terrainTechnique. But I don't know how to apply:
 a) via tile load callback?
 b) direct after loading the VPB database root file wie setting the 
terrainTechniqueProtoype?
 c) iterating throu the whole database and setting the terrainTechnique of each 
tile manually?

Which solutions are complementary and/or which are alternatives?

Thank you for your help, It's a little bit depressing at this stage...

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34043#34043





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Chris 'Xenon' Hanson
On 11/24/2010 4:34 AM, Torben Dannhauer wrote:
> Hi Robert,
> Am I right that this is not possible with VPB build databases?
> As soon as I load the root terrain file it loads the first tile so I can't 
> assign the prototype prior loading the tiles. Or can I create a 
> osgTerrainNode and then add the VPB database to this node?
> The workaround would be the tile loading callback, isn't it?

  I use a pseudoloader to wrap the loading of the VPB database files.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
"There is no Truth. There is only Perception. To Perceive is to Exist." - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Robert Osfield
Hi Torben,

On Wed, Nov 24, 2010 at 11:34 AM, Torben Dannhauer
 wrote:
> Am I right that this is not possible with VPB build databases?

I'm afraid you'll need to be more specific about what you think isn't
possible, there are many long and winding threads on osg-users.

> As soon as I load the root terrain file it loads the first tile so I can't 
> assign the prototype prior loading the tiles. Or can I create a 
> osgTerrainNode and then add the VPB database to this node?

I'm not at at all clear at what you mean.  At a guess are you
referring to the fact that I changed VPB to place an
osgTerrain::Terrain node at the top of the root tile of the paged
database it generates?  Previous to this change one had to create the
osgTerrain::Terrain node and than add the root of paged database to
this.

With the new scheme of providing the Terrain node in the root tile all
you should have to do is load the root tile, find the Terrain node and
then assign the custom TerrainTechnique.

> The workaround would be the tile loading callback, isn't it?

Maybe... but then I'm not clear and what you mean :-)

>
> My use case: 0.5 TB geocentric database build with VPB. I'd like to modifiy 
> the terrain(on all LOD) for flat terrain on 5-20 airport locations all over 
> the world.

You could certainly use a tile loaded callback to modify the height
fields on the terrain, for stitching in other polygonal data into the
tiles you'd need to use a custom TerrainTechnique.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Torben Dannhauer
Hi Robert,

Am I right that this is not possible with VPB build databases?
As soon as I load the root terrain file it loads the first tile so I can't 
assign the prototype prior loading the tiles. Or can I create a osgTerrainNode 
and then add the VPB database to this node?

The workaround would be the tile loading callback, isn't it?

My use case: 0.5 TB geocentric database build with VPB. I'd like to modifiy the 
terrain(on all LOD) for flat terrain on 5-20 airport locations all over the 
world.

Thank you!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34021#34021





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-24 Thread Robert Osfield
Hi Torben,

You'll need to assign your TerrainTechnique to the Terrain prior the
tiles being loaded.

Robert.

On Tue, Nov 23, 2010 at 8:34 PM, Torben Dannhauer
 wrote:
> Hi,
>
> I tried to test my terrainTechnique, but I don't know how to apply it. I 
> tried to apply it to my VPB terrain via
>
>
> Code:
>
> osg::ref_ptr myT = new myTerrainTechnique();
> terrain->setTerrainTechniquePrototype( myT );
>
>
>
>
> but it does not work, my update(..) funktion is not called.
>
> Does anyone know my mistake?
>
>
> Thank you!
>
> Cheers,
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34002#34002
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-23 Thread Torben Dannhauer
Hi,

I tried to test my terrainTechnique, but I don't know how to apply it. I tried 
to apply it to my VPB terrain via 


Code:

osg::ref_ptr myT = new myTerrainTechnique();
terrain->setTerrainTechniquePrototype( myT );




but it does not work, my update(..) funktion is not called.

Does anyone know my mistake?


Thank you!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34002#34002





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-22 Thread Sanat Talmaki
Hi Robert,

I read up on osgTerrain and posted my question in a different topic: 
osgTerrain: Terrain Class and TerrainTile Understanding

As I felt it would be better to put it under a different topic than this 
general one

Thanks,

Sanat

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33964#33964





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-22 Thread Torben Dannhauer
Hi Hardwig,

Thanks!

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33955#33955





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-22 Thread Hartwig Wiesmann
Hi,

a contour layer assigns to a height value a color value. Therefore, you can use 
the layer to visualize "terrain contours", respectively areas of equal height.

Cheers,
Hartwig

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33954#33954





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-22 Thread Torben Dannhauer
Hi Robert,

your explanation regarding the TerrainTechnique was the missing piece, after 
diving in the code I think now I unterstand the basic architecture of 
Terrain/TerrainTechnique and I'll try to realize it via runtime processing.

Thank you for explanation! :)

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33904#33904





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-19 Thread Robert Osfield
Hi Sanat,

I sounds a bit complicated to me.

VPB generates a quad tree paged database for you, I would suggest for
your source of terrain data use the TerrainTile that are loaded at
runtime, and using the quad tree scene graph structure that paged in
at runtime if you want to manage the level of detail.  You will have
to handle the fact that will be multiple TerrainTile per location in
space due to the various levels of detail.  You will also need to
handle the fact as the camera moves around the highest level of detail
at each location will go up and down.  If you want your system to
properly scale then you'll need to handle this in your app no matter
what.

Personally I'd recommend keeping the terrain modification done at
runtime via post processing of the scene graph that the
GeometryTechnique generates.  Having your own TerrainTechnique that
subclasses from GeometryTechnique might just be the most convenient
way to do this.

The other route would I'd consider is to have a custom vertex shader
that modifies the terrain according to a displacement map that you
assign per TerrainTile, or use a textures that are independent of the
TerrainTile and use texgen to generate the appropriate texture
coordinates.

Robert.

On Fri, Nov 19, 2010 at 12:43 PM, Sanat Talmaki  wrote:
> @Robert:
>
> I have read up on a bit of the techniques people have tries to use for this:
>
> From what I've read, this is the approach:
> Represent the terrain as Blocks. Blocks are the basic storage unit for data 
> and are used to transfer data from the CPU to GPU for processing.
>
> The Blocks are made up of tiles. Tiles are are the basic rendering unit 
> consisting of Triangles.
>
> Terrains are represented at varying resolutions i.e. whole terrain as 1 block 
> or as 4 blocks depending on distance of camera to terrain. (Similar to 
> Mip-Mapping)
>
> The vertices of the Terrain Grid are stored in a QuadTree:
> I am having trouble (maybe I've been reading too much) to figure the steps 
> out:
> 1) Create 3D terrain mesh using VPB/osgEarth from a USGS dem/tif image
> 2) Store vertices of the terrain in a QuadTree
> 3) (How do I ensure the varying resolutions of blocks?)
>
> Right now I am having trouble figuring out how to represent the terrain in 
> this format
>
>
>
> The approach I am thinking for Terrain Deformation is:
> Build an initial data structure of all the heights of vertices.
> Allow the 'actor' in the scene to interact with the terrain. If the actor 
> Collides with the terrain then check for the final Global Height of the actor 
> (the component with the lowest global elevation).
> Update the vertex value in the terrain database with the elevation value 
> obtained from the actor's global value.
> Render new/updated Terrain mesh.
>
> What do you suggest for such an approach?
>
> Thanks
> Sanat
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=33860#33860
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-19 Thread Sanat Talmaki
@Robert:

I have read up on a bit of the techniques people have tries to use for this:

>From what I've read, this is the approach:
Represent the terrain as Blocks. Blocks are the basic storage unit for data and 
are used to transfer data from the CPU to GPU for processing.

The Blocks are made up of tiles. Tiles are are the basic rendering unit 
consisting of Triangles. 

Terrains are represented at varying resolutions i.e. whole terrain as 1 block 
or as 4 blocks depending on distance of camera to terrain. (Similar to 
Mip-Mapping)

The vertices of the Terrain Grid are stored in a QuadTree:
I am having trouble (maybe I've been reading too much) to figure the steps out:
1) Create 3D terrain mesh using VPB/osgEarth from a USGS dem/tif image 
2) Store vertices of the terrain in a QuadTree
3) (How do I ensure the varying resolutions of blocks?)

Right now I am having trouble figuring out how to represent the terrain in this 
format 



The approach I am thinking for Terrain Deformation is:
Build an initial data structure of all the heights of vertices. 
Allow the 'actor' in the scene to interact with the terrain. If the actor 
Collides with the terrain then check for the final Global Height of the actor 
(the component with the lowest global elevation). 
Update the vertex value in the terrain database with the elevation value 
obtained from the actor's global value.
Render new/updated Terrain mesh.

What do you suggest for such an approach?

Thanks
Sanat

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33860#33860





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-19 Thread Sanat Talmaki
@Torben

Yes, I want to do the modifications at runtime. It is mainly due to interaction 
of actors with the terrain causing deformations. 

My idea is also to modify the height value in the terrain grid and this height 
value will constantly be updated and rendered to show a sort of real-time 
terrain deformation.

Thanks,

Sanat

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33856#33856





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-18 Thread Robert Osfield
Hi Sanat,

There are lots of ways to modify terrain, lots of different rendering
techniques that enable this as well.  It's rather an open ended topic
and with it kinda difficult to guide to any specific solution,
especially without knowing what type of effect you are looking for.

At the simplest level you could just modify the
osgTerrain::TerrainTile's ElevationLayer  that are generated by
osgEarth.  You could also write your own custom TerrainTechnique that
takes these tiles as a source and added your own modification info to
enable your technique to do it's job.  You could also use something
like projective texture that stores the displacement heights and a
custom vertex shade that offsets the elevations on the fly without
actually modifying the terrain itself.

I could think of dozens of other approaches besides but it's kinda
pointless just reeling stuff off without knowing specifically what you
are after.

Robert.

On Wed, Nov 17, 2010 at 9:52 PM, Sanat Talmaki  wrote:
> Hi,
>
> I am trying to create a dynamic terrain that can show modifications to the 
> terrain in real-time.
>
> I want to show an object removing earth from the terrain and show a hole in 
> that area.
>
> Having read a few papers and other sources, I am confused how to go about 
> trying to achieve this in osg ?
>
> I have used osgEarth in the past to create a 3D terrain but I believe it 
> cannot be used for the purpose I currently need.
>
> Any suggestions would be extremely welcome
>
> Thanks
>
> Sincerely,
> Sanat
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=33812#33812
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Dynamic Terrain

2010-11-17 Thread Torben Dannhauer
Hi Sanat,

I have exactly the same problem. Additionally to cut wholes in the surface, I'd 
like to manipulate the terrain height. This way it would be possible to 
manipulate terrain in any way.

I have one question regarding your problem: Do you want to modifiy the terrain 
at runtime during loading or do you want to process your database that the 
changes are persistent?

Chris Hanson talked 2009 of a tool he is developing ( 
http://forum.openscenegraph.org/viewtopic.php?t=3146&highlight=locator) I don't 
know his status.

IM some other posts Robert told the the terrain loading is seperated from 
displaying it, and it should be able to modify loaded terrain prior display it. 

At the moment I don't know more detailed aspects but I hope to begin developing 
a solution in the next months. 

Additional hints/ideas would be great to enrich VPB/osgTerrain with terrain 
deformation capabilities.


Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33817#33817





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org