Blender V5.3
workbench_volume.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2018-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "draw_model.bsl.hh"
8#include "draw_view.bsl.hh"
9#include "draw_volume.bsl.hh"
14
16
18{
19 float3 tex_size = float3(textureSize(ima, 0).xyz);
20
21 co *= tex_size;
22 /* texel center */
23 float3 tc = floor(co - 0.5f) + 0.5f;
24 float3 f = co - tc;
25 float3 f2 = f * f;
26 float3 f3 = f2 * f;
27 /* Bspline coefficients (optimized). */
28 float3 w3 = f3 / 6.0f;
29 float3 w0 = -w3 + f2 * 0.5f - f * 0.5f + 1.0f / 6.0f;
30 float3 w1 = f3 * 0.5f - f2 + 2.0f / 3.0f;
31 float3 w2 = 1.0f - w0 - w1 - w3;
32
33 float3 s0 = w0 + w1;
34 float3 s1 = w2 + w3;
35
36 float3 f0 = w1 / (w0 + w1);
37 float3 f1 = w3 / (w2 + w3);
38
39 float2 final_z;
40 float4 final_co;
41 final_co.xy = tc.xy - 1.0f + f0.xy;
42 final_co.zw = tc.xy + 1.0f + f1.xy;
43 final_z = tc.zz + float2(-1.0f, 1.0f) + float2(f0.z, f1.z);
44
45 final_co /= tex_size.xyxy;
46 final_z /= tex_size.zz;
47
49 color = texture(ima, float3(final_co.xy, final_z.x)) * s0.x * s0.y * s0.z;
50 color += texture(ima, float3(final_co.zy, final_z.x)) * s1.x * s0.y * s0.z;
51 color += texture(ima, float3(final_co.xw, final_z.x)) * s0.x * s1.y * s0.z;
52 color += texture(ima, float3(final_co.zw, final_z.x)) * s1.x * s1.y * s0.z;
53
54 color += texture(ima, float3(final_co.xy, final_z.y)) * s0.x * s0.y * s1.z;
55 color += texture(ima, float3(final_co.zy, final_z.y)) * s1.x * s0.y * s1.z;
56 color += texture(ima, float3(final_co.xw, final_z.y)) * s0.x * s1.y * s1.z;
57 color += texture(ima, float3(final_co.zw, final_z.y)) * s1.x * s1.y * s1.z;
58
59 return color;
60}
61
62/* Nearest-neighbor interpolation */
64{
65 /* Unnormalize coordinates */
66 int3 cell_co = int3(co * float3(textureSize(ima, 0).xyz));
67
68 return texelFetch(ima, cell_co, 0);
69}
70
71/* Legacy Fluid Simulation Modifier. */
78
79/* Volume Objects. */
84
85struct ColorBand {
88
89 [[push_constant]] const bool show_phi;
90 [[push_constant]] const bool show_flags;
92 [[push_constant]] const float grid_scale;
93};
94
103
110
111struct Resources {
113
117
119 [[push_constant]] const float noise_ofs;
120 [[push_constant]] const float step_length;
121 [[push_constant]] const float density_fac;
123
124 [[push_constant, condition(use_slice)]] const int slice_axis; /* -1 is no slice. */
125 [[push_constant, condition(use_slice)]] const float slice_position;
126
127 [[resource_table, condition(!is_legacy_smoke)]] Volume volume;
128 [[resource_table, condition(is_legacy_smoke)]] Smoke smoke;
129
132
134 {
135 if (consts.interpolation == 0) [[static_branch]] {
136 return sample_closest(ima, co);
137 }
138 if (consts.interpolation == 2) [[static_branch]] {
139 return sample_tricubic(ima, co);
140 }
141 /* Use hardware interpolation. */
142 return texture(ima, co);
143 }
144};
145
147{
148 return 1.0f / (4.0f * M_PI);
149}
150
151float line_unit_box_intersect_dist(float3 lineorigin, float3 linedirection)
152{
153 /* https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
154 */
155 float3 firstplane = (float3(1.0f) - lineorigin) * safe_rcp(linedirection);
156 float3 secondplane = (float3(-1.0f) - lineorigin) * safe_rcp(linedirection);
157 float3 furthestplane = min(firstplane, secondplane);
158 return reduce_max(furthestplane);
159}
160
162{
163 /* Color mapping for flags */
164 float4 color = float4(0.0f, 0.0f, 0.0f, 0.06f);
165 /* Cell types: 1 is Fluid, 2 is Obstacle, 4 is Empty, 8 is Inflow, 16 is Outflow */
166 if (bool(flag & uint(1))) {
167 color.rgb += float3(0.0f, 0.0f, 0.75f); /* blue */
168 }
169 if (bool(flag & uint(2))) {
170 color.rgb += float3(0.2f, 0.2f, 0.2f); /* dark gray */
171 }
172 if (bool(flag & uint(4))) {
173 color.rgb += float3(0.25f, 0.0f, 0.2f); /* dark purple */
174 }
175 if (bool(flag & uint(8))) {
176 color.rgb += float3(0.0f, 0.5f, 0.0f); /* dark green */
177 }
178 if (bool(flag & uint(16))) {
179 color.rgb += float3(0.9f, 0.3f, 0.0f); /* orange */
180 }
181 if (is_zero(color.rgb)) {
182 color.rgb += float3(0.5f, 0.0f, 0.0f); /* medium red */
183 }
184 return color;
185}
186
188 float3 ls_pos,
189 float3 &scattering,
190 float &extinction)
191{
192 float3 co = ls_pos * 0.5f + 0.5f;
193
194 if (srt.consts.use_color_band) [[static_branch]] {
195 [[resource_table]] ColorBand &color_band = srt.color_band;
196 float4 tval;
197 if (color_band.show_phi) {
198 /* Color mapping for level-set representation */
199 float val = srt.sample_volume_texture(srt.density_tx, co).r * color_band.grid_scale;
200
201 val = max(min(val * 0.2f, 1.0f), -1.0f);
202
203 if (val >= 0.0f) {
204 tval = float4(val, 0.0f, 0.5f, 0.06f);
205 }
206 else {
207 tval = float4(0.5f, 1.0f + val, 0.0f, 0.06f);
208 }
209 }
210 else if (color_band.show_flags) {
211 /* Color mapping for flags */
212 uint flag = texture(color_band.flag_tx, co).r;
213 tval = flag_to_color(flag);
214 }
215 else if (color_band.show_pressure) {
216 /* Color mapping for pressure */
217 float val = srt.sample_volume_texture(srt.density_tx, co).r * color_band.grid_scale;
218
219 if (val > 0) {
220 tval = float4(val, val, val, 0.06f);
221 }
222 else {
223 tval = float4(-val, 0.0f, 0.0f, 0.06f);
224 }
225 }
226 else {
227 float val = srt.sample_volume_texture(srt.density_tx, co).r * color_band.grid_scale;
228 tval = texture(color_band.transfer_tx, val);
229 }
230 tval *= srt.density_fac;
231 tval.rgb = pow(tval.rgb, float3(2.2f));
232 scattering = tval.rgb * 1500.0f;
233 extinction = max(1e-4f, tval.a * 50.0f);
234 }
235 else {
236 [[resource_table]] ColorUniform &uniform = srt.color_uniform;
237 float3 density = srt.sample_volume_texture(srt.density_tx, co).rgb;
238 float shadows = srt.sample_volume_texture(uniform.shadow_tx, co).r;
239
240 scattering = density * srt.density_fac;
241 extinction = max(1e-4f, dot(scattering, float3(0.33333f)));
242 scattering *= uniform.active_color;
243
244 /* Scale shadows in log space and clamp them to avoid completely black shadows. */
245 scattering *= exp(clamp(log(shadows) * srt.density_fac * 0.1f, -2.5f, 0.0f)) * M_PI;
246
247 if (srt.consts.is_legacy_smoke) [[static_branch]] {
248 [[resource_table]] Smoke &smoke = srt.smoke;
249 float flame = srt.sample_volume_texture(smoke.flame_tx, co).r;
250 float4 emission = texture(smoke.flame_color_tx, flame);
251 /* 800 is arbitrary and here to mimic old viewport. TODO: make it a parameter. */
252 scattering += emission.rgb * emission.a * 800.0f;
253 }
254 }
255}
256
257void eval_volume_step(float3 &Lscat, float extinction, float step_len, float &Tr)
258{
259 Lscat *= phase_function_isotropic();
260 /* Evaluate Scattering */
261 Tr = exp(-extinction * step_len);
262 /* integrate along the current step segment */
263 Lscat = (Lscat - Lscat * Tr) / extinction;
264}
265
268 float3 ray_ori,
269 float3 ray_dir,
270 float ray_inc,
271 float ray_max,
272 float step_len)
273{
274 /* NOTE: Constant array declared inside function scope to reduce shader core thread memory
275 * pressure on Apple Silicon. */
276 const float4 dither_mat[4] = {(float4(0.0f, 8.0f, 2.0f, 10.0f) + 0.5f) / 16.0f,
277 (float4(12.0f, 4.0f, 14.0f, 6.0f) + 0.5f) / 16.0f,
278 (float4(3.0f, 11.0f, 1.0f, 9.0f) + 0.5f) / 16.0f,
279 (float4(15.0f, 7.0f, 13.0f, 5.0f) + 0.5f) / 16.0f};
280 /* Start with full transmittance and no scattered light. */
281 float3 final_scattering = float3(0.0f);
282 float final_transmittance = 1.0f;
283
284 int2 tx = int2(frag_coord.xy) % 4;
285 float noise = fract(dither_mat[tx.x][tx.y] + srt.noise_ofs);
286
287 float ray_len = noise * ray_inc;
288 for (int i = 0; i < srt.samples_len && ray_len < ray_max; i++, ray_len += ray_inc) {
289 float3 ls_pos = ray_ori + ray_dir * ray_len;
290
291 float3 Lscat;
292 float s_extinction, Tr;
293 volume_properties(srt, ls_pos, Lscat, s_extinction);
294 eval_volume_step(Lscat, s_extinction, step_len, Tr);
295 /* accumulate and also take into account the transmittance from previous steps */
296 final_scattering += final_transmittance * Lscat;
297 final_transmittance *= Tr;
298
299 if (final_transmittance <= 0.01f) {
300 /* Early out */
301 final_transmittance = 0.0f;
302 break;
303 }
304 }
305
306 return float4(final_scattering, final_transmittance);
307}
308
309struct VertIn {
311};
312
314 [[flat]] uint id;
315};
316
317struct VertOut {
319};
320
323 [[resource_table]] draw::View &views,
324 [[resource_table]] draw::Model &models,
325 [[resource_table, condition(is_legacy_smoke)]] draw::Infos &infos,
326 [[instance_index]] const int inst_index,
327 [[in]] const VertIn &v_in,
328 [[out]] ResourceIDOut &res_id_out,
329 [[out, condition(use_slice)]] VertOut &v_out,
330 [[position]] float4 &out_position)
331{
332 res_id_out.id = ids.get(inst_index).resource_id<1>();
333
334 ObjectMatrices model = models.get(res_id_out.id);
335 ViewMatrices view = views.get(0);
336
337 float3 final_pos;
338
339 if (srt.consts.use_slice) [[static_branch]] {
340 if (srt.slice_axis == 0) {
341 v_out.local_pos = float3(srt.slice_position * 2.0f - 1.0f, v_in.pos.xy);
342 }
343 else if (srt.slice_axis == 1) {
344 v_out.local_pos = float3(v_in.pos.x, srt.slice_position * 2.0f - 1.0f, v_in.pos.y);
345 }
346 else {
347 v_out.local_pos = float3(v_in.pos.xy, srt.slice_position * 2.0f - 1.0f);
348 }
349 final_pos = v_out.local_pos;
350 }
351 else {
352 final_pos = v_in.pos;
353 }
354
355 if (srt.consts.is_legacy_smoke) [[static_branch]] {
356 ObjectInfos info = infos.get(res_id_out.id);
357 final_pos = ((final_pos * 0.5f + 0.5f) - info.orco_add) / info.orco_mul;
358 }
359 else {
360 [[resource_table]] Volume &volume = srt.volume;
361 final_pos = (volume.volume_texture_to_object * float4(final_pos * 0.5f + 0.5f, 1.0f)).xyz;
362 }
363 out_position = view.point_world_to_homogenous(model.point_object_to_world(final_pos));
364}
365
366struct FragOut {
368};
369
371 [[resource_table]] Resources &srt,
372 [[resource_table]] draw::View &views,
373 [[resource_table]] draw::Model &models,
374 [[resource_table]] [[condition(is_legacy_smoke)]] draw::Infos &infos,
375 [[frag_coord]] const float4 &frag_coord,
376 [[in]] const ResourceIDOut &res_id,
377 [[in, condition(use_slice)]] const VertOut &v_out,
378 [[out]] FragOut &frag_out)
379{
380 uint stencil = texelFetch(srt.stencil_tx, int2(frag_coord.xy), 0).r;
381
382 constexpr uint in_front_stencil_bits = 1u << 1;
383 if (srt.do_depth_test && (stencil & in_front_stencil_bits) != 0) {
384 /* Don't draw on top of "in front" objects. */
386 return;
387 }
388
389 ObjectMatrices model = models.get(res_id.id);
390 ViewMatrices view = views.get(0);
391
392 if (srt.consts.use_slice) [[static_branch]] {
393 /* Manual depth test. TODO: remove. */
394 float depth = texelFetch(srt.depth_buffer, int2(frag_coord.xy), 0).r;
395 if (srt.do_depth_test && frag_coord.z >= depth) {
396 /* NOTE: In the Metal API, prior to Metal 2.3, Discard is not an explicit return and can
397 * produce undefined behavior. This is especially prominent with derivatives if control-flow
398 * divergence is present.
399 *
400 * Adding a return call eliminates undefined behavior and a later out-of-bounds read causing
401 * a crash on AMD platforms.
402 * This behavior can also affect OpenGL on certain devices. */
404 return;
405 }
406
407 float3 Lscat;
408 float s_extinction, Tr;
409 volume_properties(srt, v_out.local_pos, Lscat, s_extinction);
410 eval_volume_step(Lscat, s_extinction, srt.step_length, Tr);
411
412 frag_out.color = float4(Lscat, Tr);
413 }
414 else {
415 float2 screen_uv = frag_coord.xy / float2(textureSize(srt.depth_buffer, 0).xy);
416 bool is_persp = view.winmat[3][3] == 0.0f;
417
418 float depth = srt.do_depth_test ? texelFetch(srt.depth_buffer, int2(frag_coord.xy), 0).r :
419 1.0f;
420 float depth_end = min(depth, frag_coord.z);
421 float3 vs_ray_end = view.point_screen_to_view(float3(screen_uv, depth_end));
422 float3 vs_ray_ori = view.point_screen_to_view(float3(screen_uv, 0.0f));
423 float3 vs_ray_dir = (is_persp) ? (vs_ray_end - vs_ray_ori) : float3(0.0f, 0.0f, -1.0f);
424 vs_ray_dir /= abs(vs_ray_dir.z);
425
426 float3 ls_ray_dir = model.point_view_to_object(view, vs_ray_ori + vs_ray_dir);
427 float3 ls_ray_ori = model.point_view_to_object(view, vs_ray_ori);
428 float3 ls_ray_end = model.point_view_to_object(view, vs_ray_end);
429
430 if (srt.consts.is_legacy_smoke) [[static_branch]] {
431 ObjectInfos ob_infos = infos.get(res_id.id);
432 ls_ray_dir = (ob_infos.orco_mul * ls_ray_dir + ob_infos.orco_add) * 2.0f - 1.0f;
433 ls_ray_ori = (ob_infos.orco_mul * ls_ray_ori + ob_infos.orco_add) * 2.0f - 1.0f;
434 ls_ray_end = (ob_infos.orco_mul * ls_ray_end + ob_infos.orco_add) * 2.0f - 1.0f;
435 }
436 else {
437 [[resource_table]] Volume &volume = srt.volume;
438 ls_ray_dir = (volume.volume_object_to_texture * float4(ls_ray_dir, 1.0f)).xyz * 2.0f - 1.0f;
439 ls_ray_ori = (volume.volume_object_to_texture * float4(ls_ray_ori, 1.0f)).xyz * 2.0f - 1.0f;
440 ls_ray_end = (volume.volume_object_to_texture * float4(ls_ray_end, 1.0f)).xyz * 2.0f - 1.0f;
441 }
442
443 ls_ray_dir -= ls_ray_ori;
444
445 /* TODO: Align rays to volume center so that it mimics old behavior of slicing the volume. */
446
447 float dist = line_unit_box_intersect_dist(ls_ray_ori, ls_ray_dir);
448 if (dist > 0.0f) {
449 ls_ray_ori = ls_ray_dir * dist + ls_ray_ori;
450 }
451
452 float3 ls_vol_isect = ls_ray_end - ls_ray_ori;
453 if (dot(ls_ray_dir, ls_vol_isect) < 0.0f) {
454 /* Start is further away than the end.
455 * That means no volume is intersected. */
457 return;
458 }
459
460 frag_out.color = volume_integration(srt,
462 ls_ray_ori,
463 ls_ray_dir,
464 srt.step_length,
465 length(ls_vol_isect) / length(ls_ray_dir),
466 length(vs_ray_dir) * srt.step_length);
467 }
468
469 /* Convert transmittance to alpha so we can use pre-multiply blending. */
470 frag_out.color.a = 1.0f - frag_out.color.a;
471}
472
473/* clang-format off */
474PipelineGraphic smoke_closest_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = true, .is_legacy_smoke = true, .interpolation = 0});
475PipelineGraphic smoke_closest_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = true, .is_legacy_smoke = true, .interpolation = 0});
476PipelineGraphic smoke_linear_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = true, .is_legacy_smoke = true, .interpolation = 1});
477PipelineGraphic smoke_linear_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = true, .is_legacy_smoke = true, .interpolation = 1});
478PipelineGraphic smoke_cubic_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = true, .is_legacy_smoke = true, .interpolation = 2});
479PipelineGraphic smoke_cubic_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = true, .is_legacy_smoke = true, .interpolation = 2});
480PipelineGraphic smoke_closest_no_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = false, .is_legacy_smoke = true, .interpolation = 0});
481PipelineGraphic smoke_closest_no_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = false, .is_legacy_smoke = true, .interpolation = 0});
482PipelineGraphic smoke_linear_no_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = false, .is_legacy_smoke = true, .interpolation = 1});
483PipelineGraphic smoke_linear_no_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = false, .is_legacy_smoke = true, .interpolation = 1});
484PipelineGraphic smoke_cubic_no_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = false, .is_legacy_smoke = true, .interpolation = 2});
485PipelineGraphic smoke_cubic_no_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = false, .is_legacy_smoke = true, .interpolation = 2});
486PipelineGraphic object_closest_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = true, .is_legacy_smoke = false, .interpolation = 0});
487PipelineGraphic object_closest_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = true, .is_legacy_smoke = false, .interpolation = 0});
488PipelineGraphic object_linear_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = true, .is_legacy_smoke = false, .interpolation = 1});
489PipelineGraphic object_linear_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = true, .is_legacy_smoke = false, .interpolation = 1});
490PipelineGraphic object_cubic_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = true, .is_legacy_smoke = false, .interpolation = 2});
491PipelineGraphic object_cubic_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = true, .is_legacy_smoke = false, .interpolation = 2});
492PipelineGraphic object_closest_no_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = false, .is_legacy_smoke = false, .interpolation = 0});
493PipelineGraphic object_closest_no_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = false, .is_legacy_smoke = false, .interpolation = 0});
494PipelineGraphic object_linear_no_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = false, .is_legacy_smoke = false, .interpolation = 1});
495PipelineGraphic object_linear_no_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = false, .is_legacy_smoke = false, .interpolation = 1});
496PipelineGraphic object_cubic_no_coba_slice( vertex_function, fragment_function, Constants{.use_slice = true, .use_color_band = false, .is_legacy_smoke = false, .interpolation = 2});
497PipelineGraphic object_cubic_no_coba_no_slice( vertex_function, fragment_function, Constants{.use_slice = false, .use_color_band = false, .is_legacy_smoke = false, .interpolation = 2});
498/* clang-format on */
499
500} // namespace workbench::volume
#define M_PI
btScalar max
#define uniform(slot)
#define instance_index
#define position
#define flat
#define frag_coord
#define smooth
#define push_constant
#define compilation_constant
#define resource_table
#define sampler(slot)
#define attribute(slot)
#define static_branch
#define fragment
#define condition(cond)
#define vertex
#define frag_color(slot)
void gpu_discard_fragment()
#define log
T fract(T) RET
#define pow
#define exp
float dot(VecOp< float, D >, VecOp< float, D >) RET
#define abs
#define floor
constexpr T clamp(T, U, U) RET
float length(VecOp< float, D >) RET
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) RET
SamplerBase< float, 1 > sampler1D
SamplerBase< float, 3 > sampler3D
SamplerBase< float, 2, false, false, false, true > sampler2DDepth
SamplerBase< uint, 3 > usampler3D
TEX_TEMPLATE SizeVec textureSize(T, int) RET
SamplerBase< uint, 2 > usampler2D
float noise(float p)
bool is_zero(float3x3 a)
float safe_rcp(float a)
float reduce_max(float2 a)
MatBase< float, 4, 4 > float4x4
float4 sample_closest(sampler3D ima, float3 co)
PipelineGraphic object_cubic_no_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=false,.is_legacy_smoke=false,.interpolation=2})
PipelineGraphic object_closest_no_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=false,.is_legacy_smoke=false,.interpolation=0})
PipelineGraphic object_cubic_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=true,.is_legacy_smoke=false,.interpolation=2})
PipelineGraphic smoke_linear_no_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=false,.is_legacy_smoke=true,.interpolation=1})
PipelineGraphic object_closest_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=true,.is_legacy_smoke=false,.interpolation=0})
PipelineGraphic object_closest_no_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=false,.is_legacy_smoke=false,.interpolation=0})
void volume_properties(Resources &srt, float3 ls_pos, float3 &scattering, float &extinction)
PipelineGraphic smoke_cubic_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=true,.is_legacy_smoke=true,.interpolation=2})
PipelineGraphic smoke_linear_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=true,.is_legacy_smoke=true,.interpolation=1})
float line_unit_box_intersect_dist(float3 lineorigin, float3 linedirection)
PipelineGraphic object_linear_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=true,.is_legacy_smoke=false,.interpolation=1})
PipelineGraphic object_cubic_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=true,.is_legacy_smoke=false,.interpolation=2})
PipelineGraphic object_closest_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=true,.is_legacy_smoke=false,.interpolation=0})
PipelineGraphic smoke_cubic_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=true,.is_legacy_smoke=true,.interpolation=2})
void fragment_function(Resources &srt, draw::View &views, draw::Model &models, draw::Infos &infos, const float4 &frag_coord, const ResourceIDOut &res_id, const VertOut &v_out, FragOut &frag_out)
PipelineGraphic smoke_linear_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=true,.is_legacy_smoke=true,.interpolation=1})
float4 volume_integration(Resources &srt, float4 frag_coord, float3 ray_ori, float3 ray_dir, float ray_inc, float ray_max, float step_len)
float4 sample_tricubic(sampler3D ima, float3 co)
void eval_volume_step(float3 &Lscat, float extinction, float step_len, float &Tr)
PipelineGraphic smoke_closest_no_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=false,.is_legacy_smoke=true,.interpolation=0})
PipelineGraphic object_linear_no_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=false,.is_legacy_smoke=false,.interpolation=1})
PipelineGraphic smoke_closest_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=true,.is_legacy_smoke=true,.interpolation=0})
PipelineGraphic smoke_cubic_no_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=false,.is_legacy_smoke=true,.interpolation=2})
PipelineGraphic object_linear_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=true,.is_legacy_smoke=false,.interpolation=1})
PipelineGraphic smoke_cubic_no_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=false,.is_legacy_smoke=true,.interpolation=2})
void vertex_function(Resources &srt, draw::Resource &ids, draw::View &views, draw::Model &models, draw::Infos &infos, const int inst_index, const VertIn &v_in, ResourceIDOut &res_id_out, VertOut &v_out, float4 &out_position)
PipelineGraphic smoke_closest_no_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=false,.is_legacy_smoke=true,.interpolation=0})
PipelineGraphic object_cubic_no_coba_no_slice(vertex_function, fragment_function, Constants{.use_slice=false,.use_color_band=false,.is_legacy_smoke=false,.interpolation=2})
PipelineGraphic object_linear_no_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=false,.is_legacy_smoke=false,.interpolation=1})
float4 flag_to_color(uint flag)
PipelineGraphic smoke_closest_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=true,.is_legacy_smoke=true,.interpolation=0})
PipelineGraphic smoke_linear_no_coba_slice(vertex_function, fragment_function, Constants{.use_slice=true,.use_color_band=false,.is_legacy_smoke=true,.interpolation=1})
#define min(a, b)
Definition sort.cc:38
packed_float3 orco_add
packed_float3 orco_mul
float3 point_view_to_object(ViewMatrices view, float3 vP) const
float3 point_object_to_world(float3 lP) const
float4 point_world_to_homogenous(float3 P) const
float3 point_screen_to_view(float3 ssP) const
float x
float y
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136
float4 sample_volume_texture(sampler3D ima, float3 co)