www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: raft on August 17, 2006, 02:12:22 pm

Title: 3ds max tips
Post by: raft on August 17, 2006, 02:12:22 pm
the problem below took me days to resolve, so i thought it may help others if it's documented in a thread.

-- o --

sometimes models arent loaded with 3dsLoader as they look in 3d max. i mean somehow their placement and rotation change when loaded into jPCT.

i first encountered this problem with the commercial village set i use in karga. the producer suggested to use XRef and it effectively solved the problem. this is done by either adding an XRef modifier to each object's stack or by using reset x-form utility in utilities panel (which indeed does the same for all selected objects)

however on some situations XRef doesnt solve the problem. the objects are still misplaced when loaded into jPCT. there seems to be a hidden translation or whatever which XRef doesnt clear, and which in turn confuses the jPCT's loader. here is the solution, it took me days to find it:

create a new object (say a box) and align its center by align tool with our object in question. convert the new object to editable mesh (or poly) and attach our object to it. now go to element sub object level, select new object and delete it. your object has now a brand new transform.

this is the document i found this workaround in: http://fosters.realmwarsgame.com/maxdts/section2.html

note: maybe you may wish to add to this thread in time to build a list of helpful 3d max tips. Egon, maybe you may wish to open a new forum category for this purpose

hope this helps
Code: [Select]
r a f t
Title: 3ds max tips
Post by: EgonOlsen on August 17, 2006, 09:05:44 pm
Good to see that you've finally solved it. Maybe we should make this thread sticky and rename it to something like "3ds max tips" or similar. What do you think?
Title: 3ds max tips
Post by: raft on August 17, 2006, 09:12:09 pm
sure, i'll be glad indeed :)
Title: 3ds max tips
Post by: EgonOlsen on August 17, 2006, 09:17:06 pm
Done! So if anyone has anything to contribute regarding 3ds (or finds something in the forum that would fit in here): This is the place to post it.
Title: 3ds max tips
Post by: san14 on February 09, 2007, 11:12:41 am
I would like to know. The way you load .3ds object in JPCTDemo.java Is it possible to load .max file in similar way. If so could you help me with some example.
Title: 3ds max tips
Post by: EgonOlsen on February 09, 2007, 12:23:29 pm
No! Max is a proprietary format for which you have to get a license to be allowed to read/write it. You've to export these files as 3ds or obj to load them
Title: Re: 3ds max tips
Post by: ToddMcF2002 on May 13, 2007, 02:15:06 am
Does anyone know how to get faces to share a UV in max?  For example the back side of a house should have the same texture as the front?  I've seen a bunch of UV Unwraps that show just unique faces in the UV but I'm not sure how to do it.



Title: Re: 3ds max tips
Post by: raft on May 13, 2007, 01:32:03 pm
add an UnwrapUV modifier to the stack. among other properties of modifier there is an edit button which lets you modify UV coordinates precisely
Title: Re: 3ds max tips
Post by: ToddMcF2002 on May 14, 2007, 04:05:17 pm
Maybe I wasnt clear in the question.  I'm in the Unwrap already, moving stuff around.  But I finally realized the answer.  If two unwrap faces are the same size and are supposed to share the same texture you just move them on top of each other so they have the same coordinates.  It seems so obvious now jeesh.

 
Title: Re: 3ds max tips
Post by: Melssj5 on June 29, 2007, 07:23:31 pm
Another thing.

on 3d studio MAX, when a texture is applied directly to an object without using UVW maps, then by default it is applied on UV direction, this can be changed from the 3d studio max to be uv, vw, uw. But once this is done, jpct doesnt recognize this parameters, it recognizes when some modifiers of texture coordinates are applied, not the simple way.
Title: Re: 3ds max tips
Post by: paulscode on March 04, 2008, 02:22:05 am
I thought I would post this here in case anyone out there likes to use Turbo Squid Gmax modeling program, but can't figure out how to convert their .GMAX files into .3DS files for use in jPCT.

First of all, this isn't a direct way to convert to .3DS (I'll be sure to post it if I find one).  This method is a round-about way to do the conversion, but it works  :)

The first thing you need is Turbo Squid Gmax (free to use, and can be downloaded at http://www.turbosquid.com/gmax (http://www.turbosquid.com/gmax)).

The second thing you need is a "Quake MD3 exporter".  There is a good one at http://www.davidhsmith.net/Essential_Tools.htm (http://www.davidhsmith.net/Essential_Tools.htm).  The one you want to download is called "Quake-3 MD3 exporter beta v1.0 - gmax".  You will want to unzip the downloaded file and copy the contents into the "plugins" subdirectory.

The last thing you need is a program called LithUnwrap.  It is free, and can be download at http://www.sharecg.com/v/5169/software-and-tools/LithUnwrap---Free-UV-Mapper-for-Windows (http://www.sharecg.com/v/5169/software-and-tools/LithUnwrap---Free-UV-Mapper-for-Windows)

Now, all you have to do is create your models like you normally would in Gmax.  When you are ready, choose "Export" under the File menu.  For "Save as type", choose "Quake III (*.MD3)".  Pick a name and click "Save".

Unfortunately, this seems to only export the mesh information for you model, so next you need to load your model up in LithUnwrap (File->Model->Open).  From there, you can add your materials, textures, uv maps, etc.  When you are done, choose File->Model->Save, and for "Save as type", choose "3D Studio Files (*.3DS).

I hope someone finds this useful.  Of course you could always just buy Autodesk 3D Studio and export your models directly to .3DS.
Title: Re: 3ds max tips
Post by: paulscode on March 06, 2009, 02:10:49 pm
I thought I would and a post this here on the sticky Max tips thread, since the question has come up a couple times recently.  These tips will get most .3ds files exported by AutoDesk 3D Studio Max to load in the proper position and orientation when using the jPCT's Loader class.

1) Set the rotation pivots for all objects in the Max scene to the origin (0,0,0).
    Click the "Select by Name" button (looks like a list with a small mouse curser).  There will be a list of all the objects in your scene.  Should look something like this:
Code: [Select]
Scene Root
  --Group01
      --Mesh01
      --Mesh02
  --Geo01
  --Group 02
      --SubGroup1
           --Cube01
Notice each element in your scene (not groups or subgroups).  For the above example, jPCT's Loader class would load 4 Object3Ds: Mesh01, Mesh02, Geo01, and Cube01.  Select the first one (Mesh01 in this example), and click OK.  Go to the "Hierarchy" tab (looks like one large square with three smaller squares under it, next to the "Modify" tab).  Choose the "Affect Pivot Only" button (important!).  Select the "Move" tool.  At the bottom of the window under the X,Y, and Z fields, enter the coordinates 0,0,0.  Repeat this process for each element in the scene (Mesh02, Geo01, and Cube01 in this example).

2) Make sure the views are correct for your Max scene.
    In the pannel labled "Top" make sure you are looking at the top of the model, not the bottom.  "Front" should also be looking at the front of the object, not the back.  It can be difficult sometimes to tell the difference when you are just looking at wireframes, so one thing you can do is right-click on "Perspective" in the perspective panel, and choose "Views->Front".  This will show you the front view of the rendered model, and you can rotate your model if it is wrong.  You would do the same for "Views->Top".

3) Make sure the model's center-of-mass (or whatever relative point you want the object to pivot around in jPCT) is positioned at the origin.
    Select all objects in the scene with "Edit->Select All".  In the "Heirarchy" tab, choose "Affect Object Only".  Choose the "Move" tool, and place the model where you want it in relation to the origin.

4) Recheck the rotation pivots one final time (repeat step 1)
    It is possible the rotation pivots may have shifted while you were playing with the scene's position and orientation, so check one more time to be sure.

(Export your .3ds file)

5) Perform two mesh rotations on the objects in jPCT immediately after loading.
    Use the following code on the array of Object3Ds returned by the Loader class:
Code: [Select]
        for( int x = 0; x < objs.length; x++ )
        {
            objs[x].rotateX( (float) Math.PI / 2 );
            objs[x].rotateZ( (float) Math.PI );
            objs[x].rotateMesh();
            objs[x].setRotationMatrix( new Matrix() );
        }

99% of the time, these steps will get your .3ds models loaded in the proper placement and rotation.  When added to the world, the model's origin will initially be positioned at (0,0,0), the "Top" of the object will be pointed "up" (-y), and the "Front" of the object will be pointed "into the screen" (+z).
Title: Re: 3ds max tips
Post by: raft on March 06, 2009, 03:46:20 pm
instead of

Code: [Select]
    objs[x].rotateX( (float) Math.PI / 2 );
    objs[x].rotateZ( (float) Math.PI );

you can simply call:

Code: [Select]
    objs[x].rotateX( (float) -Math.PI / 2 );
r a f t ;)
Title: Re: 3ds max tips
Post by: paulscode on March 06, 2009, 03:58:02 pm
instead of

Code: [Select]
    objs[x].rotateX( (float) Math.PI / 2 );
    objs[x].rotateZ( (float) Math.PI );

you can simply call:

Code: [Select]
    objs[x].rotateX( (float) -Math.PI / 2 );
True, if you can think in negatives ;D  (two ways to solve every problem... the right way and Paul's way)
Title: Re: 3ds max tips
Post by: raft on March 06, 2009, 04:03:36 pm
indeed without a negative: ;)
Code: [Select]
    objs[x].rotateX( (float) Math.PI * 3 / 2 );
Title: Re: 3ds max tips
Post by: paulscode on March 06, 2009, 04:17:34 pm
Wait, hold up!  That would make the object's front facing in the -z direction.  What I had originally is correct, isn't it?
Title: Re: 3ds max tips
Post by: raft on March 06, 2009, 04:28:53 pm
yes, yours was right, this is just simpler.
Title: Re: 3ds max tips
Post by: paulscode on March 06, 2009, 09:32:26 pm
yes, yours was right, this is just simpler.
Sorry, what I meant to say is that a rotation of +pi/2 around x followed by a rotation of +pi around z is not equivalent to a rotation of -pi/2 around x, as you can see in my skillfully drawn diagram here:

(http://www.paulscode.com/images/RotationQuestion.gif)
So you would want to use the two rotations I mentioned in my original post rather than your simpler method, so that the loaded model/scene will be oriented the same in jPCT as it was in Max.
Title: Re: 3ds max tips
Post by: raft on March 06, 2009, 09:39:33 pm
ehm, you are right. i just used to make a single rotation and face the front of model in karga. since everything is rotated that way, i didnt realized the difference ::)
Title: Re: 3ds max tips
Post by: fir3d on May 16, 2010, 05:53:12 am
My objects from 3ds are coming upside down. I tried adding a box and aligning it to center then attaching and deleting. Im guessing this is cause of the coordinate system. Is this the same for everyone, do you just rotate your models before exporting them?
Title: Re: 3ds max tips
Post by: raft on May 17, 2010, 02:00:47 pm
yes it's same for all. but generally models are exported regularly but rotated after loading. a rotateMesh() call also makes sense for this case
Title: Re: 3ds max tips
Post by: Thomas. on June 19, 2011, 10:04:09 am
Is possible to change axis in 3ds max? In some very old posts on another forums, was wrote, that it is not possible, but now here are newer versions :)