Forge Grass Rendering logo

Forge Grass Rendering

Community
Nebulavenus
forge-grass-rendering

Add instanced grass rendering with segmented blades, wind animation, LOD density rings, and terrain LOD with geomorphing to an SDL GPU project

Overview

PublisherNebulavenus
Repositoryforge-gpu
Skill nameforge-grass-rendering
Stars
46
Forks
7
Bundled files
Instructions only
LicenseZlib
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Nebulavenus on GitHub. Read the source before you install it.

Installation

Install the Forge Grass Rendering AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/grass-rendering
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nebulavenus/forge-gpu.git /tmp/forge-gpu
mkdir -p .claude/skills
cp -r /tmp/forge-gpu/.claude/skills/grass-rendering .claude/skills/forge-grass-rendering
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Forge Grass Rendering in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Forge Grass Rendering on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Forge Grass Rendering is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Add grass rendering to an SDL GPU project using forge_scene.h. Implements instanced segmented grass blades with wind animation, density-based LOD rings, and tile-based terrain LOD with vertex shader geomorphing.

When to use

  • Adding vegetation to a 3D scene
  • Implementing instanced rendering with per-instance attributes
  • Adding LOD systems for both terrain and foliage
  • Split-screen or multi-viewport rendering

Key API calls

  • forge_shapes_plane() — generate tile meshes at different resolutions
  • forge_scene_upload_buffer_deferred() — per-frame instance buffer upload
  • forge_scene_create_shader() — create custom shaders alongside forge_scene
  • SDL_SetGPUViewport() / SDL_SetGPUScissor() — split-screen viewports
  • SDL_DrawGPUIndexedPrimitives() — instanced draw with per-instance buffer
  • forge_noise_fbm2d() — procedural heightmap generation
  • forge_hash_wang() / forge_hash_to_float() — deterministic placement variation

Correct order

  1. Generate procedural heightmap via fBm noise
  2. Upload heightmap as R32_FLOAT GPU texture
  3. Create tile meshes at multiple LOD resolutions (both triangle and line IBs)
  4. Create grass blade meshes at multiple segment counts
  5. Create pipelines: terrain fill/line/shadow + grass fill/line/shadow
  6. Per frame: a. Select terrain tile LODs based on camera distance b. Place grass instances with distance/frustum/slope culling c. Upload instance buffers via deferred upload d. Shadow pass: draw terrain tiles + near grass into shadow map e. Main pass: set left viewport → draw terrain + grass filled; set right viewport → draw terrain + grass wireframe f. Reset viewport for UI

Grass blade geometry

Each blade is a vertical segmented strip with 2*(N+1) vertices and 2*N triangles. The height_t attribute (0 at base, 1 at tip) controls wind weighting and tapering.

c
for (int i = 0; i <= segments; i++) {
    float t = (float)i / (float)segments;
    float half_w = 0.5f * (1.0f - t * GRASS_BLADE_TIP_TAPER);
    verts[2*i+0] = (GrassVertex){ {-half_w, t, 0}, t };
    verts[2*i+1] = (GrassVertex){ { half_w, t, 0}, t };
}

Per-instance data

c
typedef struct {
    float position[3];   /* world-space base position */
    float rotation;      /* Y-axis rotation (radians) */
    float scale[2];      /* width, height             */
    float color[3];      /* RGB tint                  */
    float _pad;          /* alignment to 40 bytes     */
} GrassInstance;

Wind animation (vertex shader)

hlsl
float wind_weight = height_t * height_t;  /* quadratic: tip bends most */
float phase = time * wind_speed + world.x * 0.7 + world.z * 0.3;
float wind_offset = sin(phase) * wind_strength * wind_weight;

Terrain geomorphing (vertex shader)

hlsl
float2 snapped_uv = round(global_uv / coarse_cell_size) * coarse_cell_size;
float2 morphed_uv = lerp(global_uv, snapped_uv, morph_factor);
float morphed_x = lerp(world_x, snapped_x, morph_factor);
float h = height_tex.SampleLevel(smp, morphed_uv, 0).r;

Common mistakes

  • Forgetting half-aspect projection — split-screen viewports are half the screen width, so the projection matrix must use half_w / height aspect
  • Using TRIANGLELIST pipeline for wireframe — the right viewport needs a LINELIST pipeline with a separate line index buffer (each triangle edge as two indices)
  • Grass shadow without wind — the shadow vertex shader must apply the same wind animation as the main shader, or shadows will not match blade positions
  • Missing morph factor — without geomorphing, terrain tile LOD switches cause visible popping; morph_factor must ramp 0→1 in the last 20% of each LOD distance band
  • Forgetting to reset viewport for UI — after right-viewport draws, reset viewport and scissor to full screen before forge_scene_end_main_pass

Reference

See Lesson 50 — Grass Rendering for the full implementation.

Frequently asked questions

What does the Forge Grass Rendering AI skill do?

Add instanced grass rendering with segmented blades, wind animation, LOD density rings, and terrain LOD with geomorphing to an SDL GPU project

Why use Forge Grass Rendering on TypingMind?

Because you install it once and use it with any model. Forge Grass Rendering is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Forge Grass Rendering in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/grass-rendering. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Forge Grass Rendering?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Forge Grass Rendering?

As many as you like. As long as a model supports skills, you can use Forge Grass Rendering with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Forge Grass Rendering AI skill free?

Yes. It is published on GitHub by Nebulavenus under the Zlib license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇