Logo Test 2019
  • Tile Composer
      • Back
      • Documentation
          • Back
          • Introduction
          • Documentation: Tile Collections
          • Documentation: Tile
          • Documentation: Tile Composer
          • Documentation: Solvers
          • Documentation: Helpful Tools
          • Tutorial: Empty Tiles
          • Tutorial: Connectors
          • Tutorial: Neighbors from mesh
          • Tutorial: Neighbor matrix editing
          • Combining Workflows
          • Tutorial: Multiple Tile Composer Passes
          • Custom Grid Types
  • DirectX 11 Grass Shader
      • Back
      • Documentation
          • Back
          • General Overview
          • Grass Painter
          • Interaction System
          • CPU Fallback
          • Grass Texture Atlas Templates
          • Performance Optimization
          • Improve Visuals
          • Virtual Reality
          • Using URP and HDRP
          • Upgrade to version 2
  • Contact

Documentation

  • General Overview
  • Grass Painter
  • Interaction System
  • CPU Fallback
  • Grass Texture Atlas Templates
  • Performance Optimization
  • Improve Visuals
  • Virtual Reality
  • Using URP and HDRP
  • Upgrade to version 2

Table of Contents

  • CPU Fallback Overview
  • How-To: Set up the grass fallback component
  • Texture Atlas Renderer Settings
    • Texture Atlas
      • Target Texture Size
      • Rows Per Grass Type
      • Dilation Steps
    • Grass Amount
      • Blades of grass
    • Density
      • Density Cutoff
      • Density Randomization
  • Grass Fallback Renderer
    • Instancing
    • Levels of Detail
DirectX 11 Grass Shader > Documentation > CPU Fallback

CPU Fallback Overview

The CPU Fallback is meant as an easy to use alternative to the DirectX 11 Grass shader. As Unity's OpenGL cross compiler has some problems and instabilities when used with high-end shader effects (e.g. geometry shaders and tessellation), it is still impossible to use the grass shader for consoles and mobile devices (although some consoles have been reported to work, you should try it yourself to be sure).

Instead of having to create a billboard texture manually, the goal of the grass fallback system is to automatically render a snapshot of your grass material in action, which can then be used on non-PC hardware, or lower end devices.

Alternatively, you could also use it as your main grass solution, by designing the material with the shader and using the fallback as you main grass renderer.

How-To: Set up the grass fallback component

  1. Select your grass object, where your Nature Mesh Filter and your Grass Renderer component should be located.
  2. Add Component: Stix Games > General > Grass Fallback
  3. Set up the fallback component.
  4. Press the Generate Texture Atlas button.

Texture Atlas Renderer Settings

These are the settings for the grass fallback preprocessor. It automatically creates a texture atlas from your grass material (taken from the Grass Renderer component).

Read the tooltips for more information on each setting. If you'd like to have more detailed explanations for one of the parameters, or for the tool in general, please use the contact form for your feedback!

The grass fallback and the grass shader aren't perfectly equivalent, so you'll have to do some fine tuning yourself. The following settings are the most important ones for achieving this goal are the following:

Texture Atlas

Target Texture Size

Sets the size of the fallback texture. All density types will share this atlas, so the texture should be fairly large.

Rows Per Grass Type

How many variants of each grass type will be used? With one row this will be 4 variants, with two rows 8 variations. Higher values will cause more variations, but lower texture quality, per billboard.

Dilation Steps

This feature is still not finished. It works well for textures with very hard borders, e.g. full alpha where the grass is visible and zero alpha where the grass isn't. For textures with smooth borders, it causes problems, so you should set it to 0.

Textures have a color value, even when the texture is actually transparent at this position. If the color is black, this can cause black borders around the texture, when mipmaps are used, or the alpha cutoff isn't set perfectly. Texture dilation takes the color of the texture and copies it into the transparent areas.

Grass Amount

Blades of grass

Probably the most important setting for visuals. This setting defines how many blades of grass will be rendered per billboard at full grass density. You can use this setting to match the fallback closer to the original shader.

Density

Density Cutoff

To prevent grass types with very low density from being rendered, adjust this setting. If one of the grass types is in areas where it shouldn't be, increase this value. If a type isn't rendered in an area for the grass fallback, decrease the cutoff value.

Density Randomization

In an area with equal density, this setting prevents the same texture being used for all billboards. If the setting is 0, the same density will lead to exactly the same billboard texture. If the setting is too high, grass density will no longer be accurate and densities will appear stronger or weaker than intended.

Grass Fallback Renderer

The controls for the grass fallback renderer are created to mimic the behavior of the grass shader. Further visual improvements can be expected in future updates.

Instancing

Grass fallback can be run purely on the CPU, or use GPU instancing to optimize the renderer. If your hardware supports it, you should probably use instancing.

Levels of Detail

The fallback renderer runs on the CPU, so we can have more control over LOD than with the shader.

Set the number of levels in the LOD array, then configure the following settings:

  • Density: The number of billboards per unit.
  • Fade Start: The distance at which the billboards will start to fade away.
  • Fade End: The distance where the level of detail will be completely faded away.

Unlike the grass shader, where Target Density is still a fairly vague value, the density for the grass fallback represents the number of billboards per Unity unit (meter)


If you think something is missing from this documentation page, or would like to give us feedback, please contact us through the contact form.
Logo Test 2019
© StixGames 2015 - 2023
All rights reserved.
The entered information could not be validated.
You will receive a mail to confirm your registration.

Impressum