• Advertisement
Sign in to follow this  

How to draw selection circle?

This topic is 4550 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

I would like to draw the character/item selection circle like in World of Warcraft. Currently, I draw the selection with a plane textured with an alpha texture with a circle under the object. Which, will penetrate other objects and environment. I notice that, in WoW, the selection circle will just change shape according to the environment and land. Another thing I have noticed is, the selection circle seems to cast upon all the environment and objects under the selection. e.g. when a character is on a table and being selected, the selection circle will be seen on the table as well as on the land under the table. So, how is it done? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Thanks for your thread, deffer.

My thinking is, projective texture is not the way because:

It requires to render all meshes (at least the static lands) twice. And for the second phaes on projective texture, the workload on CPU and GPU are great.

Maybe I am wrong but I don't notice any reverse projection so far. So, I ruled out projective texture.

Share this post


Link to post
Share on other sites
Quote:
Original post by pcwlai
It requires to render all meshes (at least the static lands) twice.
Not if your world is spatially subdivided, and you cull.

Quote:

Maybe I am wrong but I don't notice any reverse projection so far. So, I ruled out projective texture.


It's not too hard to prevent backprojection with projective texturing. When you put the geometry vertices through the projection matrix, you get an x/y value to map the texture, but you should also get a z/w value which will be positive for a forward projection and negative for a backprojection. Just texkill on that value and your backprojection should disappear.

Share this post


Link to post
Share on other sites
Quote:
Original post by superpig
Quote:
Original post by pcwlai
It requires to render all meshes (at least the static lands) twice.
Not if your world is spatially subdivided, and you cull.

Quote:

Maybe I am wrong but I don't notice any reverse projection so far. So, I ruled out projective texture.


It's not too hard to prevent backprojection with projective texturing. When you put the geometry vertices through the projection matrix, you get an x/y value to map the texture, but you should also get a z/w value which will be positive for a forward projection and negative for a backprojection. Just texkill on that value and your backprojection should disappear.


No matter how you cull, you need to render twice. First pass for the land's texture and the second pass for the projective texture. And it is expansive to calculate the texture coordinates for the projective texture.

I would like to know whether it is the only way to do this effect and is WoW and other games with same effect is really using projective texture.

Share this post


Link to post
Share on other sites
Quote:
Original post by pcwlai
No matter how you cull, you need to render twice. First pass for the land's texture and the second pass for the projective texture.
Sure, but I'm saying that it's not as bad as rendering /the entire world/ twice - you only rerender those bits that would actually be affected by the selection circle.

Quote:
And it is expansive to calculate the texture coordinates for the projective texture.
No, it really isn't. It's just a matrix multiply.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement