www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: zammbi on March 04, 2010, 10:59:16 am

Title: Polygons flipped the wrong way
Post by: zammbi on March 04, 2010, 10:59:16 am
I'm currently loading a 3ds landscape and it seems to have flipped the polygons(water is on top of the hills). I have never seen this problem before.
When I load it in blender it appears correctly. I don't know what's causing this, maybe some silly error on my part.

Anyone else get the same issue? http://www.2shared.com/file/11834275/23195093/Models.html
Title: Re: Polygons flipped the wrong way
Post by: EgonOlsen on March 04, 2010, 11:02:39 am
Do you have a screen shot?
Title: Re: Polygons flipped the wrong way
Post by: zammbi on March 04, 2010, 11:30:43 am
(http://i50.tinypic.com/119qkuh.png)
Title: Re: Polygons flipped the wrong way
Post by: zammbi on March 04, 2010, 12:40:19 pm
Well seems I can solve the problem giving a negative number:

Code: [Select]
Object3D[] objs = Loader.load3DS(Main.class.getResource("/Models/"),"3ds2.3ds", -400);
Title: Re: Polygons flipped the wrong way
Post by: EgonOlsen on March 04, 2010, 12:41:37 pm
So...is this actually rotated compared to the original or is just the y-axis flipped?
Title: Re: Polygons flipped the wrong way
Post by: zammbi on March 04, 2010, 12:51:38 pm
The polygons are flipped on the wrong side.

Usually I flip the model (X axis) by -PI/2 but this one I had to flip by PI/2 so I could see something.

Which yeah in a way the y-axis has been flipped.
Title: Re: Polygons flipped the wrong way
Post by: EgonOlsen on March 04, 2010, 03:50:40 pm
No idea then. Maybe there is some transformation stored in the file that jPCT's loader ignores. There are such things in 3DS, which is why the loader fails on some files. Maybe this is one of them. Try to convert it into OBJ-format and see if that helps.
If it doesn't, try to do something like:

Code: [Select]
mesh.getRotationMatrix().set(1,1,-1);
mesh.rotateMesh();
mesh.getRotationMatrix().setIdentity();

to flip y.