Stencil Mirror demo

Blitz3D Forums/Blitz3D Programming/Stencil Mirror demo

Tom(Posted 2004) [#1]
Hi,

Here's a Stencil Mirror demo for v1.88:
http://www.tomspeed.com/stencil_mirror

Get all the files, copy the userlib contents to your blitz3d\userlibs folder. NOTE! these have changed since the shadow volume demo and are specific to this demo. (back up old dx7test files if you wish)

This is based off a DX7 SDK demo, some things to note:

ATI cards: It works on some, doesn't on others. Beakers new x800 with latest drivers works, bot_builders Radeon 9600 works. Lucids Radeon 9700 doesn't. (drivers??)

Works fine on NVidia cards. Works fine on Zeniths built in Intel chipset! :)

There's more than 1 way to do do stencil mirrors, dependant on the order you do render color/mirror/reversed mirror, this demo actualy uses 1 more render pass than I 'think' is needed, but I can't seem to get objects to render in front of the mirror without the last pass.

There's also a glitch when the mirror is at certain angles, dunno what's causing that yet, though I suspect it's something to do with me using User Defined Clipping Planes.

Stencil mirrors can be any shape, so long as it's flat on Z axis.

Speaking of which, you can do mirrors using no stencil and just clipping planes, but you'd be forced to use a 4 sided mirror, I'm trying that method next.

Go ahead and experiment with the renderstates!...and see some weird results :)

Cya!
Tom
p.s Thanks Mark for negative scaling!!! That saved me from doing a bunch of matrix maths to reverse the camera :)


fredborg(Posted 2004) [#2]
Very funky!


mongia2(Posted 2004) [#3]
good work

mongia


Ziltch(Posted 2004) [#4]
Looks Great!!


IPete2(Posted 2004) [#5]
OMG!

Brilliant man! Absolutely brilliant! :)

I am glad I looked at this now, you have achieved something very special here I think. Tom you are beginning to show us what the hidden possibilities are for us using your dll...

Congrats! I think it is a wondferful demo!

IPete2.


Tom(Posted 2004) [#6]
The DLL just wraps a few extra DX7 calls :)

The tough part is figuring out the stencil stuff. As Skid suggested upon the release of 1.88, it's well worth getting the DX7 SDK for the included demos source, and reading up a little on how stencils work.

At the moment I have user defined clipping planes working, I use them in that mirror demo. Querying my card, it says I have 6 of them available to use.

I wonder if they'd be useful for use in portal rendering?

If you're not sure what they are, clipping planes prevent any geometry behind them from being rendered. For example, in the mirror demo, when rendering the mirrored view I didn't want to render any geometry behind the mirror, so I set a clipping plane to match the mirror plane exactly, and just render.

The whole multipass rendering deal is quite something to wrap your head around, especialy when we've been used to Renderworld:Flip :)


Tom


Dock(Posted 2004) [#7]
Looks fantastic.

I'm curious - what would happen if you applied a normal-map to this mirror surface?


BlitzSupport(Posted 2004) [#8]
Well done -- runs fine here on Radeon 9800!


Beaker(Posted 2004) [#9]
Dock - there isn't a mirror surface. Its not a mesh or a texture.


Braincell(Posted 2004) [#10]
Awesome.


Genexi2(Posted 2004) [#11]
Nice demo....how much faster would it be to use stencil buffers to create a mirror then using a cube-map?
(problem I find with cube-map is you need a 512x512 texture render at minimum for it to look nice...)


Beaker(Posted 2004) [#12]
Stencils are a much better solution than cubemaps. They give you an unpixelated reflection, they don't require a copy to texture, and stencils should run on much lesser cards than cubemaps require.

They should be significantly faster.


RemiD(Posted 2013) [#13]
Hello,

Sorry to dig this old post.

Does anyone has the Stencil Mirror demo by Tom ?

If yes, can you please upload it on file hosting website or send it to my email address (see my profile)

Thanks ! :)