[Bf-blender-cvs] [3e158b0a46b] greasepencil-object: Remove VFX Modifiers + Defunct "DOF" Code

Joshua Leung noreply at git.blender.org
Tue May 8 16:28:42 CEST 2018


Commit: 3e158b0a46bf74bd3453ddfbf65957c41cfcf428
Author: Joshua Leung
Date:   Tue May 8 16:13:22 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3e158b0a46bf74bd3453ddfbf65957c41cfcf428

Remove VFX Modifiers + Defunct "DOF" Code

* As per code reviews (see T54721 and T54769), it was decided that the "VFX Modifiers"
  should not be in the modifiers stack, as they are not really modifiers. Instead, they
  are more like placeholders for shader effects on the object. For now, we simply remove
  these from the code, with a view towards designing a more general solution for all
  object types in 2.8 in future (e.g. as a "Viewport Effects" tab or similar in the Properties
  Editor)

* Also removed the "DOF" code. This was trying to copy what was done for Eevee, but the
  results were low quality, and the relevant code paths were already commented out.
  This code is also removed in this commit, as it depended a lot on many of the things
  put in place for the VFX modifiers, making removal of the VFX buffers complicated.
  Since it's not used now, it's not a big loss. Besides, with version control, we can
  bring this back in future.

NOTE: Blender still doesn't compile - there are still too many extra buffers hanging around
that need to be removed

===================================================================

M	source/blender/blenkernel/BKE_modifier.h
M	source/blender/draw/CMakeLists.txt
M	source/blender/draw/engines/gpencil/gpencil_cache_utils.c
D	source/blender/draw/engines/gpencil/gpencil_depth_of_field.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
D	source/blender/draw/engines/gpencil/gpencil_vfx.c
D	source/blender/draw/engines/gpencil/shaders/gpencil_dof_frag.glsl
D	source/blender/draw/engines/gpencil/shaders/gpencil_dof_vert.glsl
D	source/blender/draw/engines/gpencil/shaders/gpencil_flip_frag.glsl
D	source/blender/draw/engines/gpencil/shaders/gpencil_gaussian_blur_frag.glsl
D	source/blender/draw/engines/gpencil/shaders/gpencil_light_frag.glsl
D	source/blender/draw/engines/gpencil/shaders/gpencil_pixel_frag.glsl
D	source/blender/draw/engines/gpencil/shaders/gpencil_swirl_frag.glsl
D	source/blender/draw/engines/gpencil/shaders/gpencil_wave_frag.glsl
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/MOD_modifiertypes.h
D	source/blender/modifiers/intern/MOD_gpencilblur.c
D	source/blender/modifiers/intern/MOD_gpencilflip.c
D	source/blender/modifiers/intern/MOD_gpencillight.c
D	source/blender/modifiers/intern/MOD_gpencilpixel.c
D	source/blender/modifiers/intern/MOD_gpencilswirl.c
D	source/blender/modifiers/intern/MOD_gpencilwave.c
M	source/blender/modifiers/intern/MOD_util.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 39e67b128c3..a34abae1f1c 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -112,8 +112,6 @@ typedef enum {
 	eModifierTypeFlag_AcceptsLattice = (1 << 10),
 	/* Grease pencil modifiers (do not change mesh, only is placeholder) */
 	eModifierTypeFlag_GpencilMod = (1 << 11),
-	/* Grease pencil VFX modifiers cannot be applied */
-	eModifierTypeFlag_GpencilVFX = (1 << 12),
 } ModifierTypeFlag;
 
 /* IMPORTANT! Keep ObjectWalkFunc and IDWalkFunc signatures compatible. */
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 40e348f9634..e82b82fe6a0 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -115,7 +115,6 @@ set(SRC
 	engines/gpencil/gpencil_cache_utils.c
 	engines/gpencil/gpencil_draw_cache_impl.c
 	engines/gpencil/gpencil_geom.c
-	engines/gpencil/gpencil_vfx.c
 	engines/gpencil/gpencil_depth_of_field.c
 
 	DRW_engine.h
@@ -293,12 +292,6 @@ data_to_c_simple(engines/gpencil/shaders/gpencil_simple_mix_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_point_vert.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_point_geom.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_point_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_gaussian_blur_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_wave_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_pixel_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_swirl_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_flip_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_light_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_painting_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_paper_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_edit_point_vert.glsl SRC)
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index 164954cae5a..1fbc68b125f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -66,7 +66,7 @@ void gpencil_object_cache_add(tGPencilObjectCache *cache_array, Object *ob, bool
 	tGPencilObjectCache *cache = &cache_array[*gp_cache_used];
 	RegionView3D *rv3d = draw_ctx->rv3d;
 	
-	/* zero out all vfx_* pointers */
+	/* zero out all pointers */
 	memset(cache, 0, sizeof(*cache));
 	
 	/* save object */
diff --git a/source/blender/draw/engines/gpencil/gpencil_depth_of_field.c b/source/blender/draw/engines/gpencil/gpencil_depth_of_field.c
deleted file mode 100644
index 3aa5c067d8a..00000000000
--- a/source/blender/draw/engines/gpencil/gpencil_depth_of_field.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright 2017, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Institute, Antonio Vazquez
- *
- */
-
-/** \file blender/draw/engines/gpencil/gpencil_depth_of_field.c
- *  \ingroup draw
- *
- * Depth of field post process effect. This code is based on Eevee DOF code
- */
-
-#include "DRW_render.h"
-
-#include "DNA_camera_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_camera.h"
-
-#include "DEG_depsgraph_query.h"
-
-#include "GPU_framebuffer.h"
-#include "GPU_texture.h"
-
-#include "gpencil_engine.h"
-
-extern char datatoc_gpencil_dof_vert_glsl[];
-extern char datatoc_gpencil_dof_frag_glsl[];
-
-/* create dof shaders */
-static void gpencil_create_shader_depth_of_field(GPENCIL_e_data *e_data)
-{
-	e_data->gpencil_dof_downsample_sh = DRW_shader_create(datatoc_gpencil_dof_vert_glsl, NULL,
-	                                             datatoc_gpencil_dof_frag_glsl, "#define STEP_DOWNSAMPLE\n");
-	e_data->gpencil_dof_scatter_sh = DRW_shader_create(datatoc_gpencil_dof_vert_glsl, NULL,
-	                                          datatoc_gpencil_dof_frag_glsl, "#define STEP_SCATTER\n");
-	e_data->gpencil_dof_resolve_sh = DRW_shader_create(datatoc_gpencil_dof_vert_glsl, NULL,
-	                                          datatoc_gpencil_dof_frag_glsl, "#define STEP_RESOLVE\n");
-}
-
-/* helper to get near and far depth of filed values */
-void GPENCIL_dof_nearfar(Object *camera, float coc, float nearfar[2])
-{
-	if (camera == NULL) {
-		return;
-	}
-
-	const DRWContextState *draw_ctx = DRW_context_state_get();
-	Scene *scene = draw_ctx->scene;
-	Camera *cam = (Camera *)camera->data;
-
-	float fstop = cam->gpu_dof.fstop;
-	float focus_dist = BKE_camera_object_dof_distance(camera);
-	float focal_len = cam->lens;
-
-	/* this is factor that converts to the scene scale. focal length and sensor are expressed in mm
-	* unit.scale_length is how many meters per blender unit we have. We want to convert to blender units though
-	* because the shader reads coordinates in world space, which is in blender units.
-	* Note however that focus_distance is already in blender units and shall not be scaled here (see T48157). */
-	float scale = (scene->unit.system) ? scene->unit.scale_length : 1.0f;
-	float scale_camera = 0.001f / scale;
-	/* we want radius here for the aperture number  */
-	float aperture_scaled = 0.5f * scale_camera * focal_len / fstop;
-	float focal_len_scaled = scale_camera * focal_len;
-
-	float hyperfocal = (focal_len_scaled * focal_len_scaled) / (aperture_scaled * coc);
-	nearfar[0] = (hyperfocal * focus_dist) / (hyperfocal + focal_len);
-	nearfar[1] = (hyperfocal * focus_dist) / (hyperfocal - focal_len);
-}
-
-/* init depth of field effect */
-int GPENCIL_depth_of_field_init(DrawEngineType *draw_engine_gpencil_type, GPENCIL_e_data *e_data, GPENCIL_Data *vedata, Object *camera)
-{
-	GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
-	if (stl->storage->enable_dof == false) {
-		return 0;
-	}
-
-	GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
-	const DRWContextState *draw_ctx = DRW_context_state_get();
-	ViewLayer *view_layer = draw_ctx->view_layer;
-	IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE);
-
-	Scene *scene = draw_ctx->scene;
-	RegionView3D *rv3d = draw_ctx->rv3d;
-
-	if (!e_data->gpencil_dof_downsample_sh) {
-		gpencil_create_shader_depth_of_field(e_data);
-	}
-
-	if (camera) {
-		const float *viewport_size = DRW_viewport_size_get();
-		Camera *cam = (Camera *)camera->data;
-
-		/* Retreive Near and Far distance */
-		stl->storage->dof_near_far[0] = -cam->clipsta;
-		stl->storage->dof_near_far[1] = -cam->clipend;
-
-		int buffer_size[2] = { (int)viewport_size[0] / 2, (int)viewport_size[1] / 2 };
-
-		/* Setup buffers */
-		e_data->gpencil_dof_down_near = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], GPU_RGBA16F,
-														   draw_engine_gpencil_type);
-		e_data->gpencil_dof_down_far = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], GPU_RGBA16F,
-														   draw_engine_gpencil_type);
-		e_data->gpencil_dof_coc = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], GPU_R16F,
-														   draw_engine_gpencil_type);
-		e_data->gpencil_dof_weight = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], GPU_R16F,
-														   draw_engine_gpencil_type);
-
-		GPU_framebuffer_ensure_config(&fbl->dof_down_fb, {
-			GPU_ATTACHMENT_NONE,
-			GPU_ATTACHMENT_TEXTURE(e_data->gpencil_dof_down_near),
-			GPU_ATTACHMENT_TEXTURE(e_data->gpencil_dof_down_far),
-			GPU_ATTACHMENT_TEXTURE(e_data->gpencil_dof_coc)
-		});
-			
-		/* Go full 32bits for rendering and reduce the color artifacts. */
-		GPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
-
-		e_data->gpencil_dof_far_blur = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], fb_format,
-														  draw_engine_gpencil_type);
-		GPU_framebuffer_ensure_config(&fbl->dof_scatter_far_fb, {
-			GPU_ATTACHMENT_NONE,
-			GPU_ATTACHMENT_TEXTURE(e_data->gpencil_dof_far_blur),
-			GPU_ATTACHMENT_TEXTURE(e_data->gpencil_dof_weight)
-		});
-
-		e_data->gpencil_dof_near_blur = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], fb_format,
-														   draw_engine_gpencil_type);
-		GPU_framebuffer_ensure_config(&fbl->dof_scatter_near_fb, {
-			GPU_ATTACHMENT_NONE,
-			GPU_ATTACHMENT_TEXTURE(e_data->gpencil_dof_near_blur),
-			GPU_ATTACHMENT_TEXTURE(e_data->gpencil_dof_weight)
-		});
-
-		/* Parameters */
-		/* TODO UI Options */
-		float fstop = cam->gpu_dof.fstop;
-		float blades = cam->gpu_dof.num_blades;
-		float rotation = cam->gpu_dof.rotation;
-		float ratio = 1.0f / cam->gpu_dof.ratio;
-		float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
-		float focus_dist = BKE_camera_object_dof_distance(camera);
-		float focal_len = cam->lens;
-
-		UNUSED_VARS(rotation, ratio);
-
-		/* this is factor that converts to the scene scale. focal length and sensor are expressed in mm
-		 * unit.scale_length is how many meters per blender unit we have. We want to convert to blender units though
-		 * because the shader reads coordinates in world space, which is in blender units.
-		 * Note however that focus_distance is already in blender units and shall not be scaled here (see T48157). */
-		float scale = (scene->unit.system) ? scene->unit.scale_length : 1.0f;
-		float scale_camera = 0.001f / scale;
-		/* we want radius here for the aperture number  */
-		float aperture = 0.5f * scale_camera * f

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list