CreateMirror vs EntityOrder

Blitz3D Forums/Blitz3D Programming/CreateMirror vs EntityOrder

jfk EO-11110(Posted 2008) [#1]
Hi. I have a problem with a skybox in an older game that I never released, but I probably will reopen the project, but I need to solve an ugly artefact first.

The game uses the CreateMirror function for some reflection on the water surface. When I scale the skybox small and set EntityOrder to make it appear behind everything else, then the Mirror won't reflect the skybox anymore.

When I scale the skybox up until the size allows to use a normal EntityOrder, then the huge size brings up a lot of ugly rounding error (single precision float Z resolution) z-fighting, resulting in real ugly flickering parts of the skybox.

Is there a way to make CreateMirror work together with EntityOrder (with a smallish skybox)?


Terry B.(Posted 2008) [#2]
make the mirror appear behind everything, including the skybox?


Ross C(Posted 2008) [#3]
I suppose creating a texture mirror is out of the question?


Stevie G(Posted 2008) [#4]

make the mirror appear behind everything, including the skybox?


No reason why that wouldn't work.


jfk EO-11110(Posted 2008) [#5]
Thanks. Creating a mirror texture may be a solution. I could use cubemapping and simply use only one side. BUt this requires to copy a render to a texture, and to prevent blocky artefacts the texture must be 2048^2 or so, pretty slow when used with copyrect, even with flag 256. Even with its limitations, CreateMirror Mirrors performed nicely.

I will however try to EntityOrder the Mirror, in the worst case it will simply fail, so I ain't got nothing to lose there.


D4NM4N(Posted 2008) [#6]
I remember this problem. I ended up using a large squashed cube just inside the camera range (with the bottom cut off to stop Z fighting!!), which was not allowed to go below the water height (but can go upwards with clever use of fog and bkg colors.

anyway,

For your problem, what about doing a double render like this:

10 set cameraclsmode to default, and renderworld (no need for any entity ordering)

20 Then turn off cameraclsmode clearing (color or z buffer cant remember which) hide the skybox and then renderworld a second time (This should draw all the other 3D stuff over the backbuffer (which is still the sky's image) without wiping it out completely)

30 draw any 2d overlay stuff to bbuf as normal and flip() the screen

40 goto 10 :P

Hopefully it wont clear the sky in the mirror as there is no clearing of the backbuffer and the mirror shouldnt draw those areas where theres nothing to mirror. Certainly worth a try :)


jfk EO-11110(Posted 2008) [#7]
Ok, I'm not sure if I get this right, 2pass ok, this could work.

I'm afraid there is no simple solution. Since the small skybox is located at the cameras position (fps), it will also require its own mirror. I tried 2 mirrors, but Hideentity doesn't work with mirrors.


Sledge(Posted 2008) [#8]
Hideentity doesn't work with mirrors
Does here.


D4NM4N(Posted 2008) [#9]
and here,


jfk EO-11110(Posted 2008) [#10]
oops - all of a sudden it's working here too. Strange, I'm sure it didn't before...
(BTW I really should have known since it's a feature in my fps engine... I'm getting old. see kids? don't take drugs. x_x )


Zeotrope(Posted 2008) [#11]
Just a quick question:

Is a B3D mirror [createmirror()] the same as copying each and every entity, fliping them 180 on the verticle? (I understand there is more to it than justthat..but I think you get my point)

I ask this because when I look at the scene containing a mirror in wireframe, this is what it seems like; all entities are doubled and flipped.

How is it different?

(I recall once making a Quake2 map -palace.bsp- that basically had a replica of itself underneath (flipped)....made the level look like it had a shiny, reflective floor. (Although, not reflections of the entities could be acheived)


Sledge(Posted 2008) [#12]
I think that's pretty much it. If you let an entity cross the mirror you will notice that its opposite 'image' does likewise -- it's just another entity.