render3d: grass in chunks of 256 tiles a draw, flower casters only into the cascades they reach
Grass (Vulkan with multi-draw indirect): every visible tile is a record in one buffer, uploaded once a frame, and each band draws its records 256 at a time. A record's firstInstance is its place in the chunk times 65536; grass.vert's TILES variant reads that place's corner and indices per cell from u_tiles. R3D_GRASS_TILES=1 keeps a draw per tile. OpenGL is unchanged. Casters: a LOD level with no impostor is drawn into a shadow cascade only when its distance band, widened by six times its height, the camera's height over the ground and the frustum's corner reach, can touch that cascade's receivers. The flowers' mesh levels (6 - 30 m) leave the three outer cascades. R3D_CAST_ALL=1 draws every level everywhere. OpenGL frames byte-identical at all five viewpoints; alpha-tested shadow draws at a 460 -> 244. gpu_has_mdi() guards both this and the GPU-culled trees' multi-record draws. Camp: Mac Vulkan 2645 -> 2191 (grass) -> 2034 draws; PC 2657 -> 2046, self-tests 59/59, validation 0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
d8300a7bf9
commit
cdfffa62bb
9 changed files with 202 additions and 9 deletions
|
|
@ -647,6 +647,77 @@ T 7ed7de52 u_prefilter 8
|
|||
T 7ed7de52 u_shadow 9
|
||||
T 7ed7de52 u_tershadow 10
|
||||
T 7ed7de52 u_ts_height 11
|
||||
P 7f096322 grass.vert model.frag #define FOLIAGE;#define BLADE;#define TILES;
|
||||
B 7f096322 vert 0 4400
|
||||
U 7f096322 vert u_view 0 mat4 1 0
|
||||
U 7f096322 vert u_proj 64 mat4 1 0
|
||||
U 7f096322 vert u_vp 128 mat4 1 0
|
||||
U 7f096322 vert u_cam_pos 192 vec3 1 0
|
||||
U 7f096322 vert u_time 204 float 1 0
|
||||
U 7f096322 vert u_ts_origin 208 vec2 1 0
|
||||
U 7f096322 vert u_ts_half 216 float 1 0
|
||||
U 7f096322 vert u_ortho_on 220 float 1 0
|
||||
U 7f096322 vert u_lake_level 224 float 1 0
|
||||
U 7f096322 vert u_sea_level 228 float 1 0
|
||||
U 7f096322 vert u_lake 240 vec4 1 0
|
||||
U 7f096322 vert u_snow_line 256 float 1 0
|
||||
U 7f096322 vert u_wind 260 float 1 0
|
||||
U 7f096322 vert u_tile 264 vec2 1 0
|
||||
U 7f096322 vert u_tile_cells 272 int 1 0
|
||||
U 7f096322 vert u_per_cell 276 int 1 0
|
||||
U 7f096322 vert u_tiles 288 vec4 256 16
|
||||
U 7f096322 vert u_s0 4384 float 1 0
|
||||
U 7f096322 vert u_d0 4388 float 1 0
|
||||
U 7f096322 vert u_radius 4392 float 1 0
|
||||
U 7f096322 vert u_dbg 4396 int 1 0
|
||||
I 7f096322 a_pos 0 vec3
|
||||
I 7f096322 a_uv 2 vec2
|
||||
B 7f096322 frag 1 892
|
||||
U 7f096322 frag u_cascade_vp 0 mat4 5 64
|
||||
U 7f096322 frag u_cascade_split 320 float 5 16
|
||||
U 7f096322 frag u_cascade_range 400 float 5 16
|
||||
U 7f096322 frag u_cascade_texel 480 float 5 16
|
||||
U 7f096322 frag u_sun_dir 560 vec3 1 0
|
||||
U 7f096322 frag u_sun_color 576 vec3 1 0
|
||||
U 7f096322 frag u_cam_pos 592 vec3 1 0
|
||||
U 7f096322 frag u_prefilter_levels 604 float 1 0
|
||||
U 7f096322 frag u_fog_density 608 float 1 0
|
||||
U 7f096322 frag u_fog_height_falloff 612 float 1 0
|
||||
U 7f096322 frag u_fog_base 616 float 1 0
|
||||
U 7f096322 frag u_clip_y 620 float 1 0
|
||||
U 7f096322 frag u_spec_scale 624 float 1 0
|
||||
U 7f096322 frag u_sky_rot 632 vec2 1 0
|
||||
U 7f096322 frag u_ibl_scale 640 vec3 1 0
|
||||
U 7f096322 frag u_daylight 652 float 1 0
|
||||
U 7f096322 frag u_fire_pos 656 vec3 1 0
|
||||
U 7f096322 frag u_fire_color 672 vec3 1 0
|
||||
U 7f096322 frag u_hand_pos 688 vec3 1 0
|
||||
U 7f096322 frag u_hand_color 704 vec3 1 0
|
||||
U 7f096322 frag u_hand_dir 720 vec3 1 0
|
||||
U 7f096322 frag u_hand_cone 732 float 1 0
|
||||
U 7f096322 frag u_ts_origin 736 vec2 1 0
|
||||
U 7f096322 frag u_ts_half 744 float 1 0
|
||||
U 7f096322 frag u_ts_on 748 float 1 0
|
||||
U 7f096322 frag u_force_cascade 752 int 1 0
|
||||
U 7f096322 frag u_cloud_shadow 756 float 1 0
|
||||
U 7f096322 frag u_time 760 float 1 0
|
||||
U 7f096322 frag u_model_h 764 float 1 0
|
||||
U 7f096322 frag u_view 768 mat4 1 0
|
||||
U 7f096322 frag u_tint 832 vec3 1 0
|
||||
U 7f096322 frag u_rough_scale 844 float 1 0
|
||||
U 7f096322 frag u_emissive 848 float 1 0
|
||||
U 7f096322 frag u_blade_base 864 vec3 1 0
|
||||
U 7f096322 frag u_blade_tip 880 vec3 1 0
|
||||
T 7f096322 u_arm 2
|
||||
T 7f096322 u_brdf 3
|
||||
T 7f096322 u_diff 4
|
||||
T 7f096322 u_irradiance 5
|
||||
T 7f096322 u_nrm 6
|
||||
T 7f096322 u_ortho 7
|
||||
T 7f096322 u_prefilter 8
|
||||
T 7f096322 u_shadow 9
|
||||
T 7f096322 u_tershadow 10
|
||||
T 7f096322 u_ts_height 11
|
||||
P 3733fc38 impostor.vert impostor.frag
|
||||
B 3733fc38 vert 0 232
|
||||
U 3733fc38 vert u_view 0 mat4 1 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue