Yep, laying down roads over terrain is a nasty problem.  This is especially
true if you are using a different "road" geometry.  You need to create
co-planar geometry which can be done a variety of ways.  One way is to build
your geometry for the road using the same heightmap source as the terrain
itself, then sub-divide the mesh pieces until they can conform to the
geometry undulations of the terrain geometry.  Once you have a roughly
co-planar geometry you can do to different techniques:

1. Put the terrain and the road into an ordered group and have the road
ignore the zbuffer when drawing.  This will then have the road geometry
override the zbuffer values put down by the terrain.  This will work
depending on your freedom of camera movement, since a path snaking behind a
hill will be seen through the hill.

2. The other trick is to change the PolygonAttributes of the road to have a
PolygonOffset of some small amount which will cause the road to be logically
"closer" to the camera in terms of its depth testing.  This only works if
the terrain is very close to coplanar.  And the amount of the polygon offset
and factors needs to be enough to resolve zbuffer fighting, so thats
dependant on your clip.  If the clip is 2 and 2000, then you can probably
use a very small PolygonOffset.

Dave Yazel
www.cosm-game.com

-----Original Message-----
From: ChrisThorne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 8:52 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Z-BUFFER PROBLEM????


Yep it's the Z buffer tearing problem again.
Have a look at the ViewNavigationBehavior mod I sent to the list
under the title "Test program (fwd) for Grafic card question"
it has a solution to this (or a least Desiree's similar) problem. Hopefully
it will work for you
(maybe with some tweaking).  I will do a more general solution later.

The changes I made worked forDesiree's example but not for her main
application, so I will
look at it all again :(.  I tried to get away without the performance
overhead of a sqrt function
- maybe we will have to put up with it.

Essentially the solution is to provide an adaptive high precision clipping
window around your model
which changes as you move around.  You may have to make sure there is a bit
of distance
between your road and terrain.
Alternatively, I know David Yazel can do good roads on terrain - perhaps he
can tell you how he does it :).

Otherwise, if you can send me a sample program I can take a look at it,

Chris

alvaro zabala wrote:

> I have a scene, with a terrain wich has land uses, electric towers,
> catenarys, etc
> I want to add a road over the terrain, with a triangleStripArray , but I'm
> having problems with the Z-BUFFER.
> I fixed the front and back clipping distances to 2 and 5500 (5500/2<3000)
>
> Please see the atachments.
>
> Anyone can explains it??
>
>
----------------------------------------------------------------------------
----------------------------------------------------
>                   Name: Prueba1.gif
>    Prueba1.gif    Type: GIF Image (image/gif)
>               Encoding: base64
>
>                   Name: Prueba2.gif
>    Prueba2.gif    Type: GIF Image (image/gif)
>               Encoding: base64

--
                  ,--_|\
                 /  Oz  \
Chris Thorne    :)_.--._/
[EMAIL PROTECTED]     v

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to