Add Depth of field support for Grease Pencil #53947

Closed
opened 2018-01-30 16:29:28 +01:00 by Antonio Vazquez · 3 comments

After review how work DOF in Eevee, I decide to use the same approach for Grease Pencil.

The first step is “accumulate” all GP drawing output to a new framebuffer and then apply a DOF filter similar to what you have in Eevee. This cumulative framebuffer would have all GP drawing stuff in one place.

The idea is to duplicate eevee_depth_of_field.c and create a new gpencil_depth_of_field.c. Basically both codes will be very similar, but I think is better to keep a separate copy because in the future they can diverge.

About shaders, Eevee define 3 shaders, but only uses 2:

extern char datatoc_effect_dof_vert_glsl[];
extern char datatoc_effect_dof_frag_glsl[];

Note: The geom shader is defined but is not used in the code.

These shaders will be duplicated in gpencil engine folder and customize to the requirements of GP. I know that Eevee and Gpencil DOF implementation would be almost identical, but I think is better to keep each engine with his own modules.

I was doing some tests last week, sending the current grease pencil framebuffer output through the DOF shader before sending to default framebbufer, and I got DOF effect for GP in the viewport, but I have two problems now:

  1. The transparence is missing (@fclem told me about that) and any pixel with alpha = 0, get black.
  2. The z-depth of the result is not right, but my idea is to use the z-depth of source texture and output in the resolve pass in the gl_FragDepth output.

(I have done all test in separated local branch)

After review how work DOF in Eevee, I decide to use the same approach for Grease Pencil. The first step is “accumulate” all GP drawing output to a new framebuffer and then apply a DOF filter similar to what you have in Eevee. This cumulative framebuffer would have all GP drawing stuff in one place. The idea is to duplicate **eevee_depth_of_field.c** and create a new **gpencil_depth_of_field.c**. Basically both codes will be very similar, but I think is better to keep a separate copy because in the future they can diverge. About shaders, Eevee define 3 shaders, but only uses 2: extern char datatoc_effect_dof_vert_glsl[]; extern char datatoc_effect_dof_frag_glsl[]; Note: The geom shader is defined but is not used in the code. These shaders will be duplicated in gpencil engine folder and customize to the requirements of GP. I know that Eevee and Gpencil DOF implementation would be almost identical, but I think is better to keep each engine with his own modules. I was doing some tests last week, sending the current grease pencil framebuffer output through the DOF shader before sending to default framebbufer, and I got DOF effect for GP in the viewport, but I have two problems now: 1) The transparence is missing (@fclem told me about that) and any pixel with alpha = 0, get black. 2) The z-depth of the result is not right, but my idea is to use the z-depth of source texture and output in the resolve pass in the gl_FragDepth output. (I have done all test in separated local branch)
Author
Member
Added subscribers: @fclem, @antoniov, @dfelinto, @JoshuaLeung, @pepe-school-land, @mendio
Author
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Antonio Vazquez self-assigned this 2018-10-24 19:15:41 +02:00

Added subscriber: @RomainGuimbal

Added subscriber: @RomainGuimbal
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#53947
No description provided.