Page MenuHome

Initial implementation of Shader FX (effects).
AbandonedPublic

Authored by Antonio Vazquez (antoniov) on Jun 29 2018, 12:03 PM.

Details

Summary

Now, the FX are used only by grease pencil object, but the design is ready to be used for other object types.

These FXs replace the old VFX modifiers, that were removed during the first steps of the greasepencil-object merge review.
The new implementation is fully separated of modifiers and with its own management modules.

Diff Detail

Repository
rB Blender
Branch
temp-greasepencil-vfx
Build Status
Buildable 1794
Build 1794: arc lint + arc unit

Event Timeline

Big refactor and new effects.

Now it's possible to add several effects of the same type to the object.

  • New effect RIM.
  • New effect Colorize.

IIRC, one of the reasons we wanted these effects separated out into a separate stack is so that we could in theory extend this support to other object types - to become a more general set of screenspace effects we can apply to objects in the viewport. I'm not sure whether this goal is still on the table (maybe not right now, but more that we still plan to do it in future). If this is still the case, then one of the architecture level issues is that you've got the shaders defined in the GP engine namespace, and not something more general that can be shared between different engines (e.g. see the draw/intern stuff that's shared between different edit modes).

AFAIK, I couldn't really see anything in the shaders that really explicitly ties the shaders to requiring access to Grease Pencil data to function (apart from the references to gpd->pixfac, which you could easily just pass as another parameter to those drawing functions if need be).

I have implemented all inside gpencil drawing engine because all the "real" functionality is very tighted to the Gpencil drawing. For normal objects the drawing is totally different and need to be integrated in its own engine. What I have done is:

  1. Separate all from modifiers becaus ethey are a "different" thing.
  2. Create all infraestructure to be easily used by other engines.

But the points above don't mean you can reuse the FX for any drawing engine. If you look at the code, you will see there are two sections, the FX definition (shareable) and the engine implementation (not shareable).

I was specifically referring to the .glsl files (and to a lesser extent, the DRW_gpencil_fx_*() functions, as they're are basically wrappers around those which bind the shader args based on the modifier/shaderfx item values. AFAICT, all of these are pretty generic and reusable. (Maybe the "Light" one is an exception, but I didn't check that one too carefully). All other ones though look like they could be reusable?

I have looking carefully at the code and I think is not good idea to move it to a shared area. The implementation of the shaders is very dependent of the engine (you need define textures, framebuffers, etc) and it's designed to work over a predefined set of steps for drawing. Maybe this code could be reused (.glsl and DRW_*) in the future but I think now it's better keep separated.

I'm going to merge the FX in greasepencil-branch (to have all in a separated branch only adds complexity to source code management and git tasks). We always can rollback the commit and if we need share the code in the future, (I'm not sure this will happen ever) we can move the shared code to shared area.