Home Technical Talk

Reflections in UE3 (Cubes? Cameras? Tutorials?)

polycounter lvl 17
Offline / Send Message
Incomitatum polycounter lvl 17
• I have finally gotten my model into UE3 and textured, but the texture seems a little flat.

The normal and specular maps are good but not producing the effect I want.

Looking hard at the model I realize I need a portion of it to seem reflective. I have seen these surfaces all over Mass Effect.

Now I am wondering how to create my own. I am curious if I can use a Cube/Or Environment Map, and how to actually make one? I know how it is done in Source, but not UE3.

My searches have yielded mixed results. The closest tutorial I could find was about tieing a camera to the reflective surface. Well, this is on a prop (a pillar) that you can walk all the way around; I don't know that a camera would work. Besides it is hard for me to believe that they tied a camera to every reflective surface in Mass Effect.

Please, if you have any examples of working reflections, and work flows on how to build cube/environment-maps that would be very helpful.

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    Some tips I wrote up for making cubemaps.
    http://wiki.polycount.net/Diffusely_Convolved_Cube_Map
    That's for an ambient-lighting-style cubemap, but you use the same process to make brushed-metal cubes too, you just don't blur it down as much.

    As for making the actual cubemap to blur down, there are lots of old threads about this, do some searches.
  • Incomitatum
    Options
    Offline / Send Message
    Incomitatum polycounter lvl 17
    Mr. Chadwick,

    I may be missing your point. I have a room with a shiny pillar in it (a cylander). I want the pillar to reflect the room. Is there a way to capture what the pillar "sees" and map that to an environment map? While your tutorial is in depth, at first glance, I am not seeing anything about capturing cubes from inside your levels.

    I will look harder though.

    Thank you for taking the time to reply.

    -Andrew
  • Eric Chadwick
    Options
    Offline / Send Message
    Most games use precreated cubemaps, rather than "live" reflections. A live reflection can have a significantly higher performance cost (framerate) than using a cubemap.

    A live reflection usually means the engine/shader creates the camera on-the-fly, moving it in relation to how your viewpoint moves around. Also the shader usually simplifies the 3D scene that gets rendered by that camera, for example removing all dynamic props, lowering the LODs, hiding meshes not likely to be seen, etc.

    Pages 95 and 96 of this paper show the simplified scenes that the reflection and refraction cameras "see":
    http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf
  • Incomitatum
    Options
    Offline / Send Message
    Incomitatum polycounter lvl 17
    In Source, there is an entity you can place down that will make a cubemap for you based on what -it- sees in 6 different directions. You place about one of these in each room, and the reflective thingys act as though they are really reflecting the room. I was curious if there was an entity I could place at the base of my pillar (which is in the center of the room for this test) to get similar results. Afterward, I would just then tie the reflection-mask and the cubemap together.

    If indoors, how do you suggest I make a cubemap, since I am not going to be using a sky and such. Perhaps I just need to make a painterly like map in Photoshop that represents the gradients of lights and tones in that room.
  • Marcan
    Options
    Offline / Send Message
    Marcan polycounter lvl 12
    Agreed, having used the Source and Unreal engine extensively I can tell you Source handles the cubemap generation pretty well.

    Unreal however, does not. Not as much of an automated process I mean. You will have to manually create a material called "RenderToTextureCube" and in the scene, place an actor with the "SceneCaptureCubemapActor" class. This will create 6 textures reflecting the 6 sides of where this actor will be standing. This will be your cubemap.

    You will need to recreate them manually everytime you change something in your scene though. I usually use placeholder cubemaps until my scene is pretty advanced, since it will change a lot in the early stages and I tend to export and touch up my cubemap textures in Photoshop afterwards anyways.
  • Eric Chadwick
    Options
    Offline / Send Message
    I'm not a UE3 guy, but I bet there's a tool to render cubes from your level. If not, it'd be trivial to script one by matinee-ing a 90°-FOV camera into the six directions and screencapping from each.

    oops, Marcan beat me to it!
  • Incomitatum
    Options
    Offline / Send Message
    Incomitatum polycounter lvl 17
    Marcam wrote:
    You will have to manually create a material called "RenderToTextureCube"

    This is where I start to get lost. I am supposed to create a new material? I think I need to create a texture so I can use a mask in my pillar material to dictate where it reflects and how much. As such, I am still learning the material editor. Can I blend between two -full- materials, and in such a limited, masked, way?

    Thank you for the help.

    ::EDIT::

    I searched some of your terms and came up with a tutorial. I will try it out and then ask you what to do if I mess it up and get stuck. Thank you for being so informative.
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    http://udn.epicgames.com/Three/MaterialsTutorial.html#Environment%20Maps

    always good reference - especially since they've got a section on HDR cubemaps now
  • Incomitatum
    Options
    Offline / Send Message
    Incomitatum polycounter lvl 17
    Every time I close UE3 or it crashes, after I start it up again, my level comes in fine, but it says it can't find my pillar and thus has used NULL objects.

    1: Where should I be saving my package so it can find it?

    2: Is there a way to -point- those nulls to my Package? I don't even know how to select them since there are not -there-.
  • Incomitatum
    Options
    Offline / Send Message
    Incomitatum polycounter lvl 17
    Alright, Here is what I am doing...

    1: In Generic Browser; File/New; Name: Cube_Test, Factory: RenderToTextureCube, Width: 512.

    2: In Generic Browser; Actor Classes: Actor / SceneCaptureActor / SceneCaptureCubeMapActor.

    3: Rclick the floor in my scene where I want the Actor, Add: SceneCaptureCubeMapActor.

    4: Move the SceneCaptureCubeMapActor into better position.

    5: Doubleclick the SceneCaptureCubeMapActor and associate it's TextureTarget property with the RenderToTextureCube (now the Actor looks like a Mirrored Ball).

    6: Change the NearPlane and FarPlane to 1 and 1024.

    7: Rebuild Lights.

    8: From here things get blurry and I get errors. Thing is, once I have the RenderToTextureCube texture complete, I am not sure what to do with it. I was thinking about putting in with a mask and "Add"ing it to my Diffuse Texture Sample, also using it for the Color of my SpecMap. Regardless, I get an error no matter what I do with it (I -am- supposed to bring it in as a Texture Sample right?), the error is...

    "Coercion failed: Parameter. TexCoords[0].xy: float2 -> float 3"

    So I decided to try and Rclick my texture of the Cube and tell it to "Create Static Texture", from here it makes 6 textures and a 7th Unfolded Cube texture. It doesn't matter though because it then give me the same error if I try and bring in my Unfolded texture.

    Also, am I to understand that this method creates (or -will- create if I can get it right) a reflective surface that constantly updates? Is there a way for me to create a static Cubemap from all this? I think that would be rather expensive.
  • achmedthesnake
    Options
    Offline / Send Message
    achmedthesnake polycounter lvl 17
    Ooooh, if Eirc (chaddy) is still haunting this topic - i'd like know how you'd create the custom cubemap tex? - just take 6 screenshots of the area around the 'target object' and stitch them in pshop? - or is there an inbuilt capture function........


    err. didn't look at the previous posts :( sorry
  • salman_fas
    Options
    Offline / Send Message
    I wrote a tutorial about using reflection vector in Unreal engine3(no cube maps though). Hope it helps
    http://www.salman3d.com/tutorials/tut1.html
  • Incomitatum
    Options
    Offline / Send Message
    Incomitatum polycounter lvl 17
    Wait... Reflection Vector is derivative of the Player's Camera? Heck, that might be what I want to be using, right?

    Oh, and your models/textures are sex-tastic.
  • Marcan
    Options
    Offline / Send Message
    Marcan polycounter lvl 12
    Wait... Reflection Vector is derivative of the Player's Camera? Heck, that might be what I want to be using, right?

    Yes, and only this sometimes can do the trick.
  • Scott_W
    Options
    Offline / Send Message
    sprunghunt wrote: »
    http://udn.epicgames.com/Three/MaterialsTutorial.html#Environment%20Maps

    always good reference - especially since they've got a section on HDR cubemaps now

    We kind of freaked out (in a good way!) when Epic appended that HDR section to the UDN . It's the technique I figured out when trying to get reflected light sources to appear brighter in the cube reflections on some glass objects we created for a hydro dam level. Using the basic theory of high dynamic range photography and a few minutes of trial and error in the material editor, that popped out. I guess Epic liked it enough to add it to the site!

    Knowledge sharing with developers is pretty badass.
Sign In or Register to comment.