Hi John,

Comments at bottom

On Wed, May 21, 2008 at 8:09 AM, John Vidar Larring
<[EMAIL PROTECTED]> wrote:
>
> This gave me an idea to how I could implement the verical exaggeration
> feature for osgTerrrain databases. Please review the below and comment on
> any conceptual errors so that I won't embark upon a projects that is doomed
> to fail anyway:
>
> 1) Add "float _verticalScale" a member of osgTerrain::GeometryTechnique with
> default value 1.0f, and the following access methods:
>  float getVerticalScale() const {return _verticalScale;};
>  void setVerticalScale(float scale) {_verticalScale=scale; dirty();}
>
> ...When ever vertical scale is set the dirty bit is set and geometry is
> recreated.
>
> 2) Models generated with VPB --terrain -v 1.4 will get the following out
> generated:
>
>  osgTerrain::TerrainTile {
>  [...snip...]
>    osgTerrain::GeometryTechnique {
>      VerticalScale 1.4
>    }
>  }
>
> 3) Vertical Scale / Height Exaggeration can then be changed in an
> application be means of an update callback of some sort.
>
> Does this seem to be a reasonable approach? Any flaws? Comments or critique
> is very much appreciated.

I'd recommend placing a VerticalScale into the osgTerrain::Terrain, to
sit alongside the
existing SampleRatio parameter.  The osgmultitexturecontrol example
shows adjustment
of SampleRatio in action.

GeometryTechnique right now looks for the enclose
osgTerrain::Terrain's SampleRatio, and
very easily could read a VerticalExageration parameter as well.  There
isn't an automatic
dirty of the GeometryTechnique of the TerrainTiles underneath a
Terrain, but this is something
I've though about adding - this would be required to make sure new
values of SampleRatio
and VerticalExegeration can passed on.

The reasons to go the route of placing the controls into
osgTerrain::Terrain is that it you can
control the central parameters for the whole terrain at one time, and
it can be used with other
TerrainTechnique beyond the current GeometryTechnique (this is
currently hardwired in to
VPB generated --terrain databases but this itself will eventually move
as a configuration parameter
of the Terrain itself just like SampleRatio.)

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

Reply via email to