Total Pageviews

Thursday, April 21, 2011

making glass in 3ds max

Glass in Max

 
Most people think that they already know how to make glass in 3D Studio Max, and maybe they do, but there's more to it than just turning down the opacity. That's a technique that may work for background stuff, like an unimportant window or bottle and, frankly, that's what I do in such cases, too. However, when your glass is an important part of the scene, you're gonna need glass that looks and acts like, well, glass! ...and not something 'half invisible.'
When you need 'real' glass you need to turn the opacity all the way up to 100%. I know what you're thinking (you were suddenly reminded of the first time you wanted to shut Windows down and were told to click on 'Start', right)? This actually does make some kind of sense, though, (more if you're a programmer, I guess). If you want a material to display its properties correctly, you need it to be all there, not half, or a third.
Along the same line of thought, the structure of your object is important, also. Five and dime bargain glass isn't going to give you the results you want. You'll want to use a model that provides a good deal of geometry, that is to say, it should be pretty thick. This sort of model is kind of hard to find, but the good news is that you don't have to be a master modeler to make something that looks good in glass. In fact, you can even download the subject of this tutorial, if you want, or you can make something of your own.
Click HERE to download the model.
Spline This isn't a modeling tutorial, but the geometry is important, here, so a couple of pointers are in order. This is the spline I used to create the chalice we'll be working with here. Experienced modelers will note that it's going to be all one piece and the 'cup' of the chalice is pretty thick, not to mention the stem. To be honest, this is a bit exaggerated, but I wanted to drive home the 'thickness' concept.
Chalice Ok, so now we click a couple of things and revolve the spline into the chalice. (For those of you who are wondering, I don't do any modeling in Max, just Rhino. Don't get me wrong, I love Max, but Rhino is for modeling). There, we have our model, now to use and texture it in Max.
First of all, you need light. Even the best, most expensive glass is black in the dark. Global lighting works pretty well if you use, at least, a background, but for the best effects you'll want to use your skills at proper lighting. That should give you something to work on later.
Basic parameters In the Material Editor the first thing to do is check the '2 sided' box. I have found that using the Metal shader is best for this kind of material, but not always, so bear that in mind. Then set your diffuse color to black. (R=0, G=0, B=0). This is important for creating really clear glass, but, I may as well tell you now, you'll figure it out anyway, tinting your glass is just a matter of working with the diffuse color. You'll probably find that you'll want to keep the color as dark as possible, for best results, but for clear, it's black.
As we've already mentioned, the opacity needs to be at 100%.
Specularity and glossiness I'm setting to 100 each for this instance, but I often will make the specularity quite high (200-300) and gloss about 40 or any settings in between depending upon the effect I'm after.
Index of Refraction setting Open Extended Parameters to adjust the Index of Refraction. Granted, this is supposed to be about glass, but let's face it, this is good for any sort of transparent material. About the only things that will change are the color and the Index of Refraction. If you're one of the few people who has not already committed these values to memory for most common materials, you'll find a cheat sheet by clicking here. You might want to make a note of this link or bookmark it. You never know when you'll forget this stuff again and need to look it up. Since I'm using just regular everyday glass, my IOR is 1.459.
Map settings
Open up the Maps settings and by Refraction we want to select Standard Raytrace. Set this to 75%. Later you can experiment with values, those between 50 and 100% produce desirable results depending upon your goal.
Tace depth setting
Trace Depth is accessed by selecting Rendering > Render (or press 'F10') and then choose the Raytracer tab.
This, you probably realize, is going to increase your render time. In fact this will give your computer a fairly decent workout since the default trace depth setting of 9 is usually not adequate to produce a good quality glass rendering and you'll find black areas and junk in your subject that shouldn't be there. How you determine the necessary trace depth is up to you. My method is to raise the depth by a couple of notches and do another (painfully long) test render. Since this can take several days, you might want to use another clever trick I've heard about and just set it in the stratosphere and do one (painfully long) test render. Here's my method:
Trace depth 9
Global lighting only is used here with a more or less randomly chosen surrounding texture and background.
Trace depth is set at default (9).
You can see the differences in the quality as I increment the depth and the black areas disappear.
The arrows indicate areas I'm not happy with.
Trace depth at 12.
Trace depth at 15.
Trace depth at 18.
td 36 Well, I'm now 2 years older and still working on this tutorial. I'm up to 36 on the trace depth, but parts of my glass are just as dark as night. Hmm. Dark as night? Hey! You don't suppose a little more light would help, do you?
Since I've just been relying on global lighting so far, why don't I give it a little brighter background and see what happens.
More light Eureka! That's the secret! So now we know that we can affect the quality of the glass with two factors, light and trace depth. There's one thing you should realize right from the start, though, and that is that glass normally contains some black areas and may even be refracting some from the environment, so you're not duty bound to get it all out, just that which doesn't belong. How do you know which is which? You're the artist, you decide!
eflection map-poor choice
The only thing 'clear' here is that this was a poorly chosen reflection map (at only 10%).
Ok, now you may want to deal with reflection. Let's be clear on the fact that there is no law that says you have to address this, at all, beyond setting specular levels. You can use the Standard Reflect/Refract here, but I can't recommend it unless you've got a lot of time to kill. Your CPU is already going to be preoccupied with the refraction business, but if you want more natural reflections and have the time, go ahead. Otherwise you should just create reflections with a map. Just be aware that any reflection map you use is going to affect the transparency and color of your glass even at low strengths.

Not Mona Lisa, just glass.

Well, it's not Mona Lisa, but it's a pretty fair hunk of glass.

Variation

Here's a variation with some gemstones and metal added.
That about does it for today's lesson. Your homework for today is to look in the archive that contained the chalice and notice that it contains a file called 'contents.3ds.' This fits neatly into the chalice and can be rendered as a liquid inside the chalice. This will let you play with some colors and quiz yourself on refraction indices. Have fun, but don't spill anything.
By the way, I know I'll be asked, but ,no, I don't know if this works in Poser so you can make a glass outfit for Veronica.
Anyway, I'm off to finish a stained glass window, now.

No comments:

Post a Comment