Announcement

Collapse
No announcement yet.

How to make a glass material

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

    How to make a glass material

    Hi, I want to create a glass material for windows on my map. I know there are some materials on the editor but I want it to be like a clear window (like a house window) and I would like it to have a bit of reflection like a real window does.

    Can anybody help me with how to do this?

    #2
    The fast and basic way would be to make 4 constants. Just hold down the 1 key and click inside of the material editor to make a constant node.

    Now, connect one of them to diffuse, one to opacity(Not Opacity Mask), one to specular, and one to specular power. I think they should all hook up fine. If one doesn't for some reason, then you need to use a 3 vector for that one instead. You'll find it by right clicking. I don't have UDK right now so I can't give you exact locations.

    So, once you have them connected:
    The diffuse is the tint of the glass. the larger the number(Between 0 and 1), the brighter the glass. 1.0 will be white, but that makes it very hard to see when it's also clear. Try setting it at 0.8 and fine tune it once you have your opacity adjusted.
    The specularity is how reflective it is. Experiment with numbers between 0 and 1.
    The spec power will make the reflected light focus more toward the source of the light. You'll get what I mean when you try it. You can go as high as 100 on the spec power, but you'll probably be happy with about 20 to give it a more focused reflection.
    The Opacity is how see through it is. Try setting this at 0.05 first and adjust it if needed.

    If you had to use a 3 vector node anywhere, just set all 3 vectors to the same number that you would have set the constant to. In a 3 vector, each number is a different color channel (Red, Green, Blue). In a constant, it assumes that all 3 channels are the same when needed. So, you can experiment a bit to add different hues to whatever you plug them in to. If you just want to play with a 3 vector to see what glass looks like with slight color tinting, they work on Diffuse and Specular and will tint either the glass itself or the color of the reflected light.

    Now, in the material properties (The props are visible as long as you don't have any nodes selected), make sure that you have it set to translucent mode, and I believe that there is also an option there for double sided textures. Make sure that's also checked so that your window is clear on both sides.

    That should give basic glass. You could get fancier with light refraction and such, but that would turn into a full tutorial.

    Comment


      #3
      Thanks for this, I've done this now and it looks qute good but I would like to get a reflection to make it more realistic, any ideas?

      Comment


        #4
        I was just looking for a technique for glass textures. The constants work very well as basic glass material. I already made a glass texture in photoshop, hooked it up to the diffuse instead of the extra constant and that made it even better. Tnx wyldhunt

        Comment


          #5
          there are some videos on youtube about reflective water and a tutorial for a chrome material. They both use reflection, I guess you have to combine the reflective part technique to your material in some way. I'm gonna look at this myself too.

          Comment


            #6
            For reflections you need to use a render to texure target:

            http://udn.epicgames.com/Three/RenderToTexture.html

            Comment


              #7
              It works, tnx. But when you have multiple windows, do you also need multiple SceneCapture2DActors?

              Comment


                #8
                Originally posted by numb22 View Post
                It works, tnx. But when you have multiple windows, do you also need multiple SceneCapture2DActors?
                If you want to be accurate. But people normally don't look closely at the reflection on the window. On mirrors probably but not windows. Play some of the latest games and you'll see even those games don't have accurate reflection on windows.

                Comment


                  #9
                  How would you make the glass break to pieces if you shot it or jumped through it because i changed the static mesh into a fracture static mesh but when I shoot it, only small pieces seem to break off instead of the whole thing (or most of it) shattering.

                  Comment


                    #10
                    change the FragmentMaxHealth to a lower value, makes it easier to destroy the mesh. If you want to use a player or vehicle to destroy a window you also need a physx destructible.

                    Comment


                      #11
                      Originally posted by taz1004 View Post
                      If you want to be accurate. But people normally don't look closely at the reflection on the window. On mirrors probably but not windows. Play some of the latest games and you'll see even those games don't have accurate reflection on windows.
                      Yeah true. I guess I don't need such accuracy for my game, a fake reflection will do for me. I tried another constant on the emmissive channel, that gives some reflection.

                      Comment


                        #12
                        good tutorial Wyldhunt, thanks for the info.

                        Comment


                          #13
                          A great trick for the reflection in a window, that has "many panes" is to not create each pane of glass separate instead create it as one big sheet of glass, with the reflection tied to it, and then overlay a molding to create the appearance of panes. Just like how they create "paned" windows now, its all one sheet of glass with molding glued to the outside of it.

                          Do the same thing and you will get the life like real time reflection you want, but still have small window panes.

                          Then set both meshes to be fracture meshes, with super low fracture chunks and low hp. Make sure you put explosion forces doing lots of damage or fracturing in the settings as well. This keeps things like rocket launchers from not breaking the glass all the way.

                          If you want it to always shatter, no matter where / how its shot, you can do a physics volume that fires off and blows the glass out. Just setup a trigger volume in front of the window and on damage, it turns on the physics actor and then turns it back off. If you take a ton of time to work on it you can get some super nice effects.

                          Key is to set the physics damage, and explosion / radial force damage to the fractured mesh.

                          Also if you want you can setup your fractures to be about the same size of each pane, and allow players to shoot them out one by one.

                          Comment


                            #14
                            @Mtcoder:

                            I'm going to have to try that trick out myself. Sound like it could have potential.

                            @Thread Overall:

                            I'm trying to build a collection of several glass maps. scratches, Streaks, splatter. Wires meshing. bubbles and imperfections found in some glass. Even have some toothpaste splatters and water spots patterns in the work as we speak. These are really not hard to make in Photoshop or Gimp.

                            My main trouble was getting the glass to look convincing. Strong specular helped a bit but since it slightly reflective This helped sell the effect even more.

                            What I needed was just the faintest hint of the reflections. a little bit goes along way it seems. Some games even some of the "reflective" surfaces of a few of the maps in UDK are a bit to strong and end up detracting from the effect rather then aiding in it.

                            Now that, I see how to do this myself. I now have the means to make my own "reflective" glass. Thanks guys for bringing this up. It helped a lot.

                            Comment


                              #15
                              Here's a really nice distortion effect that I came up with a while back. Combined with a nice reflection (not included here) and the rest of what's been suggested, you should get some really nice glass indeed. This works fantastically on curved surfaces like the sample image I showed, but its' not that bad on flat planes of glass and a normal map will distort it further given that it uses a reflection vector.



                              BTW, the fesnel used in this scene has a value of 0.1 and you can obviously ignore that subract node that's not connected to anything.

                              Comment

                              Working...
                              X