How Softimage handles negative scaling?

Discussions concerning programming of SOFTIMAGE©
Post Reply
homam
Posts: 49
Joined: 16 Mar 2013, 23:15
Location: Montreal
Contact:

How Softimage handles negative scaling?

Post by homam » 16 Apr 2013, 18:33

While working on Soft-Game Engine pipeline I faced this common issue where negative scaled objects looks inverted in the game engine.

My question: How Softimage is able to render negative scaled objects correctly? If it uses some real-time friendly algorithm maybe it is better to implement it in the game engine instead of freezing negative scaling and fixing hierarchies/animations issues resulted of freezing scaling.

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 01:41
Contact:

Re: How Softimage handles negative scaling?

Post by EricTRocks » 16 Apr 2013, 18:44

In my experience (not in games at all) you'd want to not have any geo negatively scaled. Only have controls, nulls, and any other types of items scaled negatively if needed. Otherwise, freeze negative scaling.
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

homam
Posts: 49
Joined: 16 Mar 2013, 23:15
Location: Montreal
Contact:

Re: How Softimage handles negative scaling?

Post by homam » 16 Apr 2013, 19:47

Still wondering why Soft can do it and games cannot?

Any idea what is the math Soft is using to render negative scaled objects correctly on its viewports?

User avatar
Mathaeus
Posts: 1778
Joined: 08 Jun 2009, 21:11
Location: Zagreb, Croatia
Contact:

Re: How Softimage handles negative scaling?

Post by Mathaeus » 16 Apr 2013, 21:28

homam wrote:Still wondering why Soft can do it and games cannot?

Any idea what is the math Soft is using to render negative scaled objects correctly on its viewports?
Actually it's not all the time. If negative scaling is applied as deformation, via envelope or some ICE negative multiply, or it's applied to ICE particle primitives, normals are pointing in opposite direction. It seems it's valid only when it comes to SRT, perhaps there's some switch of normals in case of negative scale. Maybe you can flip normals on negative scaled objects, so they will sit back to desired direction, once you're in game.

homam
Posts: 49
Joined: 16 Mar 2013, 23:15
Location: Montreal
Contact:

Re: How Softimage handles negative scaling?

Post by homam » 16 Apr 2013, 22:32

Flipping Normals fixes rendering negative scaled object in the game. However, it inverted the lighting of that object. To fix the lighting issue I tried doing two sided lighting in the game. It works but again it causes another problem where the objects look too bright because faces are lit from all lights regardless of the light direction relative to the face.

I attached a screenshot for each case.
negScaling.jpg

homam
Posts: 49
Joined: 16 Mar 2013, 23:15
Location: Montreal
Contact:

Re: How Softimage handles negative scaling?

Post by homam » 17 Apr 2013, 04:17

Fixed! :D the trick is to check the combined sign of the three diagonal elements in the world transformation matrix, then you invert the mesh's normals and winding order based on that.
Now our game engine supports negative scaling for mirroring :)

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: How Softimage handles negative scaling?

Post by Daniel Brassard » 17 Apr 2013, 23:47

is your game engine a left hand coordinate system per chance?

Ie +z up or +z away from camera/ viewer?
$ifndef "Softimage"
set "Softimage" "true"
$endif

homam
Posts: 49
Joined: 16 Mar 2013, 23:15
Location: Montreal
Contact:

Re: How Softimage handles negative scaling?

Post by homam » 18 Apr 2013, 00:10

+z is away from the camera. +y is up.

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: How Softimage handles negative scaling?

Post by Daniel Brassard » 18 Apr 2013, 04:16

Explain a lot. Your game engine is a left hand coordinate system, Softimage is a right hand system, +Z toward the camera, +Y is up.

Polygons are created in Softimage counter-clockwise for the normal to face outward and in your Game engine clockwise, that is why you will need to invert the normals between the game engine and Softimage.

As an example, here is Direct3D explanation and solution ... , what you did is what is recommended.

http://msdn.microsoft.com/en-us/library ... s.85).aspx

The same happen when you convert between Softimage and Max. Maya can be switch between coordinate system.
$ifndef "Softimage"
set "Softimage" "true"
$endif

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests