Having Trouble with 3DS model

Software: Away3D 4.x

ErnAlp, Newbie
Posted: 11 January 2012 02:58 PM   Total Posts: 7

when i import a OBJ model its okay but when it is 3DS model..Their positions are not in the right place.

Any idea?

They are same model and exported from 3dsMax.

This is the OBJ.
http://img23.imageshack.us/img23/5146/paletiyi.th.jpg

This is the 3DS model.
http://img828.imageshack.us/img828/8977/tankpalethatali.th.jpg

   

lanceaeby, Newbie
Posted: 11 January 2012 03:00 PM   Total Posts: 8   [ # 1 ]

What’s the problem??

 

   

ErnAlp, Newbie
Posted: 11 January 2012 03:06 PM   Total Posts: 7   [ # 2 ]
lanceaeby - 11 January 2012 03:00 PM

What’s the problem??

I was editing the post then i accidentally post it :D

 

   

Alex Bogartz, Sr. Member
Posted: 11 January 2012 04:24 PM   Total Posts: 216   [ # 3 ]

I’m not sure about other exporters, but in Blender you need to apply all the transforms before exporting to 3DS or else it’ll use the un-applied ones.  The obj exporter applies them for you by default.

Maybe something like that is happening with your model.

 

   

ErnAlp, Newbie
Posted: 11 January 2012 07:54 PM   Total Posts: 7   [ # 4 ]

Alex Bogartz thank you for your post,

i made changes on transformation and exported as 3DS model.its okay their positions but model still has SOFT edges.

http://img703.imageshack.us/img703/5513/softedges.th.jpg

Anyone know why is that happening???

I dont want to use OBJ because it has two times more space than 3DS has.

 

   

Alex Bogartz, Sr. Member
Posted: 11 January 2012 08:08 PM   Total Posts: 216   [ # 5 ]

Can you explain what you mean by this?  What is soft?  And what should it look like instead?

 

   

ErnAlp, Newbie
Posted: 11 January 2012 08:28 PM   Total Posts: 7   [ # 6 ]
Alex Bogartz - 11 January 2012 08:08 PM

Can you explain what you mean by this?  What is soft?  And what should it look like instead?

When i export that model as OBJ and import it.Model what i want looks like this.
http://imageshack.us/photo/my-images/23/paletiyi.jpg/

But 3DS exported model looks like this.
http://imageshack.us/photo/my-images/703/softedges.jpg/
it has soft edges.

I want to use 3DS Model because it takes less space.But it has errors :S

 

 

   

Avatar
kurono, Sr. Member
Posted: 03 April 2012 08:38 PM   Total Posts: 103   [ # 7 ]

For me it’s also the same question: how to keep hard edges (don’t smooth normals) while exporting to 3DS file (as it’s in a OBJ file)?

I can use the “Explode” class to isolate vertices, btw.

 

   

Avatar
kurono, Sr. Member
Posted: 03 April 2012 11:22 PM   Total Posts: 103   [ # 8 ]

Well, I believe, the difference between OBJ and 3DS is that 3DS hasn’t vertex normals data (but uses smoothing groups instead).

Current Max3DSParser doesn’t support smoothing groups and all normal are calculated “smoothed” by default.

This Away3d’s parser has a “41**” chunks as follows:

case 0x4000// EDIT_OBJECT
       
_cur_obj_end end;
       
_cur_obj = new ObjectVO();
       
_cur_obj.name readNulTermString();
       
_cur_obj.materials = new Vector.<String>();
       
_cur_obj.materialFaces {};
       break;
      
      case 
0x4100// OBJ_TRIMESH 
       
_cur_obj.type AssetType.MESH;
       break;
      
      case 
0x4110// TRI_VERTEXL
       
parseVertexList();
       break;
      
      case 
0x4120// TRI_FACELIST
       
parseFaceList();
       break;
      
      case 
0x4140// TRI_MAPPINGCOORDS
       
parseUVList();
       break;
      
      case 
0x4130// Face materials
       
parseFaceMaterialList();
       break;
      
      case 
0x4160// Transform
       
_cur_obj.transform readTransform();
       break; 

It would be great to extent them with “4150” chunk, which describes Smoothing Groups container:

case 0x4150// SMOOTHING_GROUPS
       
parseSmoothingGroupList();
       break; 

Did anybody already do it?

 

   

Avatar
kurono, Sr. Member
Posted: 04 April 2012 08:14 PM   Total Posts: 103   [ # 9 ]

Well, now Max3DSParser is extended with followings:

1) internal class VertexVO - structured representation of vertex

2) internal class FaceVO - structured representation of face. This object has an “smoothGroup” property!

3) private function parseSmoothingGroups():void - parse binary data of smoothingGroups from 3ds file starting from 0x4150.

4) private function prepareData(vertices:Vector.<VertexVO>, faces:Array, obj:ObjectVO):void - convert data from ObjectVO to separate sets of VertexVO and FaceVO.

5) private function applySmoothGroups(vertices:Vector.<VertexVO>, faces:Array):void - clone vertices according to smoothing groups.

And some native functions and properties are modified a bit:

1) internal class ObjectVO - its properties were extended with “public var smoothingGroups:Vector.<uint>”

2) private function parseFaceList() : void - the following line was added at the end of function: “_cur_obj.smoothingGroups = new Vector.<uint>(count, true);”

3) private function constructObject(obj : ObjectVO, pivot : Vector3D = null) : ObjectContainer3D - smoothing groups were applyed for data before building subgeometries:

var vertices:Vector.<VertexVO> = new Vector.<VertexVO>(obj.verts.length 3);
    var 
faces:Array = new Array(obj.indices.length 3);
    
prepareData(verticesfacesobj);
    
applySmoothGroups(verticesfaces);
    var 
i:uint;
    
obj.verts = new Vector.<Number>(vertices.length 3true);
    for (
0vertices.lengthi++) {
     obj
.verts[i 3] vertices[i].x;
     
obj.verts[i 1] vertices[i].y;
     
obj.verts[i 2] vertices[i].z;
    
}
    obj
.indices = new Vector.<uint>(faces.length 3true);
    for (
0faces.lengthi++) {
     obj
.indices[i 3] faces[i].a;
     
obj.indices[i 1] faces[i].b;
     
obj.indices[i 2] faces[i].c;
    
}
    obj
.uvs = new Vector.<Number>(vertices.length 2true);
    for (
0vertices.lengthi++) {
     obj
.uvs[i 2] vertices[i].u;
     
obj.uvs[i 1] vertices[i].v;
    

Parser works as original Away3D’s Max3DSParser, taking into account smoothing groups. Simply overwrite it in your “away3d.loaders.parsers” folder.

 

File Attachments
Max3DSParser.zip  (File Size: 6KB - Downloads: 224)
   

3dNewb, Sr. Member
Posted: 04 April 2012 09:30 PM   Total Posts: 105   [ # 10 ]

Hi, you are amazing. Did you send a pull request to the github repo for this?

I will try this out asap.

 

   

Avatar
kurono, Sr. Member
Posted: 04 April 2012 10:21 PM   Total Posts: 103   [ # 11 ]

Thanks! Yes, I sent it to “dev” branch.

 

   

Avatar
kurono, Sr. Member
Posted: 16 April 2012 08:46 PM   Total Posts: 103   [ # 12 ]

Here is little demo based on Basic_Load3DS from Away3D’s examples. Native parser is also included and renamed as Max3DSParser.as.native.

 

File Attachments
testsmoothingroups.zip  (File Size: 566KB - Downloads: 263)
   

Richard Olsson, Administrator
Posted: 14 June 2012 01:39 PM   Total Posts: 1192   [ # 13 ]

The smoothing groups functionality implemented by kurono has now been merged into the release branch of Away3D. It will be in the stable Away3D 4.0 release.

 

   

Avatar
kurono, Sr. Member
Posted: 23 June 2012 09:10 PM   Total Posts: 103   [ # 14 ]

Nice smile

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X