sergi.gonzalez
Newcomer
Hi,
I've been thinking in a new algorithm to render huge quantities of grass vegetation without performing vertex shader lookups. The idea is simple:
1 Generate a density map for the terrain (0 means low density, 1 high density)
2 Generate a grass patch with a fixed size (m x n meters)
3 Generate a n-tree where leaf nodes have the size of the patch.
4 Store the following attributes in each leaf node:
- 1 float4: 3d position+density (density value extracted from density map)
- 4 float4: 4 planes that define the convex space of the terrain cell
- 1 float: angle of rotation arround xz plane (y is up)
5 In the culling pass, get the visible leaf nodes
6 Render the grass patch with instancing using attributes from the nodes
In total, I have 21 floats per instance (6 float4, 3 floats unused). I'd like to store 8 floats (2 float4) as maximum per instance. And the questions are:
Q1. How can I compress the data without losing a lot accuracy?
Q2. The convex space is the key. Do you know another method to store a space defined by 4 convex planes?
Cheers,
S.
I've been thinking in a new algorithm to render huge quantities of grass vegetation without performing vertex shader lookups. The idea is simple:
1 Generate a density map for the terrain (0 means low density, 1 high density)
2 Generate a grass patch with a fixed size (m x n meters)
3 Generate a n-tree where leaf nodes have the size of the patch.
4 Store the following attributes in each leaf node:
- 1 float4: 3d position+density (density value extracted from density map)
- 4 float4: 4 planes that define the convex space of the terrain cell
- 1 float: angle of rotation arround xz plane (y is up)
5 In the culling pass, get the visible leaf nodes
6 Render the grass patch with instancing using attributes from the nodes
In total, I have 21 floats per instance (6 float4, 3 floats unused). I'd like to store 8 floats (2 float4) as maximum per instance. And the questions are:
Q1. How can I compress the data without losing a lot accuracy?
Q2. The convex space is the key. Do you know another method to store a space defined by 4 convex planes?
Cheers,
S.
Last edited by a moderator: