Sign in to follow this  

object selection indicator on terrain...

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by mackatack
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.

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 this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this