[Bf-committers] GSOC Project: Real-time compositing / SSAO / Cavityshading

Remo Pini remo.pini at avexys.com
Sat Mar 20 15:36:34 CET 2010


Would it be possible/feasible to extend this to support "GLSL Shader Nodes"? I.e. a node that has an editable (text) property "GLSL code"?

I'm asking because I need to solve the problem of replicating the following GLSL logic in Blender and it seems a "GLSL Node" would do this nicely:

----------------------------
uniform sampler2D Layer0;
uniform sampler2D Layer1;
uniform sampler2D Layer2;
uniform sampler2D Layer3;
uniform sampler2D Alpha1;
uniform sampler2D Alpha2;
uniform sampler2D Alpha3;
varying vec4 texCoord;

void main (void)
{
   vec4 l0 = texture2D( Layer0, texCoord.xy * 8);
   vec4 l1 = texture2D( Layer1, texCoord.xy * 8);
   vec4 l2 = texture2D( Layer2, texCoord.xy * 8);
   vec4 l3 = texture2D( Layer3, texCoord.xy * 8);
   vec4 a1 = texture2D( Alpha1, texCoord.xy);
   vec4 a2 = texture2D( Alpha2, texCoord.xy);
   vec4 a3 = texture2D( Alpha3, texCoord.xy);
   gl_FragColor = l0 * (1 - a1.a - a2.a - a3.a) + l1 * a1.a + l2 * a2.a + l3 * a3.a;
}

-----------------------------

Of course a lot cooler features would be possible... the SSAO would then just be a more generic GLSL shader node with predefined code (I'm dreaming of a drop down of predefined GLSL fragment shader types that would populate the GLSL code text).

Wishfull thinking?

Cheers

Remo

> -----Original Message-----
> From: bf-committers-bounces at blender.org [mailto:bf-committers-
> bounces at blender.org] On Behalf Of Matthias Fauconneau
> Sent: Samstag, 20. März 2010 3:24
> To: bf-committers at blender.org
> Subject: [Bf-committers] GSOC Project: Real-time compositing / SSAO /
> Cavityshading
> 
> Synopsis:
> Cavity shading is an effect which allows artists to better perceive
> bump and valleys on their objects. This effect can be computed in
> real-time using Screen-Space Ambient Occlusion.
> By extending the existing compositing nodes to support GLSL
> compositing in the viewport, Blender could win three features in one.
> 
> Benefits to Blender:
> Cavity shading is requested by blender sculptors and modelers on
> blenderartists.org and IRC. It is also on the Durian wishlist.
> SSAO can also be used as an approximate AO for rendering and in game
> engine.
> GLSL compositing would help preview compositing effects and may
> eventually be used to accelerate render.
> 
> Deliverables:
> 3D View will support compositing effect.
> Compositing node will be translated to GLSL.
> A custom compositing node will compute SSAO.
> Deferred material like Cavity shading will become possible.
> 
> Project Details:
> The first step is to interface with the 3D View to create a
> framebuffer and render with effects applied.
> Building upon the GLSL material nodes (in blender/gpu/), It is
> possible to translate the compositing node graphs into GLSL code.
> The SSAO shader was already implemented as a compositing node[1]. It
> was translated to C from a GLSL implementation. with GLSL compositing
> nodes, the original shader can be used.
> Finally, the cavity shader is simply a mapping of AO values to a color
> ramp. Some work will have to be done to support multiple materials.
> 
> Bio:
> I'm a 18 year old student in my 1st licence year in physics, at
> Université Paris-Sud 11
> My main interest is real-time computer graphics.
> I know how to use blender but I am no 3D artist.
> I coded small projects like a quake3 .map renderer, a 2D platformer
> with softbody physics and a comic coloring software.
> 
> Patch:
> I implemented a GLSL material node allowing the user to write it's own
> GLSL shader.
> This allowed me to get to know part of blender architecture.
> screenshot -> http://imagebin.org/89652
> patch -> http://pastebin.com/Q07TQn3F
> 
> PS: I'll be on #blendercoders as "Matthias-" for the Sunday IRC Meeting
> 
> [1] CPU SSAO compositing node by arkano22:
>        thread: http://blenderartists.org/forum/showthread.php?t=175863
>        patch: http://www.thehiddenfactory.com/arkano/cavityao.patch
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers


More information about the Bf-committers mailing list