Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
complex mesh interaction
#3
(27-07-2017, 07:17 AM)josemendez Wrote: hi Jose, Thanks for your excellent reply I will attempt this approach, I had hoped there would have been a 2d render texture solution but couldn't figure a way, this is a lovely starting point... Sonrisa

Hi baryy,

Regular (primitive) colliders like capsules attached to the limbs will work just fine, but of course they'll be much less precise. Mesh colliders cannot be deformed by a skeleton and are slower.

Using regular physics is just not going to work if you need accurate realtime collision detection with a deformable humanoid shape.
If I were in your situation (also based on the video/question you posted on the blog post) I'd take a completely different approach, using shaders. This will be both faster (like, a lot faster) and probably also easier to get right.

- Each frame, render the silhouette of your mesh to a full-screen render texture. Whiite silhouette against a black background.
- Blur the silhouette (using separable linear gaussian blur, if possible). This essentially gives you a sort-of distance field of your humanoid.
- Now the fun part. Use a fullscreen grid-like mesh to create your particles (use a geometry shader to emit a quad per vertex) and read the previous blurred texture at each particles' location. The whiter your texture, the closer you are to the body silhouette. You can use a threshold to control how close your particles are allowed to get to the silhouette. To get a gradient direction (a "normal") to project the particles, just take the derivative of this black/white map.

The benefits of this approach: all done in the GPU, in parallel for each particle, and it is largely independent of the complexity of your character mesh. You could simulate hundreds of thousands of particles this way.

cheers,

Edit: Also based on your blog comment, fluid dynamics isn't really what you're looking for here. While the result you're after has a fluid-like quality to in, in fact your particles are completely independent of each other. They are simply pinned in world space to their original position via a spring. This is heaps faster to calculate than a fluid simulation.
Reply


Messages In This Thread
complex mesh interaction - by baryy - 26-07-2017, 07:51 PM
RE: complex mesh interaction - by josemendez - 27-07-2017, 07:17 AM
RE: complex mesh interaction - by baryy - 27-07-2017, 11:29 AM