Announcement

Collapse
No announcement yet.

Reflection of lights in glass-floor ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    If you exhaust all possibilities, and it just isn't working out. Don't give up, there's always the "old-fashioned" way. Call it simple deception.

    Below is a screenshot of an example map I made for you....as well as a link to the map.

    The catch is.....you've got to screw with geometry and lighting to get the "effect" to work.

    Please pardon the crudeness of the example as I just "whipped" it together.

    Lemme know if you have any questions.
    :up:



    BTW....there is a little hole cut, so you can drop down to the lower floor.

    http://www.crowbarketchup.com/Rich/Reflection.zip

    Comment


      #17
      I have a solution for the over/under setup working ok. Once I get it working acceptably I'll post it (right now it's really ugly, but proves that it's possible )

      Comment


        #18
        These are the most realistic reflections of light that I ever saw in ANY map

        Before walking through inio's example-map I thought it would be nice to have reflections but after that I JUST HAVE TO HAVE THESE REFLECTIONS !!!!!!!!!!!!!!!!!!!!

        I think you should perfectionise this and make a tutorial out of it. This is most definitely something that ppl would want in their map!

        @Fecal Marmaset: Also a very nice solution to the problem I think its a smart idea. :up:

        I can't thank you guys enough for putting so much time into my prob but I really think it is worth it cause this effect belongs in more maps! Just look at it!

        Comment


          #19
          Originally posted by Yakomo
          I think you should perfectionise this and make a tutorial out of it. This is most definitely something that ppl would want in their map!
          I was going to put together a little "how to use it" deal and some example setups, but I wasn't going to go into a full tutorial because of the complexity and variations involved. If you have the skills required to do it right you should already be able to get from "how it works" and "how it's done" to "how to do it". One important thing you might want to know is that using this setup requiers at least 3 custom meshes (one simple convex one (er, concave... er... well, hard to explain) for the z cut, another more complex one for the z cover, plus one one mesh of any reflected object with the face turning reversed (inside out). Plus, if you're reflecting BSP you'll need a mesh of the visible parts opf the BSP being reflected (which you can't create in the editor).

          I'm still trying to work out draw order issues. I'm using an Interaction to draw the reflection dead last, but that makes it draw on top of any actors in front of the reflection. Not as noticeable as actors behind the reflection not drawing at all, but still not good :|. I have a potential solution, but it seems to be extremely evil and potentially breakage causing: hide actors inside reflection visibility volumes and draw them after all reflections.

          (BTW, my plan is to hide them in PreRender and show them again after PostRender, by setting the draw type to DT_None and saving the original draw type elsewhere.)

          Comment


            #20
            [edit]Don't use the code in this map. It sucks. bad.[/edit]



            The map.

            This is so horrendously hacky I'm amazed it works at all. It still has one big issue though. I can't figure out how the engine decides when and when not to draw the player model. right now I'm skipping the local PlayerControler's ViewTarget when bBehindView == false. I've had problems with the player model still drawing though.

            Another more cosmetic issue it has is that players may be chopped off as they pass through a hole in a reflection. There isn't any universal way around this but there are two options:
            1. make the z-cover mesh dip down into the hole at least half the height of the player.
            2. implement the double-draw functionality that I have variables in there to support.

            Now for the 600-words-or-less how and why:

            Create the area you want to be reflected normally. When you're done, create a model of any BSP geometry you want to be reflected. Place all reflected meshes and reflected BSP models into the map in their correct reflected location, and tag them all with some unique tag, maybe involving "reflect".

            Now make a model an approximate convex hull of the reflected room, with the polygons facing in (if you're in Maya, turn on back-face culling), and the reflection surface missing. Place this in the map in the reflected position and make sure it holds the reflection correctly. give it some other unique tag, maybe involving "cut".

            Now you need to make a model of any geometry that needs to occlude the reflection, including holes in the reflective surface and any BSP geometry around the mirror and outside the mirror that may obstruct it. It also needs to include any reflected geometry that should occlude reflections. If there is reflected geometry that will also be occluding reflections, the occluding mesh should be set with the front face of that shape facing in, so that it's backface gets rendered. Place this (or these) mode(s) in the map and give them yet another unique tag, maybe involving "cover".

            Now, select any static non-coliding actors outside the mirror that will be occluding it. Give them all some unqiue tag, maybe including "overlay".

            Finally, set up the builder brush to contain all parts of the level where the reflection will be visible from, and add a ReflectionVisVolume. Select it and open the properties window. Set the reflectionTag, cutTag, coverTag, and overlayTag to match the tags you entered earlier.

            How it works:

            As I said, this is incredibly hackish. Lets start with how the actual rendering of the reflection happens.

            The reflection is drawn as a three pass process after the world has completely draw. These steps are:
            1. cut out a hole in the z-buffer that the reflection can draw into
            2. cover up that hole in any places where the reflection should be hidden
            3. draw the reflection.

            however, this has a problem - it draws on top of objects in front of the reflecting surface. To fix this we can take two approaches:
            A. alter step 2 to also cover up anywhere that there's something in front of the reflection, or
            B. wait until after step 1 to draw any objects in front of the reflection.

            Both of these are possible in this code. Approach B doesn't work for BSP geometry (which is all rendered at once in the very first stage of rendering), so we use a model containing selected BSP faces to use in step 2. However, for objects we just hide them during the normal rendering phase and manually render them after the last step. It might be more efficient to render them immediately after step 1, but I didn't think of that at the time, and transparent actors would cause artifacting. [edit]just realized this would also cause problems with BSP inside the reflection vis volume not occluding players behind it and in front of the reflection.[/edit]

            To actually accomplish this controlled drawing we need to get draw time after the world has finished it's normal drawing but before the HUD has drawn. The first attempt was made using a Interaction, but it was discovered that the HUD and weapon in hand are rendered before interactions get control. To get around this a HUD wrapper is used that is put in place in PreRender and removed in PostRender. In PreRender we also go through the volume and object lists to find which objects need to be hidden. In the HUD's PostRender we call into our code to do the reflection drawing before calling the original HUD's PostRender.

            damnit, went over. 606 words.

            Comment


              #21
              Don't use the version in the map above, it sucks and doesn't work right even for single player.

              Use the version in this map. I still haven't tested it in a net game, but it least it works properly for single player. Here's the screenshots used in the preview:



              Two issues remain in the zippped map though:

              1. blood emitters show up in first person
              2. the translocator hovers out in front of you when you have the translocator gun active and you're in a ReflectionVisVolume.

              I figured out the fix but I didn't want to produce a whole new zip file to change one line of code. In ReflectionMaster's PreRenderReflection function, change the line:

              if (A.bHidden || hideActor == A || hideActor == A.Owner)

              to

              if (A.bHidden || hideActor == A || hideActor == A.Base)

              Make that change, hit the "recompile changed" button, and save out the map file to fix it.

              Comment


                #22
                Wow, that is godamn sweet. However on a side note, how was the lighting done? I didn't know textures were able to cast light (assuming that is what has been done here), and if that is the case how do you re-build this lighting?

                I hope that I am able to adapt this scripting to my own mapping some time, its just so nice.

                Comment


                  #23
                  Originally posted by jixor
                  Wow, that is godamn sweet. However on a side note, how was the lighting done? I didn't know textures were able to cast light (assuming that is what has been done here), and if that is the case how do you re-build this lighting?
                  They can't. Go into the groups window, there should be a "lights" group that's hidden. There's just so many (one for every wall light, two for every light in the floor panel, and a bunch more bounce lights) that they got in the way, so I hid them.

                  I hope that I am able to adapt this scripting to my own mapping some time, its just so nice.
                  I hope you can make it work. I never did test it online btw, so there's probably some bugs that need to be worked out there.

                  Comment

                  Working...
                  X