Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht>2020-03-11 15:56:28 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-03-11 16:42:46 +0300
commitc8acb6dd6c58c6a85ab18d26f02973437cb2f700 (patch)
treec45a1b47d8692b7b633507d97f325fa5c2f5a3c8 /source/blender/gpu/shaders
parentf3a33a92987fd648f194898c3789f573fdadca6f (diff)
Smoke: put density/color in separate textures, fixes for workbench shader
This is more in line with standard grids and means we don't have to make many special exceptions in the upcoming change for arbitrary number of volume grids support in Eevee. The workbench shader was also changed to fix bugs where squared density was used, and the smoke color would affect the density so that black smoke would be invisible. This can change the look of smoke in workbench significantly. When using the color grid when smoke has a constant color, the color grid will no longer be premultiplied by the density. If the color is constant we want to be able not to store a grid at all. This breaks one test for Cycles and Eevee, but the setup in that test using a color without density does not make sense. It suffers from artifacts since the unpremultiplied color grid by itself will not have smooth boundaries. Differential Revision: https://developer.blender.org/D6951
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl
index 501aeb6f34e..0fecb5bd1f9 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl
@@ -5,9 +5,9 @@ void node_attribute_volume_density(sampler3D tex, out vec4 outcol, out vec3 outv
#else
vec3 cos = vec3(0.0);
#endif
- outvec = texture(tex, cos).aaa;
- outcol = vec4(outvec, 1.0);
- outf = avg(outvec);
+ outf = texture(tex, cos).r;
+ outvec = vec3(outf, outf, outf);
+ outcol = vec4(outf, outf, outf, 1.0);
}
uniform vec3 volumeColor = vec3(1.0);
@@ -59,6 +59,7 @@ void node_attribute_volume_temperature(
}
void node_volume_info(sampler3D densitySampler,
+ sampler3D colorSampler,
sampler3D flameSampler,
vec2 temperature,
out vec4 outColor,
@@ -72,14 +73,14 @@ void node_volume_info(sampler3D densitySampler,
vec3 p = vec3(0.0);
#endif
- vec4 density = texture(densitySampler, p);
- outDensity = density.a;
+ outDensity = texture(densitySampler, p).r;
- /* Density is premultiplied for interpolation, divide it out here. */
- if (density.a > 1e-8) {
- density.rgb /= density.a;
+ /* Color is premultiplied for interpolation, divide it out here. */
+ vec4 color = texture(colorSampler, p);
+ if (color.a > 1e-8) {
+ color.rgb /= color.a;
}
- outColor = vec4(density.rgb * volumeColor, 1.0);
+ outColor = vec4(color.rgb * volumeColor, 1.0);
float flame = texture(flameSampler, p).r;
outFlame = flame;