Jump to content

Rendering Foliage


SpiderPig
 Share

Recommended Posts

Hey guys, I'm working on a procedural foliage volume and am now wondering on the best approach on rendering lots of foliage.  Many of you probably have a better idea than me.

  • Instancing (what I'm using at the moment)
    • Easy to implement but is slow considering the amount of entities that will need culling.  Ultra is faster than Leadwerks but I'd prefer not to push it with heaps of foliage.
  • Geometry Shader
    • Limited amount of vertices per input triangle can be output but perhaps the best option.  Pass in a texture with a position for each instance and duplicate each face in the shader.  I've done this before for grass.
  • Compute shader
    • Not sure how these work - can they run once to generate a large mesh and leave it in GPU memory without further transfer with the CPU?  Or do they run every frame like a geometry shader?
  • Something else? <_<

ProceduralFoliage.thumb.png.c93bbb9ce8e226df612259c976fc84b6.png

Link to comment
Share on other sites

As I understand it, geometry shaders are pretty much useless because they have to sync with the CPU:
http://www.joshbarczak.com/blog/?p=667

I have not read that entire article, and I don't fully understand the issue, I just know this is common belief and I didn't bother looking into it beyond that.

Instancing will be very fast and culling will not slow down the renderer at all. One of the benchmark tests shows 64,000 instanced objects. Ultra might not need any special vegetation techniques at all because it already is so fast. For very large scale stuff I have some ideas in mind, but we are talking tens of millions of objects.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

19 minutes ago, Josh said:

Instancing will be very fast and culling will not slow down the renderer at all. One of the benchmark tests shows 64,000 instanced objects. Ultra might not need any special vegetation techniques at all because it already is so fast. For very large scale stuff I have some ideas in mind, but we are talking tens of millions of objects.

Wow, okay.  That's awesome.  I'll give that article a browse I didn't know it had to sync with the CPU.  Does this mean Ultra won't support Geometry shaders at all because of this?

Right now I'm seeing a considerably delay in the entities popping into the cameras view.  The more objects there are the longer it takes.  I should count how many objects I have on screen but it's not 64,000.  This is debug mode however.  Haven't tested release yet.

Link to comment
Share on other sites

2 hours ago, SpiderPig said:

Does this mean Ultra won't support Geometry shaders at all because of this?

Geometry shaders are supported, but I am not using them for anything.

Well, actually I was using them in the GPU voxel rasterizer.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I think what I might do here is keep trees as an instance.  But for small plants and shrubs which might cluster in large quantities is build a mesh grid of them, say 16x16 meshes joined togeather in a single mesh and then instance that throughout a single volume.  Then the vertex or geometry shaders can hide / show, rotate and move certain parts of the mesh around based on a data found in a texture stretched across a single volume.  I image the geometry shader not being to bad if its not pushing out extra vertices.  Might tackle this in the new year - after the voxel terrain.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...