Archived

This topic is now archived and is closed to further replies.

honestee

I want to know how to implement this...(screen shot of C&C)

Recommended Posts

hmm... that's an interesting question. I'd like to know the answer too.

I suppose you could do it something like this:
1) Draw the terrain
2) Draw the building, and draw it into the stencil map, too
3) Draw the bulldozer (using z-buffer to make sure it's hidden by the building)
4) Draw the bulldozer again, but this time: draw it with texturing off, all the vertices a single colour (brown), give it an alpha value, set up the blending so it will tint the building, and set the stencil test so that it only draws where the stencil buffer is set (and turn off z-test, of course)

I don't know if that's the best solution though.

John B

[edited by - JohnBSmall on May 20, 2004 7:41:25 AM]

Share this post


Link to post
Share on other sites
Yep, JohnB is right. Its the same technique as used with shadows. Have a look for some stencil shadow tutorials for shadow methods, and it should be easy to convert to that effect.

Share this post


Link to post
Share on other sites
A simpler method (that doesn''t need stencil buffer shenanigans)
1. Draw terrain/buildings.
2. Draw tank normally.
3. Draw tank with depth offset (whatever the DX equivilent of glDepthOffset is). Draw with solid colour or alternate texture, *only* when depth test fails.

Share this post


Link to post
Share on other sites
Not sure why you need offsets.
1)Draw Scenery as normal
2)Draw tank as normal (with ZTest: draw if newZ3)Draw tank in solid colour (with ZTest: draw if newZ>=oldZ)
ie draw brown only when you would not normally draw at all - anti-Zbuffering!

Share this post


Link to post
Share on other sites
quote:
Original post by d000hg
Not sure why you need offsets.
1)Draw Scenery as normal
2)Draw tank as normal (with ZTest: draw if newZ3)Draw tank in solid colour (with ZTest: draw if newZ>=oldZ)
ie draw brown only when you would not normally draw at all - anti-Zbuffering!


''cos with that method, on the second time your new z will always equal the old where the tank was visible, so you''d end up tinting your entire tank solid colour.

Share this post


Link to post
Share on other sites