Projecting a targetting ring using direct3d
Posted
by
JohnB
on Stack Overflow
See other posts from Stack Overflow
or by JohnB
Published on 2010-12-23T10:38:21Z
Indexed on
2010/12/23
11:54 UTC
Read the original article
Hit count: 387
I'm trying to draw a "targetting ring" on the ground below a "unit" in a hobby 3d game I'm working on. Basically I want to project a bright red patterned ring onto the ground terrain below the unit.
The only approach I can think of is this -
Draw the world once as normal
Draw the world a second time but in my vertex shader I have the world x,y,z coordinates of the vertex and I can pass in the coordinates of the highlighted unit - so I can calculate what the u,v coordinates in my project texture should be at that point in the world for that vertex.
I'd then use the pixel shader to pick pixels from the target ring texture and blend them into the previously drawn world.
I believe that should be easy, and should work but it involves me drawing the whole visible world twice as it's hard to determine exactly which polygons the targetting ring might fall onto. It seems a big overhead to draw the whole world twice, once for the normal lit textured ground, and then again just to draw the targetting ring.
Is there a better approach that I'm missing?
© Stack Overflow or respective owner