Jump to content
  • Advertisement
Sign in to follow this  
eyyyyyyyyy

Foliage Collision

This topic is 1130 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone,

Does anyone know how the foliage collision/bending works in cryengine? Its a nice effect which I want to create in my own applications.

 



I'm not talking about wind or just simulated movement, I'm talking about the physical bending when the player/object goes into the foliage.

I have a few ideas how they have implemented it, like doing CPU side simulation then uploading the matrixes but this seems awfully expensive if you have lots of collisions going on. I was hoping to get this effect on mobile...

It just needs to look vaguely accurate, so I don't mind any shortcuts! tongue.png I'm currently gathering research on this topic so I can think about the implementation for later :)

Thanks
 

Share this post


Link to post
Share on other sites
Advertisement

when researching my "amber waves of grain" question posted here on gamedev, i came across something about their foliage system, and i think it covered the deformation system. but i dont have a link handy, sorry. keep googling - i'm pretty sure the info is out there.

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

If your foliage is made of many rotated and scaled meshes which are quads with textures on them you could have a "squashed" set of them which look like something is on top of them. Each time a physics object moves over that area you can mark it as deformed by changing the texture perhaps, and set it back through a set of animations via a timer.

 

I don't have any experience with cryengine so my ideas might be a bit abstract, I am purely thinking how I'd approach the problem in an engine agnostic manner.

 

Let me know if this helps! 

Share this post


Link to post
Share on other sites

They are likeing using an approximation for it. They likely made use of Nvidia's hair to do this, which works based on tesselation.

You won't be able to get that without a pretty penny, but you could use AMD's solution to hair.

Share this post


Link to post
Share on other sites


I have a few ideas how they have implemented it, like doing CPU side simulation then uploading the matrixes but this seems awfully expensive if you have lots of collisions going on. I was hoping to get this effect on mobile...
Do that on the GPU side. Put the foliage bones into a floating point texture, and use a pixel shader to run the physics update routines on them. Do collsiion detection with a sphere/capsule (from a cbuffer or another texture) for the player.

Share this post


Link to post
Share on other sites

Well, does this work with multiple spheres? Does it work with other types of objects?

One thing you could look at doing is a texture that gets projected from above (a heightmap) and you could have a buffer to draw into, with a sphere, and you render the sphere with front face culling so the bottoms of the objects render that are lowest to the ground. Then you output the height of the pixel above the height of the terrain height map. You could also for every pixel output some rotation angle from the center of the object (you may be able to use the normal for something like this).  Since it does seem like you can run a blade of grass from all angles and it doesnt just move down, but it rotates.

Unless they have a generic object like a statue that can be thrown on the grass, it may just be something simpler. The rotation part is what throws me off and would take me a while to think about doing it efficiently.

Share this post


Link to post
Share on other sites

In Crysis 3 they are converting all physics shapes to multiple spheres. If you split grass instances to chunks you can just cull colliders per chunk and it's also easier to update distance chunks less often. Trying to update all grass once might not be best for flexibility and performance.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!