Exporting textured objects from 3d MAX to PV3D 2.0 tutorial

f

[SEE WHAT YOU ARE GOING TO LEARN]

This tutorial explains how to make a 3d object with 3d Studio MAX , unwrap the uvw, export it to actionscript 3, import to your papervision 3d project , texture it and deploy as a flash movie :)

What you need to use this:

1. Papervision3d (latest classes included) – http://blog.papervision3d.org
2. Flash CS3 – http://www.adobe.com/flash
3. 3D Studio MAX (I’ve used the latest 2009 ver. Should work with previous ones too) – http://www.autodesk.com
4. AS3GeomClassExporter for 3DStudio MAX (included) by http://dreammania.net – extended by mr.doob.
5. Some basic modelling and texturing skills to make something. Some Max interface knowledge proofs useful here too.

You could use different software for this (Maya and so on..) but I didn’t test it so I’ll focus on MAX right now.

I’m not a real tutorial writer so I’ll make this as short as possible – explaining with screenshots where possible:)

Let’s get on with this:

Part I – MAX

1. You need to open max and install the script (AS3GeomClassExporter) – this screenshots shows where and how to do this:

2. Run the script like here (it executes and shows the panel when you select the script from the combobox):

3. Configure the script for PV3d 2.0 like I did it here:

4. Model anything you want. I’ve made a simple chamfer box here:

At this point you should remember a few important things:

- use as little polygons you can handle to improve the speed (low-poly is your friend here:)),
- you can connect (boolean, modify mesh, combine with loft or lathes and so on) everything you want. But you must keep the object as ONE mesh – closed one. If you want to combine many objects you have to do this in papervision – not in max – the exporter allows to export 1 object.

Here is a sample Boolean (with union) of the chamfer box and a loft made of text and a line (for loft depth):

AS you can see in properties this is a single object with a simple structure (low amount of faces and vertices).
5. Now a very important part! You need to place the PIVOT for the object correctly. The pivot is the point which papervision would read as 0,0,0 coordinates. So it is crucial for rotating/positioning and moving the object later. This is how you do this

6. Now it is time to prepare the UVW texture coordinates and map for the object. We’ll do this in parts:
a) You need to unwrap the Mesh using UVW Unwrap. Select the object and do EDIT/select modifier Unwrap UVW from the combo:

b) Now you need to select Face from the Unwrap modifier and select all the faces (CTRL+A) of the object – then press “EDIT..”

c) A new window will open up – the selected faces (red) will overlap each other – this is time to unwrap the mesh so select MAPPING from the main menu –> normal mapping. You can modify some parameters in the window that appears – but for this object it is just fine to CLICK OK:

d) Hurray! it is done. The mesh will unwrap like in the screen below. Of course you can modify the unwrap – play with the unwrap tool a little yourself ;) . In this case the automated unwrap worked rather fine (the mesh was simple) and I don’t need to correct anything here. I have one overlap which I should correct but it’s not important for this tutorial.

e) Now it is time to render the map (you need something to paint on and texture in pv3d :) ). I would suggest rendering two maps in the same resolution (don’t select them too big – a 1500×1500 map is just fine and fast for a complicated object in pv3d if you don’t use too many objects). One with the edges visible (this can be helpful when drawing in photoshop – you can  apply the edges on a different layer and use as a helper :) . The second one shaded – to use as a canvas for painting.
The renders aren’t to pretty but they should do:

You are done with Unwrapping at this point :) Congratulations. Lets proceed to the next section.

f) IMPORTANT EDIT (10.2.2009) 

You can also use a better and simplier unwrapping tool in 3DsMax. – RENDER TO TEXTURE (the ‘0′ [zero] key from the keyboard) – there is an automatic unwrapper there (which works really good) and extended render options (you can render different masks etc. on the same map using the textures on your scene) – a great tool for baking your texture too !!! Please use it instead of manual UVW unwrapping used here by me wherever you can! :)

7. Now the fun part. As you have the object created (it is a single closed mesh with uvw coordinates applied and ready to go!) you can now EXPORT THE AS3 CLASS with this object :) Select the object with the select tool and press EXPORT CLASS in the scripts panel/as3geomexporter. Like that:

Thanks for your attention. When you finish this tutorial you should have:

- an AS3 class with the object you’ve created (it contains the mesh definition + the UVW map definition),
- a texture which you can paint on and use with the object,
- a max file which you can use again if you don’t like the results,

Part II – AS3 in FLASH

What you need next (I’m not going to explain it in details here because the code is well commented):

- the source code – you can see it working here. You can download it here.

So you are ready to go – now you can import your object and use it in papervision WITH MAPPING! :)

I hope this tutorial helps.
Feel free to comment! You are welcome as usual!:)

Have fun,

FLAIM

IMPORTANT PATCH (2.3.2009) – PV3D 2.0 UPDATE:

This tutorial should now work on the latest pv3d 2.0 release. The only three things you need to do to make this happen:

1. Change each exported class manually by removing :

- , initObject   from this line:

super( material, new Array(), new Array(), null, initObject );

unfortunately you have to to do this each time you export – sorry the author didn’t update the class generator…

2. Replace your PaperBase.as with this file –> PaperBase.as

3. Don’t forget to download the whole PV3D 2.0 package from here –> http://code.google.com/p/papervision3d/

Sorry for the time it took me to prepare the revision of this tutorial – didn’t have time! Now it’s tested and 100% working with the new PV3D release (2.3.2009 – Papervision3D_2.0.869).

FLAIM

43 Responses to “Exporting textured objects from 3d MAX to PV3D 2.0 tutorial”

  1. Rex Says:

    Hi flaim, great overview – thanks. I have a few questions. (I a flash guy working with a 3D guy and I am relating his questions to you.)

    “But you must keep the object as ONE mesh – closed one.”

    Can you elaborate on this? What do you mean by “ONE mesh”? i.e. two objects in one file then exported is that one closed object?

    “If you want to combine many objects you have to do this in papervision – not in max – the exporter allows to export 1 object.”

    Does this mean export multiple objects then add both to the stage in papervision, or do you mean something else when you talk about “combine many objects”?

    Thanks

  2. Yogesh Says:

    Hi Flaim,
    Thanks for this tutorial…i have been looking for something like this from a long time.

    For those who are looking to this tutorial for the first time the new path for AS3Exporter is -
    http://seraf.mediabox.fr/showcase/as3-geom-class-exporter-for-3ds-max-english/#comment-18203

    it seems like that the page has been moved.

    Thanks.

  3. alix Says:

    Does anyone knows where is AS3Exporter?. Since a few days the dreammania’s server doesn’t run and I don’t found it anywhere. Seraf.mediabox doesn’t run too. I’m a few lost.

  4. Flash Summer Camp Berlin - Think In 3D Workshop - Follow-up | analogdesign’s lab | Cedric M. (aka maddec) Says:

    [...] During the workshop I told you about using Unwrap and baked textures, here is for reference a simple explanation of it. UVW Unwrap allows you to unfold a 3D object on a flat plane. This technic is often used to add “baked textures” to your 3d objects. Baked textures are textures with lightening and shadows prerendered, leveraging your scene from the computer intensive real time lightening. This technic has been used a lot within the gaming industry and fits perfectly the context of Flash Real Time 3D. For example take a cube, unwrap it. Now you have a flat representation of each face of your cube, then you can export it as an image file and edit it in Photoshop. Once done with your modifications (adding for example shadows and lightening or swapping Flat texture with more realistic ones), you apply your modified image in your 3D software, and now you have your model with prerendered lightening and shadows ready to be exported to Collada and to be used within Papervision3D or Away3d or Alternativa3D or … The previous example was only given for the sake of explanation about UVW Unwrap. Most of the time 3D software allow you to directly bake the lightening and shadows as you set it up in your 3D environment to your texture (look at: Render to texture). Checkout this tutorial by Blitz Lab about Unwrap, Baking a texture and Collada exports. Checkout Texture Baking is your friend. Checkout this tutorial about AS3exporter and Unwrap. [...]

  5. emanuel Says:

    hola, que se hace? donde se abre el archivo myobject.as? para que me reprodusca


Leave a Reply