Hi Desiree,
On Mon, 2004-02-16 at 10:43, Desiree Görrissen wrote:
> Hi,
>
> I´m looking for a (kind of) level of detail node, which calculates the
> distances relative to a plane (or relative to the y value of the
> eyepoint) and not relative to a single point. I am using specific
> textures for the ground and need to use a very detailed gras texture,
> when I´m walking through the scene and a more generalized gras texture
> (the other one gives moiree effects...) when I´m flying over the scene
> wiht a greater distance. How can I accomplish this?
if the moiree is your main problem, you can probably get away with using
a better texture filter. Mipmaps get rid of moirees quite nicely, at the
cost of blurring, especially for oblique views like most of the terrain
I've seen. Currently we don't provide anisotropic filtering parameters,
but adding that wouldn't be a big deal, as long as your hardware
supports it.
> When I try to use the current LOD node its difficult to decide which
> point should be the one to use for the distance calculation, because its
> a difference if I´m 5000 meters above the scene or I am 5000 meters away
> from a specific point on the ground, but my own position is near to the
> ground. So I have to take into account, the y-value of my position or
> the distance in y-direction or something like that. Any idea how I could
> solve it? Can I create a subclass of the LOD node and implement the
> distance calculation differently? Which methods should be overwritten?
If you want to build your own NodeCore that's not hard, either. I would
probably derive it from DistanceLOD and add a single member "axis" to it
that defines the axis along which the distance is measured. I attached
an fcd file that does that. Use fcdEdit to generate the Base and Main
files from that. Don't touch the Base files, they are replaceable. The
only thing you have to add to the header is the declaration of the
draw() method (see OSGDistanceLOD.h). In the cpp file you have to add
the code for draw() (copy it from OSGDistanceLOD.cpp to start with), and
also copy the code from the initMethod(), exchanging DistanceLOD with
PlaneDistanceLOD where necessary.
The draw method transforms the position of the local point and the eye
position into world space. For your node you'd have to transform the
axis too, and calculate the distance from the plane.
That's it, shouldn't be a big problem.
Hope it helps
Dirk
<?xml version="1.0"?>
<FieldContainer
name="PlaneDistanceLOD"
parent="DistanceLOD"
library="System"
pointerfieldtypes="none"
structure="concrete"
systemcomponent="true"
parentsystemcomponent="true"
>
<Field
name="axis"
type="Vec3f"
cardinality="single"
visibility="external"
access="public"
>
The direction for the distance calculation.
</Field>
</FieldContainer>