gkjohnson / three-gpu-pathtracer

Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.
https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/index.html
MIT License
1.38k stars 133 forks source link

Add demo showing how to render skinned, morph target meshes #50

Closed setpixel closed 2 years ago

setpixel commented 2 years ago

Hi! I assume not, because of BVH.

gkjohnson commented 2 years ago

Can you elaborate on what you'd be looking for? It's not impossible to support SkinnedMeshes but it hasn't been anything I'd considered adding. For more direct support the three-mesh-bvh library could be updated to account for vertex skinning / morph targets and a BVH could be generated from that though the build process would be slower. And for any changes to the skeleton or morph targets the BVH could be "refit" (https://github.com/gkjohnson/three-mesh-bvh/issues/296, https://github.com/gkjohnson/three-mesh-bvh/issues/284) to encapsulate the new triangle positions which would be faster but still more difficult to do in real time in complex cases and would result in a less optimal BVH.

If you just want to render a deformed, skinned mesh then the simplest approach would probably be to generate a new static or "baked" geometry that represents the skinned mesh and then generate a BVH from that to render.

Does that answer what you're looking for?

gkjohnson commented 2 years ago

Possible Demo Models