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 <brechtvanlommel@gmail.com>2020-03-17 18:27:08 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-03-18 13:23:05 +0300
commitfd53b72871e045dfebfb9ddbe2b3c491491aa913 (patch)
tree892721f97e6bff16c9d87bc3ffee295d2f4a77bc /source/blender/gpu/intern/gpu_node_graph.c
parentb0a1cf2c9ae696b07f7a236bc855a5ab4a493dcb (diff)
Objects: Eevee and workbench rendering of new Volume, Hair, PointCloud
Only the volume drawing part is really finished and exposed to the user. Hair plugs into the existing hair rendering code and is fairly straightforward. The pointcloud drawing is a hack using overlays rather than Eevee and workbench. The most tricky part for volume rendering is the case where each volume grid has a different transform, which requires an additional matrix in the shader and non-trivial logic in Eevee volume drawing. In the common case were all the transforms match we don't use the additional per-grid matrix in the shader. Ref T73201, T68981 Differential Revision: https://developer.blender.org/D6955
Diffstat (limited to 'source/blender/gpu/intern/gpu_node_graph.c')
-rw-r--r--source/blender/gpu/intern/gpu_node_graph.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c
index 0d5cc46c0b9..0eb62bf5b2f 100644
--- a/source/blender/gpu/intern/gpu_node_graph.c
+++ b/source/blender/gpu/intern/gpu_node_graph.c
@@ -123,6 +123,10 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType
input->source = GPU_SOURCE_VOLUME_GRID;
input->volume_grid = link->volume_grid;
break;
+ case GPU_NODE_LINK_VOLUME_GRID_TRANSFORM:
+ input->source = GPU_SOURCE_VOLUME_GRID_TRANSFORM;
+ input->volume_grid = link->volume_grid;
+ break;
case GPU_NODE_LINK_ATTR:
input->source = GPU_SOURCE_ATTR;
input->attr = link->attr;
@@ -342,6 +346,7 @@ static GPUMaterialVolumeGrid *gpu_node_graph_add_volume_grid(GPUNodeGraph *graph
grid = MEM_callocN(sizeof(*grid), __func__);
grid->name = BLI_strdup(name);
BLI_snprintf(grid->sampler_name, sizeof(grid->sampler_name), "vsamp%d", num_grids);
+ BLI_snprintf(grid->transform_name, sizeof(grid->transform_name), "vtfm%d", num_grids);
BLI_addtail(&graph->volume_grids, grid);
}
@@ -432,16 +437,20 @@ GPUNodeLink *GPU_volume_grid(GPUMaterial *mat, const char *name)
link->link_type = GPU_NODE_LINK_VOLUME_GRID;
link->volume_grid = gpu_node_graph_add_volume_grid(graph, name);
+ GPUNodeLink *transform_link = gpu_node_link_create();
+ transform_link->link_type = GPU_NODE_LINK_VOLUME_GRID_TRANSFORM;
+ transform_link->volume_grid = link->volume_grid;
+
/* Two special cases, where we adjust the output values of smoke grids to
* bring the into standard range without having to modify the grid values. */
if (strcmp(name, "color") == 0) {
- GPU_link(mat, "node_attribute_volume_color", link, &link);
+ GPU_link(mat, "node_attribute_volume_color", link, transform_link, &link);
}
else if (strcmp(name, "temperature") == 0) {
- GPU_link(mat, "node_attribute_volume_temperature", link, &link);
+ GPU_link(mat, "node_attribute_volume_temperature", link, transform_link, &link);
}
else {
- GPU_link(mat, "node_attribute_volume", link, &link);
+ GPU_link(mat, "node_attribute_volume", link, transform_link, &link);
}
return link;
@@ -590,7 +599,7 @@ static void gpu_inputs_free(ListBase *inputs)
else if (ELEM(input->source, GPU_SOURCE_TEX, GPU_SOURCE_TEX_TILED_MAPPING)) {
input->texture->users--;
}
- else if (ELEM(input->source, GPU_SOURCE_VOLUME_GRID)) {
+ else if (ELEM(input->source, GPU_SOURCE_VOLUME_GRID, GPU_SOURCE_VOLUME_GRID_TRANSFORM)) {
input->volume_grid->users--;
}