code wiki / (root) / nx_world_cumulus_t156.nx

nx_world_cumulus_t156.nx source

↩ module page · 143 lines · 17085 B

1// Private multiscale cumulus qualification; canonical terrain/cast unchanged. 2// Relative scene radiance is reconstructed by inverse of nx_tonemap_aces Q10 rational fit plus nx_atmosphere sqrt convention. 3// This cannot recover clipped physical energy. Palette1 is representative primary-land albedo, not measured hemispheric irradiance. 4// Solar irradiance separates scalar inverse-tone intensity from squared authored RGB chromaticity; per-channel inverse near clipping amplified false warm colors. Relative, not calibrated. 5// Two scattering octaves (half extinction, half contribution, half anisotropy) approximate higher orders, not a path-traced solution. 6// One cloud tone/display encode after linear composite. Incumbent final world grade remains downstream. 7import "nx_world_shader_src.nx" 8// World-unit artistic cumulus profile, emitted through existing shared IR; not measured weather. 9const CC_BODY_XZ: *u8 = "64.0" 10const CC_BODY_Y: *u8 = "48.0" 11const CC_DETAIL_XZ: *u8 = "8.0" 12const CC_DETAIL_Y: *u8 = "8.0" 13const CC_OCTAVE_LACUNARITY: *u8 = "2.0" 14const CC_OCTAVE_PERSISTENCE: *u8 = "0.5" 15 16func ws_fn_cvol_cumulus_t156(m: *i64) -> i64 { 17 let f: i64 = sir_func(m, "cvol" as *u8, T_F32) 18 sir_param(m, f, "p" as *u8, T_V3F) 19 ws_st(m, f, sir_let(m, "hf" as *u8, T_F32, ws_bin(m, "/" as *u8, ws_bin(m, "-" as *u8, ws_sx(m, "p" as *u8, T_V3F, "y" as *u8, T_F32), ws_f(m, CB_BASE), T_F32), ws_bin(m, "-" as *u8, ws_f(m, CB_TOP), ws_f(m, CB_BASE), T_F32), T_F32))) 20 ws_st(m, f, sir_let(m, "wind" as *u8, T_V3F, ws_v3(m, ws_bin(m, "*" as *u8, ws_bin(m, "/" as *u8, ws_id(m, "t" as *u8, T_F32), ws_f(m, CB_DRIFT_X), T_F32), ws_f(m, CB_CELL), T_F32),ws_f(m, "0.0" as *u8),ws_bin(m, "*" as *u8, ws_bin(m, "/" as *u8, ws_id(m, "t" as *u8, T_F32), ws_f(m, CB_DRIFT_Z), T_F32), ws_f(m, CB_CELL), T_F32)))) 21 ws_st(m, f, sir_let(m, "pos" as *u8, T_V3F, ws_bin(m, "+" as *u8, ws_id(m, "p" as *u8, T_V3F), ws_id(m, "wind" as *u8, T_V3F), T_V3F))) 22 ws_st(m, f, sir_let(m, "q" as *u8, T_V3F, ws_bin(m, "/" as *u8, ws_id(m, "pos" as *u8, T_V3F), ws_v3(m,ws_f(m, CC_BODY_XZ),ws_f(m, CC_BODY_Y),ws_f(m, CC_BODY_XZ)), T_V3F))) 23 ws_st(m, f, sir_let(m, "n0" as *u8, T_F32, ws_c1(m, "vn3" as *u8, ws_id(m, "q" as *u8, T_V3F), T_F32))) 24 ws_st(m, f, sir_let(m, "n1" as *u8, T_F32, ws_c1(m, "vn3" as *u8, ws_bin(m, "*" as *u8, ws_id(m, "q" as *u8, T_V3F), ws_f(m, CC_OCTAVE_LACUNARITY), T_V3F), T_F32))) 25 ws_st(m, f, sir_let(m, "n2" as *u8, T_F32, ws_c1(m, "vn3" as *u8, ws_bin(m, "*" as *u8, ws_id(m, "q" as *u8, T_V3F), ws_bin(m, "*" as *u8, ws_f(m, CC_OCTAVE_LACUNARITY), ws_f(m, CC_OCTAVE_LACUNARITY), T_F32), T_V3F), T_F32))) 26 ws_st(m, f, sir_let(m, "shape" as *u8, T_F32, ws_bin(m, "+" as *u8, ws_bin(m, "+" as *u8, ws_id(m, "n0" as *u8, T_F32), ws_bin(m, "*" as *u8, ws_bin(m, "-" as *u8, ws_id(m, "n1" as *u8, T_F32), ws_f(m, "0.5" as *u8), T_F32), ws_f(m, CC_OCTAVE_PERSISTENCE), T_F32), T_F32), ws_bin(m, "*" as *u8, ws_bin(m, "-" as *u8, ws_id(m, "n2" as *u8, T_F32), ws_f(m, "0.5" as *u8), T_F32), ws_bin(m, "*" as *u8, ws_f(m, CC_OCTAVE_PERSISTENCE), ws_f(m, CC_OCTAVE_PERSISTENCE), T_F32), T_F32), T_F32))) 27 ws_st(m, f, sir_let(m, "detail" as *u8, T_F32, ws_c1(m, "vn3" as *u8, ws_bin(m, "/" as *u8, ws_id(m, "pos" as *u8, T_V3F), ws_v3(m,ws_f(m, CC_DETAIL_XZ),ws_f(m, CC_DETAIL_Y),ws_f(m, CC_DETAIL_XZ)), T_V3F), T_F32))) 28 ws_st(m, f, sir_let(m, "env" as *u8, T_F32, ws_bin(m, "*" as *u8, ws_c3(m, "smoothstep" as *u8, ws_f(m, "0.0" as *u8), ws_bin(m, "/" as *u8, ws_f(m, CB_RLO), ws_bin(m, "-" as *u8, ws_f(m, CB_TOP), ws_f(m, CB_BASE), T_F32), T_F32), ws_id(m, "hf" as *u8, T_F32), T_F32), ws_bin(m, "-" as *u8, ws_f(m, "1.0" as *u8), ws_c3(m, "smoothstep" as *u8, ws_bin(m, "-" as *u8, ws_f(m, "1.0" as *u8), ws_bin(m, "/" as *u8, ws_f(m, CB_RHI), ws_bin(m, "-" as *u8, ws_f(m, CB_TOP), ws_f(m, CB_BASE), T_F32), T_F32), T_F32), ws_f(m, "1.0" as *u8), ws_id(m, "hf" as *u8, T_F32), T_F32), T_F32), T_F32))) 29 ws_st(m, f, sir_let(m, "thr" as *u8, T_F32, ws_bin(m, "-" as *u8, ws_f(m, CB_THR0), ws_bin(m, "*" as *u8, ws_f(m, CB_THRK), ws_c3(m, "clamp" as *u8, ws_id(m, "cld" as *u8, T_F32), ws_f(m, "0.0" as *u8), ws_f(m, "1.0" as *u8), T_F32), T_F32), T_F32))) 30 ws_st(m, f, sir_let(m, "body" as *u8, T_F32, ws_bin(m, "/" as *u8, ws_bin(m, "-" as *u8, ws_id(m, "shape" as *u8, T_F32), ws_id(m, "thr" as *u8, T_F32), T_F32), ws_bin(m, "-" as *u8, ws_f(m, "1.0" as *u8), ws_id(m, "thr" as *u8, T_F32), T_F32), T_F32))) 31 ws_st(m, f, sir_let(m, "eroded" as *u8, T_F32, ws_bin(m, "-" as *u8, ws_id(m, "body" as *u8, T_F32), ws_bin(m, "*" as *u8, ws_id(m, "detail" as *u8, T_F32), ws_f(m, CB_EROSION), T_F32), T_F32))) 32 ws_st(m, f, ws_ret(m, ws_bin(m, "*" as *u8, ws_c3(m, "clamp" as *u8, ws_bin(m, "*" as *u8, ws_id(m, "eroded" as *u8, T_F32), ws_f(m, CB_GAIN), T_F32), ws_f(m, "0.0" as *u8), ws_f(m, "1.0" as *u8), T_F32), ws_id(m, "env" as *u8, T_F32), T_F32))) 33 34 return f 35} 36 37func ws_fn_cloud_decode_t156(m: *i64) -> i64 { 38 let f: i64 = sir_func(m, "cloud_decode" as *u8, T_V3F) 39 sir_param(m, f, "display" as *u8, T_V3F) 40 ws_st(m, f, sir_let(m, "d" as *u8, T_V3F, ws_c3(m, "clamp" as *u8, ws_id(m, "display" as *u8, T_V3F), ws_v1(m, T_V3F, ws_f(m, "0.0" as *u8)), ws_v1(m, T_V3F, ws_f(m, "1.0" as *u8)), T_V3F))) 41 ws_st(m, f, sir_let(m, "y" as *u8, T_V3F, ws_bin(m, "*" as *u8, ws_id(m, "d" as *u8, T_V3F), ws_id(m, "d" as *u8, T_V3F), T_V3F))) 42 ws_st(m, f, sir_let(m, "a" as *u8, T_V3F, ws_bin(m, "-" as *u8, ws_v1(m, T_V3F, ws_f(m, "2.509765625" as *u8)), ws_bin(m, "*" as *u8, ws_f(m, "2.4296875" as *u8), ws_id(m, "y" as *u8, T_V3F), T_V3F), T_V3F))) 43 ws_st(m, f, sir_let(m, "b" as *u8, T_V3F, ws_bin(m, "-" as *u8, ws_v1(m, T_V3F, ws_f(m, "0.0302734375" as *u8)), ws_bin(m, "*" as *u8, ws_f(m, "0.58984375" as *u8), ws_id(m, "y" as *u8, T_V3F), T_V3F), T_V3F))) 44 ws_st(m, f, sir_let(m, "disc" as *u8, T_V3F, ws_bin(m, "+" as *u8, ws_bin(m, "*" as *u8, ws_id(m, "b" as *u8, T_V3F), ws_id(m, "b" as *u8, T_V3F), T_V3F), ws_bin(m, "*" as *u8, ws_bin(m, "*" as *u8, ws_f(m, "4.0" as *u8), ws_id(m, "a" as *u8, T_V3F), T_V3F), ws_bin(m, "*" as *u8, ws_f(m, "0.1396484375" as *u8), ws_id(m, "y" as *u8, T_V3F), T_V3F), T_V3F), T_V3F))) 45 ws_st(m, f, ws_ret(m, ws_bin(m, "/" as *u8, ws_bin(m, "+" as *u8, ws_bin(m, "-" as *u8, ws_v1(m, T_V3F, ws_f(m, "0.0" as *u8)), ws_id(m, "b" as *u8, T_V3F), T_V3F), ws_c1(m, "sqrt" as *u8, ws_id(m, "disc" as *u8, T_V3F), T_V3F), T_V3F), ws_bin(m, "*" as *u8, ws_f(m, "2.0" as *u8), ws_id(m, "a" as *u8, T_V3F), T_V3F), T_V3F))) 46 return f 47} 48func ws_fn_cloud_encode_t156(m: *i64) -> i64 { 49 let f: i64 = sir_func(m, "cloud_encode" as *u8, T_V3F) 50 sir_param(m, f, "radiance" as *u8, T_V3F) 51 ws_st(m, f, sir_let(m, "x" as *u8, T_V3F, ws_c2(m, "max" as *u8, ws_id(m, "radiance" as *u8, T_V3F), ws_v1(m, T_V3F, ws_f(m, "0.0" as *u8)), T_V3F))) 52 ws_st(m, f, sir_let(m, "num" as *u8, T_V3F, ws_bin(m, "*" as *u8, ws_id(m, "x" as *u8, T_V3F), ws_bin(m, "+" as *u8, ws_bin(m, "*" as *u8, ws_f(m, "2.509765625" as *u8), ws_id(m, "x" as *u8, T_V3F), T_V3F), ws_v1(m, T_V3F, ws_f(m, "0.0302734375" as *u8)), T_V3F), T_V3F))) 53 ws_st(m, f, sir_let(m, "den" as *u8, T_V3F, ws_bin(m, "+" as *u8, ws_bin(m, "*" as *u8, ws_id(m, "x" as *u8, T_V3F), ws_bin(m, "+" as *u8, ws_bin(m, "*" as *u8, ws_f(m, "2.4296875" as *u8), ws_id(m, "x" as *u8, T_V3F), T_V3F), ws_v1(m, T_V3F, ws_f(m, "0.58984375" as *u8)), T_V3F), T_V3F), ws_v1(m, T_V3F, ws_f(m, "0.1396484375" as *u8)), T_V3F))) 54 ws_st(m, f, ws_ret(m, ws_c1(m, "sqrt" as *u8, ws_c3(m, "clamp" as *u8, ws_bin(m, "/" as *u8, ws_id(m, "num" as *u8, T_V3F), ws_id(m, "den" as *u8, T_V3F), T_V3F), ws_v1(m, T_V3F, ws_f(m, "0.0" as *u8)), ws_v1(m, T_V3F, ws_f(m, "1.0" as *u8)), T_V3F), T_V3F))) 55 return f 56} 57func ws_fn_cloud_phase_t156(m: *i64) -> i64 { 58 let f: i64 = sir_func(m, "cloud_phase" as *u8, T_F32) 59 sir_param(m, f, "mu" as *u8, T_F32) 60 sir_param(m, f, "g" as *u8, T_F32) 61 ws_st(m, f, ws_ret(m, ws_bin(m, "/" as *u8, ws_bin(m, "-" as *u8, ws_f(m, "1.0" as *u8), ws_bin(m, "*" as *u8, ws_id(m, "g" as *u8, T_F32), ws_id(m, "g" as *u8, T_F32), T_F32), T_F32), ws_bin(m, "*" as *u8, ws_f(m, "12.566370614359172" as *u8), ws_c2(m, "pow" as *u8, ws_bin(m, "-" as *u8, ws_bin(m, "+" as *u8, ws_f(m, "1.0" as *u8), ws_bin(m, "*" as *u8, ws_id(m, "g" as *u8, T_F32), ws_id(m, "g" as *u8, T_F32), T_F32), T_F32), ws_bin(m, "*" as *u8, ws_bin(m, "*" as *u8, ws_f(m, "2.0" as *u8), ws_id(m, "g" as *u8, T_F32), T_F32), ws_c3(m, "clamp" as *u8, ws_id(m, "mu" as *u8, T_F32), ws_f(m, "-1.0" as *u8), ws_f(m, "1.0" as *u8), T_F32), T_F32), T_F32), ws_f(m, "1.5" as *u8), T_F32), T_F32), T_F32))) 62 return f 63} 64func ws_fn_cloud_incident_t156(m: *i64) -> i64 { 65 let f: i64 = sir_func(m, "cloud_incident" as *u8, T_V3F) 66 sir_param(m, f, "p" as *u8, T_V3F) 67 sir_param(m, f, "mu" as *u8, T_F32) 68 ws_st(m, f, sir_let(m, "skyL" as *u8, T_V3F, ws_bin(m, "*" as *u8, ws_bin(m, "+" as *u8, ws_c1(m, "cloud_decode" as *u8, ws_id(m, "skt" as *u8, T_V3F), T_V3F), ws_c1(m, "cloud_decode" as *u8, ws_id(m, "skh" as *u8, T_V3F), T_V3F), T_V3F), ws_f(m, "0.5" as *u8), T_V3F))) 69 ws_st(m, f, sir_let(m, "solarL" as *u8, T_V3F, ws_bin(m, "*" as *u8, ws_c1(m, "cloud_decode" as *u8, ws_v1(m, T_V3F, ws_f(m, "1.0" as *u8)), T_V3F), ws_v3f(m, "1.0" as *u8, "0.9604" as *u8, "0.7744" as *u8), T_V3F))) 70 ws_st(m, f, sir_let(m, "groundA" as *u8, T_V3F, ws_bin(m, "*" as *u8, ws_sw(m, sir_index(m, ws_id(m, "pal" as *u8, T_V4F), ws_i(m, "1" as *u8), T_V4F), "xyz" as *u8, T_V3F), ws_sw(m, sir_index(m, ws_id(m, "pal" as *u8, T_V4F), ws_i(m, "1" as *u8), T_V4F), "xyz" as *u8, T_V3F), T_V3F))) 71 ws_st(m, f, sir_let(m, "groundL" as *u8, T_V3F, ws_bin(m, "*" as *u8, ws_id(m, "groundA" as *u8, T_V3F), ws_bin(m, "+" as *u8, ws_id(m, "skyL" as *u8, T_V3F), ws_bin(m, "*" as *u8, ws_id(m, "solarL" as *u8, T_V3F), ws_bin(m, "*" as *u8, ws_bin(m, "*" as *u8, ws_f(m, CB_DIRECT), ws_id(m, "sun" as *u8, T_F32), T_F32), ws_c2(m, "max" as *u8, ws_sx(m, "sund" as *u8, T_V3F, "y" as *u8, T_F32), ws_f(m, "0.0" as *u8), T_F32), T_F32), T_V3F), T_V3F), T_V3F))) 72 ws_st(m, f, sir_let(m, "ambientL" as *u8, T_V3F, ws_bin(m, "*" as *u8, ws_bin(m, "+" as *u8, ws_id(m, "skyL" as *u8, T_V3F), ws_id(m, "groundL" as *u8, T_V3F), T_V3F), ws_bin(m, "*" as *u8, ws_f(m, "0.5" as *u8), ws_f(m, CB_AMBIENT), T_F32), T_V3F))) 73 ws_st(m, f, sir_let(m, "T" as *u8, T_F32, ws_c1(m, "csun" as *u8, ws_id(m, "p" as *u8, T_V3F), T_F32))) 74 ws_st(m, f, sir_let(m, "single" as *u8, T_F32, ws_bin(m, "*" as *u8, ws_id(m, "T" as *u8, T_F32), ws_c2(m, "cloud_phase" as *u8, ws_id(m, "mu" as *u8, T_F32), ws_f(m, CB_PHASE_G), T_F32), T_F32))) 75 ws_st(m, f, sir_let(m, "multiple" as *u8, T_F32, ws_bin(m, "*" as *u8, ws_bin(m, "*" as *u8, ws_f(m, "0.5" as *u8), ws_c1(m, "sqrt" as *u8, ws_id(m, "T" as *u8, T_F32), T_F32), T_F32), ws_c2(m, "cloud_phase" as *u8, ws_id(m, "mu" as *u8, T_F32), ws_bin(m, "*" as *u8, ws_f(m, "0.5" as *u8), ws_f(m, CB_PHASE_G), T_F32), T_F32), T_F32))) 76 ws_st(m, f, sir_let(m, "solarWeight" as *u8, T_F32, ws_bin(m, "*" as *u8, ws_bin(m, "*" as *u8, ws_bin(m, "*" as *u8, ws_f(m, "3.141592653589793" as *u8), ws_f(m, CB_DIRECT), T_F32), ws_id(m, "sun" as *u8, T_F32), T_F32), ws_bin(m, "+" as *u8, ws_id(m, "single" as *u8, T_F32), ws_id(m, "multiple" as *u8, T_F32), T_F32), T_F32))) 77 ws_st(m, f, ws_ret(m, ws_bin(m, "+" as *u8, ws_id(m, "ambientL" as *u8, T_V3F), ws_bin(m, "*" as *u8, ws_id(m, "solarL" as *u8, T_V3F), ws_id(m, "solarWeight" as *u8, T_F32), T_V3F), T_V3F))) 78 return f 79} 80 81func ws_fn_cld3_transport_t156(m: *i64) -> i64 { 82 let f: i64 = sir_func(m, "cld3" as *u8, T_V3F) 83 sir_param(m, f, "rd" as *u8, T_V3F) 84 sir_param(m, f, "s0" as *u8, T_V3F) 85 ws_st(m, f, ws_if(m, ws_cmp(m, "<=" as *u8, ws_id(m, "cld" as *u8, T_F32), ws_f(m, "0.0" as *u8)), ws_ret(m, ws_id(m, "s0" as *u8, T_V3F)), 0)) 86 ws_st(m, f, sir_let(m, "dy" as *u8, T_F32, ws_sx(m, "rd" as *u8, T_V3F, "y" as *u8, T_F32))) 87 ws_st(m, f, ws_if(m, ws_cmp(m, "==" as *u8, ws_id(m, "dy" as *u8, T_F32), ws_f(m, "0.0" as *u8)), ws_ret(m, ws_id(m, "s0" as *u8, T_V3F)), 0)) 88 ws_st(m, f, sir_let(m, "a" as *u8, T_F32, ws_bin(m, "/" as *u8, ws_bin(m, "-" as *u8, ws_f(m, CB_BASE), ws_sx(m, "cam" as *u8, T_V3F, "y" as *u8, T_F32), T_F32), ws_id(m, "dy" as *u8, T_F32), T_F32))) 89 ws_st(m, f, sir_let(m, "b" as *u8, T_F32, ws_bin(m, "/" as *u8, ws_bin(m, "-" as *u8, ws_f(m, CB_TOP), ws_sx(m, "cam" as *u8, T_V3F, "y" as *u8, T_F32), T_F32), ws_id(m, "dy" as *u8, T_F32), T_F32))) 90 ws_st(m, f, sir_let(m, "t0" as *u8, T_F32, ws_c2(m, "max" as *u8, ws_c2(m, "min" as *u8, ws_id(m, "a" as *u8, T_F32), ws_id(m, "b" as *u8, T_F32), T_F32), ws_f(m, "0.0" as *u8), T_F32))) 91 ws_st(m, f, sir_let(m, "t1" as *u8, T_F32, ws_c2(m, "min" as *u8, ws_c2(m, "max" as *u8, ws_id(m, "a" as *u8, T_F32), ws_id(m, "b" as *u8, T_F32), T_F32), ws_f(m, CB_VIEW_DISTANCE), T_F32))) 92 ws_st(m, f, ws_if(m, ws_cmp(m, "<=" as *u8, ws_id(m, "t1" as *u8, T_F32), ws_id(m, "t0" as *u8, T_F32)), ws_ret(m, ws_id(m, "s0" as *u8, T_V3F)), 0)) 93 ws_st(m, f, sir_let(m, "dt" as *u8, T_F32, ws_bin(m, "/" as *u8, ws_bin(m, "-" as *u8, ws_id(m, "t1" as *u8, T_F32), ws_id(m, "t0" as *u8, T_F32), T_F32), ws_f(m, CB_STEPS_F), T_F32))) 94 ws_st(m, f, sir_var(m, "tr" as *u8, T_F32, ws_f(m, "1.0" as *u8))) 95 ws_st(m, f, sir_var(m, "acc" as *u8, T_V3F, ws_v1(m, T_V3F, ws_f(m, "0.0" as *u8)))) 96 ws_st(m, f, sir_let(m, "mu" as *u8, T_F32, ws_c3(m, "clamp" as *u8, ws_c2(m, "dot" as *u8, ws_id(m, "rd" as *u8, T_V3F), ws_id(m, "sund" as *u8, T_V3F), T_F32), ws_f(m, "-1.0" as *u8), ws_f(m, "1.0" as *u8), T_F32))) 97 let p0: i64 = sir_let(m, "p" as *u8, T_V3F, ws_bin(m, "+" as *u8, ws_id(m, "cam" as *u8, T_V3F), ws_bin(m, "*" as *u8, ws_id(m, "rd" as *u8, T_V3F), ws_bin(m, "+" as *u8, ws_id(m, "t0" as *u8, T_F32), ws_bin(m, "*" as *u8, ws_bin(m, "+" as *u8, ws_fi(m, "i" as *u8), ws_f(m, "0.5" as *u8), T_F32), ws_id(m, "dt" as *u8, T_F32), T_F32), T_F32), T_V3F), T_V3F)) 98 let d0: i64 = sir_let(m, "density" as *u8, T_F32, ws_c1(m, "cvol" as *u8, ws_id(m, "p" as *u8, T_V3F), T_F32)) 99 let a0: i64 = sir_let(m, "alpha" as *u8, T_F32, ws_bin(m, "-" as *u8, ws_f(m, "1.0" as *u8), ws_c1(m, "exp" as *u8, ws_bin(m, "-" as *u8, ws_f(m, "0.0" as *u8), ws_bin(m, "*" as *u8, ws_bin(m, "*" as *u8, ws_id(m, "density" as *u8, T_F32), ws_id(m, "dt" as *u8, T_F32), T_F32), ws_f(m, CB_SIGMA), T_F32), T_F32), T_F32), T_F32)) 100 let l0: i64 = sir_let(m, "light" as *u8, T_V3F, ws_c2(m, "cloud_incident" as *u8, ws_id(m, "p" as *u8, T_V3F), ws_id(m, "mu" as *u8, T_F32), T_V3F)) 101 let c0: i64 = ws_op(m, "acc" as *u8, T_V3F, "+" as *u8, ws_bin(m, "*" as *u8, ws_id(m, "light" as *u8, T_V3F), ws_bin(m, "*" as *u8, ws_id(m, "tr" as *u8, T_F32), ws_id(m, "alpha" as *u8, T_F32), T_F32), T_V3F)) 102 let t0s: i64 = ws_op(m, "tr" as *u8, T_F32, "*" as *u8, ws_bin(m, "-" as *u8, ws_f(m, "1.0" as *u8), ws_id(m, "alpha" as *u8, T_F32), T_F32)) 103 let body: i64 = ws_q2(m, ws_q3(m, p0, d0, a0), ws_if(m, ws_cmp(m, ">" as *u8, ws_id(m, "density" as *u8, T_F32), ws_f(m, "0.0" as *u8)), ws_q3(m, l0, c0, t0s), 0)) 104 sir_for_until(m, f, sir_var(m, "i" as *u8, T_I32, ws_i(m, "0" as *u8)), ws_cmp(m, ">=" as *u8, ws_id(m, "i" as *u8, T_I32), ws_i(m, CB_STEPS)), ws_op(m, "i" as *u8, T_I32, "+" as *u8, ws_i(m, "1" as *u8)), body) 105 let fog: i64 = ws_c3(m, "smoothstep" as *u8, ws_f(m, "0.0" as *u8), ws_f(m, CB_VIEW_DISTANCE), ws_id(m, "t0" as *u8, T_F32), T_F32) 106 let clearL: i64 = ws_c1(m, "cloud_decode" as *u8, ws_id(m, "s0" as *u8, T_V3F), T_V3F) 107 let composite: i64 = ws_bin(m, "+" as *u8, ws_bin(m, "*" as *u8, clearL, ws_id(m, "tr" as *u8, T_F32), T_V3F), ws_id(m, "acc" as *u8, T_V3F), T_V3F) 108 let clearFogL: i64 = ws_c1(m, "cloud_decode" as *u8, ws_id(m, "s0" as *u8, T_V3F), T_V3F) 109 ws_st(m, f, ws_ret(m, ws_c1(m, "cloud_encode" as *u8, ws_c3(m, "mix" as *u8, composite, clearFogL, fog, T_V3F), T_V3F))) 110 return f 111} 112func shsrc_world_transport_t156(m: *i64) -> i64 { 113 ws_world_uniforms_raw(m) 114 ws_world_privates(m) 115 sir_texture(m, "tV" as *u8, T_TEX3U) 116 sir_texture(m, "tH" as *u8, T_TEX2F) // GE53: the surface field, one f32 height per column (r32float 128x128), uploaded from the sim's hq block 117 let hty: i64 = sir_struct_ty(ws_struct_hit(m)) 118 ws_fn_rgb9(m) 119 ws_fn_upk(m) 120 ws_fn_vx(m) 121 ws_fn_h21(m) 122 ws_fn_h31(m) 123 ws_fn_vn3(m) // PG22: the cloud volume's noise, density and march -- after h31, before sky which calls cld3 124 ws_fn_cvol_cumulus_t156(m) 125 ws_fn_csun(m) 126 ws_fn_cloud_decode_t156(m) 127 ws_fn_cloud_encode_t156(m) 128 ws_fn_cloud_phase_t156(m) 129 ws_fn_cloud_incident_t156(m) 130 ws_fn_cld3_transport_t156(m) 131 ws_fn_pal9(m) 132 ws_fn_sky(m) 133 ws_fn_hq(m) 134 ws_fn_surf(m) 135 ws_fn_terrain(m) 136 ws_fn_smarch(m) 137 ws_fn_gnd(m) 138 ws_fn_sand(m) // GR27: after surf, h21, vx and gnd (GLSL declares before use), before shade which calls it 139 ws_fn_march(m, hty) 140 ws_fn_scene_hit(m, hty) 141 ws_fn_shade(m, hty) 142 return ws_fn_fs(m, hty) 143}