Problems with rotation

Messages
1st December 2016 - 04:50:27 AM
Hi,

I've written an exporter for Sea3D from other formats, and everything looks almost great. However, I'm having trouble with some files where the rotation looks completely wrong, like this one https://a.uguu.se/0SMTvFE3KvbE_fromFbx.sea

If you load the file inside http://sea3d.poonya.com/studio/ you'll see the bike standing, like it should. However, if you load it with Three.JS, the rotation will be completely wrong.

Am I missing something, or is this just a bug?
1st December 2016 - 10:17:59 PM
The bug seems to happen with scaled objects only. I've seen some code on the loader to deal with scaling before applying the rotation, but it doesn't seem to be enough, although I'm at a loss about how to fix it, any pointers will be appreciated.
1st December 2016 - 11:04:12 PM
Ok, so the problem happens specifically if the object has a negative scale on any component. It seems that the scale is applied as a positive number, so you don't get the rotation that comes from a negative scale.
2nd December 2016 - 01:23:51 AM
Hi Arcnor.

Negative scale is not recommended, in SEA3D Exporter we have an option to fix the inverted scales:

Utils -> Force Positive Scale

Invert Matrix - https://github.com/sunag/sea3d/blob/master/Exporter/3ds%20Max/SEA3D/SEA3D.ms#L3165
Need Invert Normals too - https://github.com/sunag/sea3d/blob/master/Exporter/3ds%20Max/SEA3D/SEA3D.ms#L4210

You already installed SEA3D Studio 1.8? It has an Assimp to SEA3D converter, maybe it help.
2nd December 2016 - 01:39:54 AM
So you suggest to be fix this before doing the export? In the code you linked, I see the scale being set as positive, but I don't see where you fix the rotation when there is negative scale.

I was confused because the flash version of Sea3D seems to support this case just fine...

I can't install Studio 1.8 because I'm on a Mac, but if you have a link to the source of that Assimp converter, I'll take a look.

Thanks!
2nd December 2016 - 07:32:11 AM
> Ok, so the problem happens specifically if the object has a negative scale on any component.

To work with negative scale is always a bad idea (wrong lighting, collisions, etc).
You need to fix this before exporting the SEA file.
2nd December 2016 - 04:56:24 PM
So you suggest to be fix this before doing the export?


Yes!

In the code you linked, I see the scale being set as positive, but I don't see where you fix the rotation when there is negative scale.


I'm not sure if this is the problem but this will reverse the model 180 degrees of according with the axis.
On the bike you sent me the normals are inverted util set as positive scale the matrix, this fix?

I can't install Studio 1.8 because I'm on a Mac, but if you have a link to the source of that Assimp converter, I'll take a look.


I will do this. But I not published the source of Assimp to SEA3D, this may take a few days.
4th December 2016 - 08:30:27 AM
4th December 2016 - 09:37:07 PM
Thank you! Will take a look at that to fix my problem.

Help