Announcement

Collapse
No announcement yet.

Hiding Foliage around Objects (Buildings, Rocks etc:)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hiding Foliage around Objects (Buildings, Rocks etc:)

    Hi,
    I'm working on an RTS game which also includes building. This in itself is not a problem but I do have alot of foliage especialy grass which can clip through buildings, so I want to leave some room between a building and the grass and this has to happen during runtime.

    On my first test map I just removed or changed the transform of the grass to 0 around buildings. This however does not work anymore on the actual game map since it is much bigger and causes quite some lag when I'm removing instanced static meshes so i wanted to just do it within the shader.

    There are two different shader functions to get the distance field mesh data and calculate the distance to the nearest distance field. So within my grass material I can use this to just hide the grass around buldings. This however causes the dynamic shadows to not work properly. (either no shadows at all or the shadows of the removed grass are still rendered)

    I do have a question for two solutions I have tried in the answer hub (https://answers.unrealengine.com/que...6296/view.html) however i feel like this might be more complicated than I thought. So maybe someone has an idea how I could achiev this differently. I feel like doing it in the shader is still the way to go but everything that works would be ebough for me.

    I would really appreciate any suggestions for alternative solutions or obviously help to fix the solution I tried unsuccessfully.
Working...
X