Jump to content

Mirror matrix around plane


photo

Recommended Posts

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

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!

Link to comment

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:

Link to comment

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:

Link to comment

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

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
×
×
  • Create New...