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

Postprocessing Ignores Morph Targets & Normals #12844

Closed
ghost opened this issue Dec 10, 2017 · 11 comments · Fixed by #22169
Closed

Postprocessing Ignores Morph Targets & Normals #12844

ghost opened this issue Dec 10, 2017 · 11 comments · Fixed by #22169

Comments

@ghost
Copy link

ghost commented Dec 10, 2017

When a morph target mesh is rendered with a non-morph target material, the mesh seems to render in bind pose. The EffectComposer framework for postprocessing uses the scene.overrideMaterial interface to generate depth and normal buffers, so these buffers have all meshes in bind pose. You can see the issue by applying a normal buffer postprocess to the MD2 character example.

I've badly hacked up three.js to take a scene.morphOverrideMaterial parameter to use as an alternate override for meshes which originally had a material with the morph target flags. I also updated the post processing effects to provide morph target variants of their override materials, and it allows them to render correctly on animated characters.

I could share my hack, but I think a better solution would be to use the morph target and morph normal settings from the true material of a mesh, even in the presence of an override material setting. (Or... does webgl have multiple render targets?)

@mrdoob
Copy link
Owner

mrdoob commented Feb 6, 2018

Can you create a jsfiddle showing the issue?

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 11, 2018

The EffectComposer framework for postprocessing uses the scene.overrideMaterial interface to generate depth and normal buffers, so these buffers have all meshes in bind pose.

I think that's not true. MeshDepthMaterial and MeshNormalMaterial include the respective shader chunks for morph target and skeletal animation. You just have to set the material properties skinning or morphTargets to true.

Besides, the material viewer of the documentation easily shows that morph target animation works (activate morphTargets in the section THREE.MeshDepthMaterial).

https://threejs.org/docs/index.html#api/materials/MeshDepthMaterial

When a morph target mesh is rendered with a non-morph target material, the mesh seems to render in bind pose.

That's correct. It's your task to ensure that morph targets are supported by the material which is intended for scene.overrideMaterial. EffectComposer can't do this for you.

@ghost
Copy link
Author

ghost commented Feb 11, 2018

Well loading the post processing stack into jsFiddle has proven to be a complete pain, and I barely remember the details after so long and after we've just switched to a custom renderer to solve everything at once... However, I am 100% sure there were multiple booleans including "morphTargets" and "skinned" which I brute force tried every permutation of by hand to no success, and also am sure that scene.overrideMaterial was being used to generate some input buffers for the SAO pass because manipulating that override material directly was the only way to achieve animated normal buffers. Maybe it's just the SAO pass with the problem, and not the EffectComposer itself.

@pawelstan
Copy link

pawelstan commented May 25, 2018

Hey!

Wanted to bump this issue.
SAO was working well for me with my animated models in Three ver. 0.89.0!

I just added:

	this.depthMaterial.skinning = true;
	this.depthMaterial.morphTargets = true;

	this.normalMaterial.skinning = true;
	this.normalMaterial.morphTargets = true;

in THREE.SAOPass constuctor.

But after upgrading to version 0.92.0 it stopped working. I've added skinning and morphTargets in all other materials used in SAOPass.js with no luck.

I can see that depth and normal buffers have all meshes in bind pose.

I have set the skinning or morphTargets to true, otherwise they wont animate at all.

@Mugen87 Any ideas what changed from version 0.90.0 that could affect this?

@Mugen87
Copy link
Collaborator

Mugen87 commented May 25, 2018

No, sry. There were some bug fixes related to SAOPass this year but I don't think they should affect your code. https://github.com/mrdoob/three.js/commits/dev/examples/js/postprocessing/SAOPass.js

@pawelstan
Copy link

Found the problem. It was spot light helper, it is breaking the sao on skinnned meshes...

@mrdoob mrdoob added this to the r101 milestone Dec 14, 2018
@mrdoob mrdoob modified the milestones: r101, r102 Jan 31, 2019
@mrdoob mrdoob modified the milestones: r102, r103 Feb 28, 2019
@mrdoob mrdoob modified the milestones: r103, r104 Mar 27, 2019
@mrdoob mrdoob modified the milestones: r104, r105 Apr 24, 2019
@mrdoob mrdoob modified the milestones: r105, r106 May 30, 2019
@mrdoob mrdoob modified the milestones: r106, r107 Jun 26, 2019
@mrdoob mrdoob modified the milestones: r107, r108 Jul 31, 2019
@mrdoob mrdoob modified the milestones: r108, r109 Aug 27, 2019
@mrdoob mrdoob modified the milestones: r109, r110 Sep 25, 2019
@mrdoob mrdoob modified the milestones: r110, r111 Oct 30, 2019
@mrdoob mrdoob modified the milestones: r111, r112 Nov 27, 2019
@mrdoob mrdoob added this to the r115 milestone Feb 29, 2020
@mrdoob mrdoob modified the milestones: r115, r116 Mar 25, 2020
@mrdoob mrdoob modified the milestones: r116, r117 Apr 30, 2020
@mrdoob mrdoob modified the milestones: r117, r118 May 27, 2020
@mrdoob mrdoob modified the milestones: r118, r119 Jun 24, 2020
@mrdoob mrdoob modified the milestones: r119, r120 Jul 29, 2020
@mrdoob mrdoob modified the milestones: r120, r121 Aug 25, 2020
@mrdoob mrdoob modified the milestones: r121, r122 Sep 29, 2020
@mrdoob mrdoob modified the milestones: r122, r123 Oct 28, 2020
@mrdoob mrdoob modified the milestones: r123, r124 Nov 25, 2020
@mrdoob mrdoob modified the milestones: r124, r125 Dec 24, 2020
@mrdoob mrdoob modified the milestones: r125, r126 Jan 27, 2021
@mrdoob mrdoob modified the milestones: r126, rXXX Feb 23, 2021
@mrdoob mrdoob removed this from the r??? milestone Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants