DummkopfOfHachtenduden / SilkroadDoc

Silkroad developing documentation
90 stars 42 forks source link

Conversion SR parameters to other software #12

Closed Andrej730 closed 1 year ago

Andrej730 commented 1 year ago
  1. Any information about how SR parameters (such as normals, position, uv) relate to other software?

  2. Is there any other factors besides normal value in BMS format that affect how normals will work in game? I made custom bms file for tests (attached it here - chinaman_adventurer_face.bms.txt ),

I've used the guidelines described below but it still looks broken in game. I've tried to inverse axes during normal calculation but got the same results.

In-game: image

Blender: image

What I've learned experimentingis that SR has left-handed coordinate system with Y up. So the formulas to convert parameters to Blender (right-handed coordinate system with Z up) are: 1) Blender Position = SR Postion.xzy Vector(-1, 1, -1) 2) Blender Normal = SR Normal.xzy Vector(-1, 1, -1) 3) Blender UV = (SR UV.x, 1 - SR UV.y)

Maybe we should put it somewhere on the wiki?

Andrej730 commented 1 year ago

Update 1: I've noticed that winding order in SR is left-handed (clockwise) meaning it expects for all visible faces winding order to be like on the second triangle. And the reason why I have this problem with normals - some of the faces have counter-clockwise order (first triangle).

Looking for a way how to detect that and make winding order for all faces to be clockwise.

image

Update 2: Found the solution - my modeling program (Blender) is using counter-clockwise winding order for faces and it's keeping it automatically. So the solution is to just reverse it exporting winding order to SR.

DummkopfOfHachtenduden commented 1 year ago

This is quite normal to have differences in the coordinate system/winding order between DCC apps and engines and always a pain to deal with.

Andrej730 commented 1 year ago

Hope you don't mind - I've added some of that engine info on wiki in 46beadc as it could be useful for someone.