render3d: a grass kind - the GPU blades' per-kind numbers are a GrassKind record the game hands over (grass_kind_set), not constants
GrassKind (grass_kind.ludic) carries what grass.ludic, grass_gpu.ludic, grass.vert, grass_cull.comp and model.frag's BLADE path held as constants: the cell, s0 / d0 / radius, the row bands and rows, the blade profile (neck, root, swell, tip, bend), the heights, clumps, widths and arch, where it grows (slope, snow, the photograph's test), the root / tip / gone-to-seed colours, the far tufts, the root occlusion, the roughness, the sheen and the wind. Its defaults are those constants exactly, so a game that sets nothing draws as before. The shaders read them as u_gk_* (the cull as five more Params vec4s, 288 bytes); grass_reset.comp writes each band's index count so a kind of other rows reaches the draw in order. grass_quality holds the kind to a settings tier (never denser, never farther); R3D_GRASS_* still win. grass_profile_w / _bend are the one profile, for the meshes and a game's preview. grass.mesh takes only the cell: the rest of it is an older copy that already differs from grass.vert, left as it draws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d9a73d63bd
commit
e908672034
25 changed files with 335 additions and 75 deletions
|
|
@ -116,6 +116,7 @@ uniform float u_d0;
|
|||
uniform float u_radius;
|
||||
uniform float u_px; // one pixel in radians (grass.vert)
|
||||
uniform int u_dbg;
|
||||
uniform vec4 u_gk_ortho; // the grass kind's (grass_bind_kind): w its cell (m); the rest is grass.vert's
|
||||
out vec3 v_wpos[];
|
||||
out vec3 v_nrm[];
|
||||
out vec2 v_uv[];
|
||||
|
|
@ -124,7 +125,9 @@ out vec2 v_rot[];
|
|||
out float v_hull[];
|
||||
out float v_quake[]; // grass does not quake; written so model.frag can read it
|
||||
|
||||
const float CELL = 4.0; // grass.ludic GRASS_CELL: 4 m, so a near tile asks for what its blades need
|
||||
// The kind's cell, as the CPU's tiles count it. Nothing else of the kind reaches this path yet: its
|
||||
// shape, sizes and density test are an older copy of grass.vert's, kept as they draw today.
|
||||
#define CELL u_gk_ortho.w
|
||||
float hash1(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); }
|
||||
uint pcg(uint v) { uint s = v * 747796405u + 2891336453u; uint w = ((s >> ((s >> 28u) + 4u)) ^ s) * 277803737u; return (w >> 22u) ^ w; }
|
||||
float bladeHash(ivec2 cell, int j, int k) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue