meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
grass-and-undergrowth [2023/04/04 09:57]
steph.jorgensen
grass-and-undergrowth [2023/04/04 09:58] (current)
steph.jorgensen
Line 13: Line 13:
 In the reference application, grass cells are populated using a procedural approach, but any population procedure will work. In the reference application, grass cells are populated using a procedural approach, but any population procedure will work.
  
-===== Getting Started =====+===== Getting started =====
  
 There are several classes and structures you'll need to get started: There are several classes and structures you'll need to get started:
Line 32: Line 32:
 These data structures are detailed in [[culling-and-population-structures|Culling and Population Structures]]. These data structures are detailed in [[culling-and-population-structures|Culling and Population Structures]].
  
-===== Streaming and Culling =====+===== Streaming and culling =====
  
 As shown in ''CMyPopulate::StreamGrass()'', the general procedure followed for each frame where the camera has moved is outlined below: As shown in ''CMyPopulate::StreamGrass()'', the general procedure followed for each frame where the camera has moved is outlined below:
Line 54: Line 54:
  
  
-===== Additional Considerations =====+===== Additional considerations =====
  
-==== Cell Size ====+==== Cell size ====
  
 You can pick different cell sizes per grass type and it can impact both CPU and GPU performance a great deal. Each grass model is culled in a separate call, so separate sizes are easily accommodated. In contrast to tree instances, grass instances are not individually culled. If the cell is in the frustum, then every instance in it will be rendered. This cuts down on CPU usage greatly, but can be hard on the GPU for higher grass densities. To strike a balance, smaller cell sizes can be used. We recommend smaller cell sizes for high-density grass, and larger sizes for sparse models like rocks or boulders. You can pick different cell sizes per grass type and it can impact both CPU and GPU performance a great deal. Each grass model is culled in a separate call, so separate sizes are easily accommodated. In contrast to tree instances, grass instances are not individually culled. If the cell is in the frustum, then every instance in it will be rendered. This cuts down on CPU usage greatly, but can be hard on the GPU for higher grass densities. To strike a balance, smaller cell sizes can be used. We recommend smaller cell sizes for high-density grass, and larger sizes for sparse models like rocks or boulders.
Line 62: Line 62:
 By way of example, the reference application's example forest (modeled in feet) uses cell sizes of 20 for the high-density grass, and up to 100 for the sparsely populated models. By way of example, the reference application's example forest (modeled in feet) uses cell sizes of 20 for the high-density grass, and up to 100 for the sparsely populated models.
  
-==== Heap Fragmentation Control ====+==== Heap fragmentation control ====
  
 The organization of multiple types of grass into an arbitrary collection of cells can easily lead to a great number of heap allocations. We leave it to the user to implement their own population approach that doesn't cause undue heap fragmentation if that's a requirement for your title or project. The organization of multiple types of grass into an arbitrary collection of cells can easily lead to a great number of heap allocations. We leave it to the user to implement their own population approach that doesn't cause undue heap fragmentation if that's a requirement for your title or project.
  
 To control the SDK's heap behavior, be sure to read about the [[using-the-reserves-system|Reserves System]]. To control the SDK's heap behavior, be sure to read about the [[using-the-reserves-system|Reserves System]].