Monday, April 6, 2009

Creating a glass object with Max and V-ray

It is simple, but I guess it will help on some people :). I will make a special glass using Max and for the rendered V-ray. Most of the people do glass by using lathe, my version is a little different. So here are the steps:

1. Create a line in front viewport that will be the profile of the glass:

Draw a circle in top view

Select the circle, go to the Modifiers list and select Bevel Profile, and on Pick Profile, select the first shape:


Convert this to an editable Poly select the top and delete

Go to Modifiers Panel and select Shell (is available only for Max 6 as I know), and adjust the thickness of the object how you like

Now to make the special for of the glass we need to cut a little of the top, using booleans. We will use a box like so:

And go to Compound Objects and use Booleans

The problem is that now we have some artifacts - the face there is not ok. Deleting the face or the edge has now worked.

So we will insert a vertex or two on that line and use Target weld to the opposite vertexes to correct this.

Same problem here:

Now all is ok. Select the edges and chamfer them twice, just a little. If you wish to make the bottom of the glass thicker just select the bottom of the glass and drag it down.

I have modified the shape of the glass by using the Taper tool from the Modifiers list.

First choose V-ray renderer. Not fancy rendering settings, just in the V-ray: Image Sampler(Antialising), turn of the Adaptive subdivision. For the glass materials use this settings:

and for the liquid this

For the lighting I have used an Omni light, V-ray shadows cheked and on V-ray shadows parameters check Transparent shadows and area shadow. Use a plane for the scene and assign a white color to this.

It looks fine, but not really :). The glass need something to reflect. To do this use a HDRI map. You can find some HDRI images at this address http://athens.ict.usc.edu/Probes/

and assign this to V-ray Environment

and the result



Read more...

attachMovie in Actionscript 3.0

You might have been wondering where attachMovie is gone in Actionscript 3.0, well no need to look for it because it's gone. In Actionscript 3.0 you will have to use another way to attachMovie clips on the stage at runtime, I am going to tell you all about it in that little tutorial.

Tutorial The default way

When you create a movie clip in an AS3 Flash file and select "export for actionscript you will notice that the Class and Base class are automatically filled up (see picture below), what does that mean in the AS3 world?

Flash automatically fills the Class name field with the name you gave to your movie clip, square in our case. Also since it is a movie clip that we are creating it automatically fills the Base class field with flash.display.MovieClip.

You don't need to worry about the Base class, that means that your movie clip is going to inherit of all the properties and methods assigned to the MovieClip class. In AS2.0 this was happening in the background but you just did not know about it.

More importantly you can also see that the class square has automatically been assigned to the movie clip, this is an important bit, it means that the compiler will be automatically looking for square.as (a physical class that you actually created) in the directory where your Flash file resides, if it can't find it it will create a default one for you. You don't need to create a square class if you have nothing to put in it.

Ok, our movie clip is now sitting in the library, we now need to create the code that will attach it on the stage, this is what we are doing below:

var mySquare:square = new square();
addChild(mySquare);

As simple as that, we create an instance of the square class (that will automatically be created by Flash or that you created yourself) using the new keyword and then we use the magic word addChild with the name of the square instance we just created. Notice that we are not using any linkage id anymore when we use addChild but instead we are using the name of the instance of the class.

That's it if you run your file you will now see that your movie clip is attached to the the top left corner of the stage.

Create your own class

If you want to create a little class for your square, it is easy, got in FILE > NEW and in the window select ACTIONSCRIPT FILE

Now you can create your class, a very simple square class could be like the one below:

package {

import flash.display.MovieClip;

public class square extends MovieCp{

public function square(){
trace("hello I am an instance of the square class");
}
}
}


Save the actionscript file as square.as in the directory where your FLA resides and here you go, Flash will now use that class instead of a default one.

Hopefully this little tutorial will be helpful for you :)

Read more...

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP