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

OutlineEffect: Support for SkinnedMesh? #194

Closed
funwithtriangles opened this issue Apr 22, 2020 · 9 comments
Closed

OutlineEffect: Support for SkinnedMesh? #194

funwithtriangles opened this issue Apr 22, 2020 · 9 comments
Labels
external bug A bug that can't be fixed in this project

Comments

@funwithtriangles
Copy link

Currently OutlineEffect doesn't support SkinnedMesh. The outline shows up, but doesn't follow the animation, just stays at whatever the default pose is. This is now supported with three's own OutlinePass. How tricky would it be to get it working with this library? I'm willing to give it a go if I can get a bit of direction on how to do it. Thanks!

Related three.js links:
https://stackoverflow.com/questions/59786826/best-method-to-get-outline-effect-with-animated-skinned-mesh
mrdoob/three.js@ff77da4

@vanruesc
Copy link
Member

The OutlineEffect already supports skinned meshes and morph targets since [email protected] #68 (comment). If there's a problem with skinning, please provide an example that demonstrates the issue. I don't have a skinned mesh at hand to test with.

@vanruesc vanruesc added the investigating A potential bug that requires further research label Apr 22, 2020
@funwithtriangles
Copy link
Author

I'll have a look into why it's not working for me and report back

@funwithtriangles
Copy link
Author

So the issue occurs when my selection of meshes contains both Mesh and SkinnedMesh. This isn't such a big deal, but worth noting!

@vanruesc
Copy link
Member

Thanks for digging deeper! Skinning should work even if static and dynamic meshes are selected so this could be a bug. Not sure where it's coming from, though. I'll take a closer look when I have more time. It might also be a good idea to add a skinned mesh to the outline demo for debugging purposes.

@vanruesc
Copy link
Member

I was able to replicate the issue locally with a rigged GLTF model. It looks like three compiles the override materials MeshDepthMaterial and DepthComparisonMaterial once and enables or disables skinning depending on which mesh gets rendered first. If a skinned mesh comes after a non-skinned mesh, the material won't be updated correctly.

Static selected first Animated selected first Static after animated
skinning skinning2 skinning3

Weird things happen when non-skinned meshes are selected after the override material was compiled for skinned meshes: the outline is then all over the place because of missing animation data.

There's a good chance that this is a known issue and there might be no simple solution. I'll check later if there's already a ticket for this problem over at three. If there is none yet, I'll prepare a simple reproduction of the bug with override materials.

@vanruesc
Copy link
Member

As I thought, this is a known issue: mrdoob/three.js#18533 and mrdoob/three.js#14577 seem to be the relevant discussions.

The current behaviour of three's override material system also affects SSAO which uses a MeshNormalMaterial as an override material via the NormalPass. Furthermore, the other effects in this library - even the SelectiveBloomEffect - are unaffected because they don't use override materials.

@vanruesc vanruesc added external bug A bug that can't be fixed in this project and removed investigating A potential bug that requires further research labels Apr 23, 2020
@ekelokorpi
Copy link

I can confirm, that SSAOEffect does not work with SkinnedMesh.

Is there any fix for this?

@vanruesc
Copy link
Member

Is there any fix for this?

Not that I'm aware of. This issue also puts a damper on #190.

@vanruesc
Copy link
Member

vanruesc commented Jun 5, 2020

A workaround for override materials with instanced and skinned meshes has been added in [email protected]. Check this to find out how it can be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external bug A bug that can't be fixed in this project
Projects
None yet
Development

No branches or pull requests

3 participants