From f0c376a52a53db98bd8d8db3c79116f71001fb5c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 3 Sep 2020 15:26:52 +0200 Subject: Fix T80332: principle volume shader not working for world in Eevee The handling of missing volume grids for the principled volume shader was incomplete, different inputs need different default values. --- source/blender/nodes/shader/nodes/node_shader_attribute.c | 6 +++--- source/blender/nodes/shader/nodes/node_shader_volume_info.c | 8 ++++---- source/blender/nodes/shader/nodes/node_shader_volume_principled.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c index 116bc181997..4fd0ce4f1ef 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.c +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c @@ -44,13 +44,13 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, if (GPU_material_is_volume_shader(mat)) { if (out[0].hasoutput) { - out[0].link = GPU_volume_grid(mat, attr->name); + out[0].link = GPU_volume_grid(mat, attr->name, GPU_VOLUME_DEFAULT_0); } if (out[1].hasoutput) { - out[1].link = GPU_volume_grid(mat, attr->name); + out[1].link = GPU_volume_grid(mat, attr->name, GPU_VOLUME_DEFAULT_0); } if (out[2].hasoutput) { - out[2].link = GPU_volume_grid(mat, attr->name); + out[2].link = GPU_volume_grid(mat, attr->name, GPU_VOLUME_DEFAULT_0); } return 1; diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_info.c b/source/blender/nodes/shader/nodes/node_shader_volume_info.c index 7ccc00f1af3..6cafc991e13 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_info.c @@ -34,16 +34,16 @@ static int node_shader_gpu_volume_info(GPUMaterial *mat, GPUNodeStack *out) { if (out[0].hasoutput) { - out[0].link = GPU_volume_grid(mat, "color"); + out[0].link = GPU_volume_grid(mat, "color", GPU_VOLUME_DEFAULT_0); } if (out[1].hasoutput) { - out[1].link = GPU_volume_grid(mat, "density"); + out[1].link = GPU_volume_grid(mat, "density", GPU_VOLUME_DEFAULT_0); } if (out[2].hasoutput) { - out[2].link = GPU_volume_grid(mat, "flame"); + out[2].link = GPU_volume_grid(mat, "flame", GPU_VOLUME_DEFAULT_0); } if (out[3].hasoutput) { - out[3].link = GPU_volume_grid(mat, "temperature"); + out[3].link = GPU_volume_grid(mat, "temperature", GPU_VOLUME_DEFAULT_0); } return true; diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c index b581a4bd3a6..1a25aec5cb8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c @@ -78,13 +78,13 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat, } if (STREQ(sock->name, "Density Attribute")) { - density = GPU_volume_grid(mat, attribute_name); + density = GPU_volume_grid(mat, attribute_name, GPU_VOLUME_DEFAULT_1); } else if (STREQ(sock->name, "Color Attribute")) { - color = GPU_volume_grid(mat, attribute_name); + color = GPU_volume_grid(mat, attribute_name, GPU_VOLUME_DEFAULT_1); } else if (use_blackbody && STREQ(sock->name, "Temperature Attribute")) { - temperature = GPU_volume_grid(mat, attribute_name); + temperature = GPU_volume_grid(mat, attribute_name, GPU_VOLUME_DEFAULT_0); } } -- cgit v1.2.3