Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Subject: Cameras
Subject: scaleDown command
Subject: black out solved
Subject: Aircraft Tutorial
Subject: Mathematical XYZ ?
Subject: Re: Its done This vs That
Subject: Re: Its done first week
recommendations for screen video captures?
Subject: 3DExplorer "Oddity "
Subject: Re: New Director
Subject: ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
Subject: RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Subject: Re: Texturing
Big Break Contest Videos
Subject: New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Subject: Plasma?
Looking for Inspiration
Subject: Weird EMail Q
Subject: Re: It 's done first week ?
Subject: Cherry not cranberry
Subject: Re: New game
Camera Animation Problem
Subject: Particle plugins?
 
Generating a heightmap

Generating a heightmap

2004-02-24       - By Ian Thomas

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

Hi guys,

I've been wrestling with this one for a while, and wondered if anyone
had any inspiration.

The setup: I've got a finite plane (the 'floor') of 240x240 at y=0,
scattered around which may be an arbitrary number of solids (the
contents of the room). The solids are just #box primitives, scaled,
rotated and translated but still essentially boxes.

I've divided the room into tiles of 12x12 for pathfinding purposes.

Basically I need to establish what the highest point is within in each
tile. (Note this may not be a vertex, as objects could cheerfully span
tiles without having a vertex within a tile.)

The routine I'm building is for precalcing the heightmap, so doesn't
need to be blistering - however, I'd like it to be pretty fast as my
room editing utility needs to rebuild on a regular basis. :)

Approaches I've tried:

Brute force:
-- ---- ----
- Apply a meshdeform to each object.
- For each tile:
 - Discard objects whose bounding sphere is nowhere near.
 - For each valid object, use Sutherland-Hodgeman clipping on each
face. If any of the face is inside, use the clipped vertices and take
the max height.

This seems to work very well, but is exceedingly slow; add to that I get
occasional anomalies and wonder if my S-H clipping implementation has
holes in (if anyone can point me at a good bit of sourcecode in whatever
language then I'd appreciate it).

Collision:
-- ---- --
- Turn on collision detection for the relevant objects
- For each tile:
-   Move a tile-shaped solid upwards from y=0 upwards until it stops
colliding. That's the max height.

This works okay, is slow, requires updatestages and sleeps to make the
collision callback work, and the collision doesn't seem to be 100%
accurate.

Raycasting:
-- ---- ---
- For each tile
-     Cast a network of angled rays downwards towards the floor (within
the volume of the tile) - the heighest point hit by a ray is the max
height for the tile.

This lacks precision - sometimes very thin blocks escape the net. :( To
catch those, you need more rays. The more rays, the slower it is.

Things I thought of but haven't tried:

Additive:
-- ------
- Reverse the process, and actually build the heightmap as I build the
map - for each object, work out which tiles it lies in and set heights
appropriately.

To be honest, I gave up on the maths for this in favour of trying the
other things. It sounds plausible but I still need to do lots of
clipping. :(

Any blindingly obvious solutions that I've missed? If not, I think next
step is to look at the additive solution using Sutherland-Hodgeman
*sigh* but it ain't pretty. :)

TIA,
  Ian

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
Dir3d-l mailing list
Dir3d-l@(protected)
http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l