CreateMirror() problem?

Blitz3D Forums/Blitz3D Programming/CreateMirror() problem?

MeowZ(Posted 2007) [#1]
I think there is weird thing about CreateMirror().
An object which is under mirror plane also appear above the mirror. Anyone can help? Here is the code:

Graphics3D 800,600,32,2
SetBuffer BackBuffer()

;Lights
light01=CreateLight()
PositionEntity light01,15,20,15

;Plane
plane=CreatePlane()
EntityColor plane, 0, 30, 255
EntityAlpha plane, 0.8

;Mirror
mirror = CreateMirror();

;Camera
cam=CreateCamera()
PositionEntity cam,0,5,-15
RotateEntity cam,10,0,0

;Cube
cube=CreateCube()
ScaleEntity cube,2,2,2

cube2 = CreateCube() ; no PhysX object
PositionEntity cube2, -10, 3, 0
EntityColor cube2, 255, 0, 0

cube3 = CreateCube() ; no PhysX object
PositionEntity cube3, 10, -3, 0
EntityColor cube3, 255, 0, 0


sp = CreateSphere ()
EntityColor sp, 255, 0, 0


Repeat ;Main Loop

If (KeyDown(31)) ShowEntity mirror ; press S to show mirror
If (KeyDown(35)) HideEntity mirror ; press H to hide mirror

time=MilliSecs ()

UpdateWorld()
RenderWorld()


Text(0, 0,"press S to show mirror")
Text(0,20,"press H to hide mirror")

Flip

Until KeyHit(1)

End


b32(Posted 2007) [#2]
Nice example. And yes, I believe that is 'normal'. Objects above the mirror will appear under it, and objects underneath it will also appear above it. The only way I know to deal with it, is avoiding objects from getting under the mirror. Or render a second camera onto an object, and use that as a mirror, however that method can be quite slow.


John Blackledge(Posted 2007) [#3]
Yes, this is a known 'feature' of Blitz mirrors.

I also found that using a mirror caused my sky-dome texture to break up, but that may just be my card/drivers.

I think the only time I've ssen this used succesfully is with a tiled floor (shiny marble look) where there was absolutely nothing underneath.


_33(Posted 2007) [#4]
Actually, why don't you define a second camera, and use that as a mirror, it's absolutely perfect for what you might be looking for, and it doesn't have these issues. All you have to do is grab the image from the second camera and use that as a texture for your mirror. How does it sound? There is an example of this in the code archive, but I enhanced it some bit. Let me find my version...