tolga Posted September 17, 2020 Share Posted September 17, 2020 Hi, I want to mirror a Mat4 around Y-axis (XZ plane). 1 0 0 0 0 -1 0 0 0 0 1 0 0 0 0 1 Multiplying with the above matrix doesn't work. How can I do it? Thanks. Link to comment
silent Posted September 17, 2020 Share Posted September 17, 2020 tolga Is there any specific task that you are trying to solve? Could you please give us more details about it. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tolga Posted September 17, 2020 Author Share Posted September 17, 2020 14 minutes ago, silent said: tolga Is there any specific task that you are trying to solve? Could you please give us more details about it. Thanks! Hi, thanks for the reply. I'm working on HairWorks and final output looks like it's mirrored around forward axis of the mesh. Maybe, I'm converting matrices wrong, but it looks like the hair is in the correct place, just mirrored around forward axis. That's why I'm trying to mirror the skinning matrices around Y-axis. Thanks. Link to comment
silent Posted September 17, 2020 Share Posted September 17, 2020 Is it possible to see a bit more of code? Maybe the issue is there, not in the matrix mirroring. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tolga Posted September 18, 2020 Author Share Posted September 18, 2020 Hi, I've attached a video where you can clearly see that the hair is inverted around Y-axis (forward). The hair should be at the back, in my case it's in front of the guy. In UNIGINE, the matrices are stored as columns, where in NV Hair they are stored as rows, so I have a small conversion function like this: static inline gfsdk_float4x4 toNvHairMat4x4(const mat4& matrix) { gfsdk_float4x4 result; memset(&result, 0, sizeof(gfsdk_float4x4)); result._11 = matrix.m00; result._12 = matrix.m10; result._13 = matrix.m20; result._14 = matrix.m30; result._21 = matrix.m01; result._22 = matrix.m11; result._23 = matrix.m21; result._24 = matrix.m31; result._31 = matrix.m02; result._32 = matrix.m12; result._33 = matrix.m22; result._34 = matrix.m32; result._41 = matrix.m03; result._42 = matrix.m13; result._43 = matrix.m23; result._44 = matrix.m33; return result; } Also, while setting up I set the handedness hint to RIGHT handed, which should be the case in UNIGINE? Thanks! UNIGINE Engine 2020-09-18 10-20-21.mp4 Link to comment
binstream Posted September 18, 2020 Share Posted September 18, 2020 This might be helpful: https://developer.unigine.com/en/docs/2.12/principles/world_structure/?rlang=cpp#coordinates Link to comment
silent Posted September 18, 2020 Share Posted September 18, 2020 tolga As Denis already mentioned, please check If your model imported correctly (right-handed Cartesian, Y+ is forward, Z+ is Up) and adjust matrices conversion logic f needed. If you will not find a proper solution to this, could you please send us a minimal test scene with original model and code? How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tolga Posted September 22, 2020 Author Share Posted September 22, 2020 Hi Silent, How can I send you a sample? Thanks. Link to comment
silent Posted September 23, 2020 Share Posted September 23, 2020 You can zip data and source dirs and upload them to any filehosting (or the FTP server that I have in my signature). After that just give me a link via PM. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tolga Posted September 23, 2020 Author Share Posted September 23, 2020 Sent you the link. Thank you for your support! Link to comment
silent Posted September 25, 2020 Share Posted September 25, 2020 Please try to replace conversionSettings.m_targetHandednessHint = NvHair::HandednessHint::RIGHT to NvHair::HandednessHint::LEFT. It's hard to understand why is that so, maybe the FBX axes are not correct. Don't forget to check the modified sources in attachment:fix.zip How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tolga Posted September 25, 2020 Author Share Posted September 25, 2020 Hi silent, I tried that but doesn't change much. I found out that the fbx scale is in cm, but the Unigine world is in meters. getIBoneBindTransform returns in cm. I will try to scale the fbx to cm now. Link to comment
silent Posted September 25, 2020 Share Posted September 25, 2020 Did you have a chance to apply all the changes from the attached archive? hairworks.mp4 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tolga Posted September 28, 2020 Author Share Posted September 28, 2020 Hi silent, Thank you very much for the effort. I have to deal with some other urgent stuff. I will return to this later. I'll keep you updated on this one. Thanks. Link to comment
tolga Posted October 5, 2020 Author Share Posted October 5, 2020 Hi Silent, I looked at this this morning. The mesh is currently at (0, 0, 0). If you move it to another location, the hair goes somewhere else. I think there is still problem with the matrices. I will send the fbx to our designer so that he will scale it down to meters. Link to comment
silent Posted October 5, 2020 Share Posted October 5, 2020 You need also to set a correct forward direction, here is the set of documentation articles (and video tutorials) about that: https://developer.unigine.com/en/docs/2.12/editor2/assets_workflow/assets_create_import?rlang=cpp#export How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts