# object selection indicator on terrain...

This topic is 5085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all... Im working on a DX9 project wich involves a terrain and some 3d animals walking that terrain. I got the picking working but i would like to render some indication on the terrain below the object that the object is selected. For those playing strategy games like Warcraft or C&C, you've prolly seen what i want. It's the little red or green circle on the terrain below the selected object. Here's a screenshot... Notice how the circle follows the terrain height. How would i render such a thing? Thanks in advance. -MackatacK [Edited by - mackatack on December 16, 2004 6:49:08 AM]

##### Share on other sites
Quote:
 Notice how the circle follows the terrain height.How would i render such a thing?
It's actually more a case of mathematics than any clever graphics technique...

You say you've got picking to work, so you should be familiar with ray-triangle/ray-object intersection tests?

The way I made a similar thing work is by using standard 2D coordinates to work out which tile I was over (my terrain heightmap was a classical evenly distributed grid), then to find the height I calculated which triangle the point was in, then using the plane equation (aX+bY+cZ+d=0) to find the missing value.

Once you have a coordinate on the terrain you can draw the indicator. Bare in mind that for some slopes a trivial use of this algorithm will see your indicator disappear behind other geometry; so you might want to align the sprite to the direction of the normal and/or offset it from the ground slightly.

hth
Jack

##### Share on other sites
Thanks for your reply... but i already got the location where to draw the indicator. Its right below the object...

The question is how to draw the indicator in such a manner that
it forms another layer on the terrain. it should appear as another blended
texture on the terrain mesh.

##### Share on other sites
Quote:
 Original post by mackatackThanks for your reply... but i already got the location where to draw the indicator. Its right below the object...The question is how to draw the indicator in such a manner thatit forms another layer on the terrain. it should appear as another blendedtexture on the terrain mesh.

Okay, I'm with you.

You might want to look at "decal" rendering (Try this article) - the common usage is putting gun-shot marks on walls in FPS's... but you could easily decal your location texture onto the terrain in a similar manner.

I'd personally pick this one as the ideal option, as it also presents you with some re-usable code for your engine such that you could easily add decals for foot-steps where your animals have walked...

Also depending on your geometry setup, you could do a multi-pass approach and render the particular quad/group of triangles where they marker would be over the top (disable Z-writes and enable alpha blending), however this gets tricky when your marker crosses boundaries...

Jack

##### Share on other sites
Thanks... i'll check it out

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633363
• Total Posts
3011514
• ### Who's Online (See full list)

There are no registered users currently online

×