Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBXLoader : node translation should not be applied to morph elements #29586

Open
BTT-AG opened this issue Oct 8, 2024 · 0 comments
Open

FBXLoader : node translation should not be applied to morph elements #29586

BTT-AG opened this issue Oct 8, 2024 · 0 comments
Labels

Comments

@BTT-AG
Copy link

BTT-AG commented Oct 8, 2024

Description

I have some trouble with some of my fbx, when i set the parameter morphTargetInfluences to some weight, i saw that the render of the influence does not match what was made with 3dsmax.
I have done some research to understand why, and manage to find the 'GeometricTranslation' is used in the function genMorphGeometry() when applying a 4x4 matrix (positionAttribute.applyMatrix4( preTransform );)
On the screenshot you can see empty space on top and bottom of the wires of the lamp that correspond to the value in 'GeometricTranslation'

Fbx blend shapes contains a list of vertice index to move and corresponding vertices position depends on the weight. It is raw data, for sure some transformation must apply with the matrix to match the expected render.
But blend shapes vertices positions are already the delta positions from the base vertices positions.
So it means the 'GeometricTranslation' is applied once to the basevertices positions, then currently one more time on the blend shapes vertices positions, that is on my point of view, not correct. I didn't find any documentation about it (hard to find for fbx), but on my side i had already written some c# fbx reader some time ago where i exclude this value.

I currently had a "dirty fix" in local, because not sure it is the good way to do, that is why i didn't made a pull request (and I'm not used to using GitHub also), i pass a second parameter to genGeometry() without translation (see code section)

Reproduction steps

  1. import a fbx with blend shapes and 'GeometricTranslation' not empty on the FbxNode that have blendshape
  2. set 'morphTargetInfluences' to 1
  3. display in scene

Code

remove the translation for morpher in genGeometry and pass also the matrix

genGeometry( geoNode, skeleton, morphTargets, preTransform,  preTransform2) {
	...
	...
	const transform = generateTransform( transformData );
	transformData.translation = undefined;
	const transform2 = generateTransform( transformData );

	return this.genGeometry( geoNode, skeleton, morphTargets, transform, transform2 );
}

until it reach the genMorphGeometry function

genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform2, name ) {
	...
	positionAttribute.applyMatrix4( preTransform2 );
	...
}

Live example

Screenshots

image

Version

r169

Device

No response

Browser

No response

OS

No response

@Mugen87 Mugen87 added the Loaders label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants