How lgabellini1/ue5-custom-grass-plugin works
1. Project shape
- This is an Unreal Engine 5 plugin named CustomGrass, not a standalone app.
- The repo is organized around a single runtime module in Source/CustomGrass plus a small shader bundle in Shaders/.
2. Primary purpose
- The plugin implements a custom procedural grass system for landscapes.
- It hooks into the UE5 rendering pipeline directly, rather than using only high-level gameplay objects or standard foliage tooling.
3. Top-level module boundary
- CustomGrass.Build.cs defines the module’s UE dependencies and is the main boundary between this plugin and the engine.
- CustomGrass.cpp / CustomGrass.h are the module entry points that register the plugin’s runtime behavior.
4. Gameplay/runtime orchestration
- CustomGrassWorldSubsystem is the system-level coordinator that likely lives per-world and manages grass lifecycle for a loaded level.
- CustomGrassSettings provides configuration/state for the system, while CustomGrassDataAsset suggests authoring data for grass behavior or appearance.
- These pieces form the non-rendering control plane of the plugin.
5. Scene integration
- CustomGrassPrimitiveComponent is the bridge from gameplay/world data into the renderer.
- It likely creates and owns the renderable representation of the grass, exposing the component to the engine’s actor/component framework.
- This is the main boundary where grass becomes a scene object that the renderer can consume.
6. Render proxy boundary
- CustomGrassSceneProxy is the key rendering-side abstraction.
- In Unreal, the scene proxy is the per-scene-thread render representation of a component, so this is where the plugin crosses from game-thread ownership into render-thread rendering.
- CustomGrassSceneProxy.h/.cpp are therefore central to the architecture diagram.
7. Custom geometry/shader path
- CustomGrassVertexFactory is the low-level integration point that tells UE how to feed grass vertex data into the GPU pipeline.
- This strongly suggests the plugin does not rely on standard mesh rendering alone; it defines its own vertex layout/streaming path for procedural grass.
- The vertex factory is likely consumed by custom shaders in Shaders/VertexFactory.ush and Shaders/VertexShader.ush.
8. Shader subsystem
- The Shaders/ folder contains UE shader source files:
- Shared.ush for common shader code,
- VertexFactory.ush for vertex input/format logic,
- VertexShader.ush for vertex-stage behavior,
- Compute.usf for compute-shader work.
- This indicates a split between compute-driven data generation and GPU rendering of grass blades.
9. Data flow through the system
- Typical flow is: world/subsystem configures grass rules and data assets -> primitive component creates scene representation -> scene proxy submits render resources -> vertex factory and shaders draw the grass.
- The compute shader likely participates earlier in the pipeline to generate, cull, or prepare grass instances before the final draw.
10. Runtime vs render responsibilities
- The plugin is structured around UE’s standard thread boundary:
- Game/world side: subsystem, settings, data asset, primitive component.
- Render side: scene proxy, vertex factory, shader code.
- This separation is important for diagramming because most architecture decisions hinge on which side owns state and which side consumes it.
11. Platform and engine context
- The README states development targeted Unreal Engine 5.7 on Windows 11.
- The design is therefore tightly coupled to UE’s modern rendering architecture and is not intended to be engine-agnostic.
12. Maturity/usage scope
- The README explicitly says this is a personal learning/showcase project, not a polished public plugin.
- For an architecture diagram, treat it as a focused experimental subsystem with a narrow domain: procedural landscape grass rendering.
13. What to emphasize in a diagram
- Show one clear chain from world/system configuration to component ownership to render proxy to custom vertex factory + shaders.
- Also show the compute shader path as a supporting GPU processing stage feeding the final grass rendering.
Main entry points: CustomGrassVertexFactory.cpp Vertex factory · CustomGrassPrimitiveComponent.cpp Grass component · CustomGrassWorldSubsystem.cpp World subsystem · CustomGrass.cpp Plugin module
Components 16
Game / World
World-side orchestration and authoring data.
- Module build · Defines engine dependencies and plugin module boundary.
Source/CustomGrass/CustomGrass.Build.cs - Plugin module · Module entry point that registers runtime behavior.
Source/CustomGrass/Private/CustomGrass.cpp - Module API · Public module declarations and exported interface.
Source/CustomGrass/Public/CustomGrass.h - World subsystem · Per-world runtime coordinator for grass lifecycle.
Source/CustomGrass/Private/CustomGrassWorldSubsystem.cpp - Settings · Runtime configuration for grass behavior and tuning.
Source/CustomGrass/Private/CustomGrassSettings.cpp - Grass data · Authoring data for grass appearance or rules.
Source/CustomGrass/Public/CustomGrassDataAsset.h - Grass component · Bridge from world data into the renderer.
Source/CustomGrass/Private/CustomGrassPrimitiveComponent.cpp - Component API · Public declarations for the grass component.
Source/CustomGrass/Public/CustomGrassPrimitiveComponent.h
Render Path
Scene-thread and GPU rendering integration.
- Scene proxy · Per-scene render representation of the grass component.
Source/CustomGrass/Private/CustomGrassSceneProxy.cpp - Proxy API · Render-side proxy declarations and interface.
Source/CustomGrass/Private/CustomGrassSceneProxy.h - Vertex factory · Defines custom vertex streams and GPU input layout.
Source/CustomGrass/Private/CustomGrassVertexFactory.cpp - VF API · Vertex factory declarations used by the render path.
Source/CustomGrass/Private/CustomGrassVertexFactory.h
Shaders
Custom shader sources used by the plugin.
- Shared shader · Common shader code shared across the grass pipeline.
Shaders/Shared.ush - VF shader · Vertex factory shader logic and input mapping.
Shaders/VertexFactory.ush - Vertex shader · Vertex-stage behavior for rendering grass blades.
Shaders/VertexShader.ush - Compute pass · GPU preprocessing for generation, culling, or setup.
Shaders/Compute.usf
Connections 18
- Module build → Plugin module: builds · Build rules define the runtime module boundary.
- Plugin module → World subsystem: registers · Module startup enables world-level grass orchestration.
- Plugin module → Grass component: exposes · Module provides the scene component integration point.
- World subsystem → Settings: configures · Subsystem uses settings to control runtime behavior.
- World subsystem → Grass data: consumes · Subsystem reads authoring data for grass rules and appearance.
- World subsystem → Grass component: spawns · World logic creates component-backed grass representation.
- Settings → Grass component: drives · Configuration affects component setup and updates.
- Grass data → Grass component: feeds · Authoring data is turned into scene-facing grass state.
- Grass component → Scene proxy: creates · Component hands off render ownership to a scene proxy.
- Component API → Grass component: declares · Public component interface backs the runtime implementation.
- Proxy API → Scene proxy: declares · Proxy header defines the render-side abstraction.
- Scene proxy → Vertex factory: binds · Scene proxy binds the custom GPU input path.
- VF API → Vertex factory: declares · Vertex factory header supports the render implementation.
- Vertex factory → Shared shader: includes · Vertex factory logic reuses common shader code.
- Vertex factory → VF shader: drives · Vertex factory feeds its shader-side input contract.
- Vertex factory → Vertex shader: feeds · Custom vertex streams are consumed by the vertex shader stage.
- Compute pass → Vertex factory: prepares · Compute work can generate or cull data used by the draw path.
- Compute pass → Vertex shader: supports · Compute preprocessing supports final vertex-stage rendering.