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

Started by
7 comments, last by honestee 19 years, 11 months ago
I want to know how to implement this... (this is a screen shot of C&C) let me know a idea (or related link?)...
Advertisement
Uhm...implement what? Shadows? Buildings? Tanks? Shadows?
2 + 2 = 5 for extremely large values of 2
I mean the brown part of the bulldozer, which is hided by a building...




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]
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
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.
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.
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!
Oh~ Great Idea!
Thank you all!
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.

This topic is closed to new replies.

Advertisement