Custom GLSL shader in 3D view.


I am new to Blender script programming, so please forgive me is the answer is trivial (I have been looking around for a few hours and I did not find how to do what I want).

I would like to use an custom GLSL shader in the 3D View without being in the Game Mode (in this later case I found how to do it). Is it possible ?

Thanks in advance,


Thanks to guys from #blender and #blendercoders IRC channels I could sort it out.

This is not possible with the official blender release.

BUT, this feature is present in the Harmony branch which provides both a API and a UI (a new panel in the material menu) allowing to add and display GLSL shaders in the 3D view if you use the Game Renderer. Uniform variables are automatically parsed and modifiable via UI in this panel.

Thanks to moguri and kupoman for their great job!


I was told it is possible using a custom render engine AddOn which offers a view_update event. From there you can draw in the viewport as you see fit with OpenGL. I have yet to see a working example, however.

Thanks, this seem to be a possibility.

However, I can’t see where to register the render engine to have its view_update() and view_draw() functions called. The example in the doc only gives registrations to have render() and render_preview() called.

After a lot of research I’ve found that view_update() and view_draw() actually get called and work fine. All you need to do is to switch 3D View’s shading mode to Rendered. I’ve spent hours looking for this solution, docs are really poor when it comes to this topic. I hope this helps the others.

Does this mean we can finally have an SSAO GLSL shader installed directly in the viewport?