Mirrors

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Vl0sk

New Member
Jan 23, 2005
9
0
0
Hello; in one of my projects, realtime reflections would be extremely useful. Unfortunately, I've tried every trick in my book, and I can't get anything to work in the Unreal Runtime; perhaps someone has some insight as to why:

Basic Stencil Mirrors. I know all about stencil, but when I try to use it here, it only functions properly on large subtracted bsp surfaces. If I use it on a smaller surface / an additive surface [aka a mirror in a bathroom], its as if the reflection is inverted; as if I'm seeing what a reflection on the opposite side of the mirror might look like. An interesting effect, but hardly a mirror.

Warpzones. A dirty trick, but one could conceivably fake a mirror using warpzones... only, they simply don't render. The zones teleport properly, but that's about it.

Scripted Texture - DrawPortal. The function causes a "No Label" exception, and crashes to desktop. Using a non runtime generated scripted texture [think a mapper adding a TV + Camera to his map] I don't get the crash, but I get a black surface. Were scripted textures to work, I could theoretically get something mirror-like running or at worst an unmoving [and unnatural] reflection, but still a reflection.

Cloned Geometry. A _really_ dirty trick [though useful at times], but my space isn't conducive to this solution as in many cases you'd see this cloned geometry outside the mirror. Would it be possible to restrict rendering of a series of objects in world space to a surface, such as my very basic rectangular mirror?

[Cubemaps are fine for reflections, but the real necessity is that I reflect, in realtime, geometry which is subject to change.]

Any ideas? As far as I know, stencil works in UT2004, and I've used Canvas.DrawPortal successfully in this version of the runtime [OpenGL support isn't an issue], and thus find it really hard to believe that the same function in the scripted texture fails so spectacularly. I have Stencil enabled in the ini, and I've tried every other flag option I can think about. I'm running DirectX 9 c on a Radeon 9800 pro, in Win XP Pro.

This project is both code and geometry based.

Thanks for your time!
 

duk5ie

New Member
Jul 30, 2005
15
0
0
How can it conceivably be done with warpzones? Two zones are needed at least, but they would have to overlap impossibly... And using just one zone to teleport to the same location doesn't work. Apart from it not rendering, how did you set this up? Even if this did work, there's a limitation on warpzones that won't allow you to see other players across planes.

Stencil mirrors will properly reflect BSP geometry (both subtracted and additive) and meshes only. Static meshes get their normals inverted so their reflected counterparts appear inside out. Two-sided materials will not correct this. Having the static mesh's faces doubled so that they are also facing inward is a way around this, but these faces receive light as if they are still facing inward and they will most likely appear black in the reflection. It seems the mirror surface function hasn't been updated since the first generation.

I find cubemaps fine for reflections on a non-flat surface (eg. fluid).
Don't even bother with the scripted texture. I got the TV + camera to render properly, but this is not a reflection at all.
Space is not a problem with cloned geometry because you can combine this with the use of warpzones. But you will not even see your third person reflection now unless you code a hologram of yourself in the reflected zone.
If your warpzone is not rendering, create two new materials: a shader and a constant color. You don't have to do anything to the constant color, just assign it to the shader's Diffuse and Opacity. Assign this shader as the texture for the zone portal.

I'd suggest sticking with stencil mirrors in relatively small rooms, such as a bathroom, that contain BSP geometry only. And don't forget to zone.
 
Last edited:

Vl0sk

New Member
Jan 23, 2005
9
0
0
A Reply!

The nature of my simulation allows me to have a duplicate of the room, so while I admit its a dirty solution, you could concievably make a warp-zone mirror... the player doesn't need to render as there is no visible avatar, and there are no other players or effects necessary. Just as a test, I setup a basic, textbook, warpzone in the runtime... even with the material solutions that you mentioned, it still doesn't render [though it does cause an odd anomoly in the skybox]. I've made more than my share of warpzones in my time, so I know the same solution that works in UTkx, U2, and even UT99 doesn't not work [for me] in the runtime.

Stencil mirrors; http://vlosk.ninefires.net/MirrorWoes.jpg

A picture is worth a thousand words. See the problem? [its like its reflecting that that surface would see from the wrong side] As far as I know, Stencil mirrors will work with static meshes as well [reflect them, _not_ as a surface]. The simulation I'm working on is primarily composed of dynamic objects in code, rendered as a static mesh. [Because of the dynamic nature, there is very very little BSP in this project]. However, I'd settle for Stencil mirrors actually looking like mirrors before I experiment if it will reflect my meshes or not. [I can have an inverted version of the model, and if matching the lighting on the inverted model is my greatest worry, then I'm in great shape :p]

Cubemaps are great for non-flat reflections, but even if I had to use a cubemap here, the key issue is that the mirror be able to somewhat reflect geometry which is subject to large amounts of dynamic change. Its simply not possible to have enough pre-made cubemap textures.

ScriptedTextures _should work_, and even though the result will look pretty sad [though there are ways of helping], at least they should give an image based on the current form of the dynamic geometry. Emphasis on _should_, all I get in the runtime is a No Label crash or a black texture.

Thanks for the reply though!

P.S. If anyone knows a way to get dynamic mirrors working in the runtime [The non engine side of our project requires DirectXc, but I'll hear you out on any driver type suggestions] I'd be willing to share my solution for Bumpmaps in Unreal 2x / Unreal Runtime. The IceTexture solution is pretty spiffy, but I find this method produces a visually stronger result. I have a before / after screenshot of the effect: http://vlosk.ninefires.net/BumpMappedTiles.jpg
 

duk5ie

New Member
Jul 30, 2005
15
0
0
Well, whatever, the problems still remain. Shrimp from the UnWheel mod has been able to get real-time reflections on the cars, hopefully he could help us out.