SpiderPig Posted December 15, 2022 Share Posted December 15, 2022 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? Quote Link to comment Share on other sites More sharing options...
Josh Posted December 15, 2022 Share Posted December 15, 2022 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. 1 Quote 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 More sharing options...
SpiderPig Posted December 15, 2022 Author Share Posted December 15, 2022 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. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted December 15, 2022 Author Share Posted December 15, 2022 36 minutes ago, Josh said: 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 Interesting read. I won't be using a geometry shader. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted December 15, 2022 Author Share Posted December 15, 2022 I know you said you were working on some camera frustum prediction stuff but here's a video of what I mean anyway. https://www.youtube.com/watch?v=ZaCYZblBrhU Quote Link to comment Share on other sites More sharing options...
Josh Posted December 15, 2022 Share Posted December 15, 2022 Whoa, that is really slow. Is this in debug mode? Quote 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 More sharing options...
Josh Posted December 15, 2022 Share Posted December 15, 2022 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. 1 Quote 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 More sharing options...
SpiderPig Posted December 15, 2022 Author Share Posted December 15, 2022 7 hours ago, Josh said: Whoa, that is really slow. Is this in debug mode? Yeah it is. Release is much faster but still noticable if the camera moves fast. I can put an example togeather with that pine tree I sent you if you like. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted December 18, 2022 Author Share Posted December 18, 2022 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.