[PD] glsl effect chaining

marius schebella marius.schebella at gmail.com
Sat Mar 22 21:47:45 CET 2008


just replace pix_image with pix_video.
marius.

Hans-Christoph Steiner wrote:
> 
> Nice, that one just worked for me.  It would be even more fun with a 
> video camera.  I couldn't get that one going...
> 
> .hc
> 
> On Mar 21, 2008, at 10:18 PM, marius schebella wrote:
> 
>> hi,
>> I put an example patch for chaining glsl shader modules at
>> http://www.parasitaere-kapazitaeten.net/Pd/shader_chain
>> it uses one of cyrille's shader examples.
>> marius.
>>
>> marius schebella wrote:
>>> yes, but...
>>> it works, but you have to think about a lot of things and when it really
>>> comes to chaining separate modules together it really gets complicated.
>>> your gemchain has to look like this:
>>>
>>> [gemhead 49]
>>>  |
>>> [shader]
>>>  |
>>> [gemframbuffer]
>>>  |
>>> [translateXYZ 0 0 -4]
>>>  |
>>> [some...texture]
>>>  |
>>> [square 4]
>>>
>>> always give the gemhead a number smaller than the consecutive gemheads,
>>> so that the textures are created before they are used in the next 
>>> gemchain.
>>> in the gemchain itself the shader has to be placed *before* the
>>> framebuffer!
>>> gemframebuffer always "resets" the viewpoint, so you have to translate
>>> everything into negative z to make it visible.
>>> texture needs mode 1 on some cards and mode 0 on other cards, this also
>>> has to be the same as in the shader (sample2D v. sample2DRect).
>>> the geo has to correlate with the translate and cover the whole range,
>>> otherwise you wil crop the image or it will be too small. gemframebuffer
>>> also takes an argument "dim" that will affect the quality.
>>>
>>> if you have all that then you can send the right outlet of
>>> gemframebuffer (which is a number) to another texture right inlet and
>>> another shader can use that.
>>>
>>> this is a little complicated but will work for a shader chain patch.
>>>
>>> now when you think about a modular shader system, where you can just add
>>> shader abstraction into a chain, it gets much much more complicated.
>>> because when you have a combination like
>>>
>>> [shader]
>>>  |
>>> [pix_image]
>>>  |
>>> [texture]
>>>
>>> then the right inlet of texture can get any number, the shader will
>>> always take the image instead, so you cannot do your usual chains, but
>>> will have to refer an image from somewhere else.
>>> it is also difficult to debug, because the gemframebuffer will not
>>> output a texture...
>>> and then - if you use multiple shader modules - you also have to change
>>> the renderorderof the gemhead. with [set 40( or something, but how do
>>> you know at which position you use the shader module??...
>>>
>>> a solution for this would be to turn gemheads off and only trigger them
>>> by "bang" messages.
>>>
>>> ok, the only thing missing right now is a patch showing how this works
>>> in practice. I will do my best...
>>>
>>> marius.
>>>
>>>
>>> cyrille henry wrote:
>>>>
>>>> Pepa Henzl a écrit :
>>>>> Hello,
>>>>> I've just started with glsl languague and Gem this week. Everything
>>>>> works fine, but i'd like to know what to do if i want to apply
>>>>> multiple effects on a texture.
>>>>> Is it possible to render pix data to the texture, instead of current
>>>>> framebuffer window,  and use it for further processing?
>>>> yes.
>>>> you need to render in a frambuffer, and then use it as a texture.
>>>> the gemframebuffer is almost undocumented, but there is an exemple in
>>>> exemple/07.texture/10.frambuffer.
>>>>
>>>> i also rembermber that i send a patch on this list (or gem-dev)
>>>> regardinf the use of glsl + framebuffer.
>>>>
>>>> cyrille
>>>>
>>>>
>>>>> Thanks,
>>>>> pcp.
>>>>>
>>>>> _______________________________________________
>>>>> PD-list at iem.at mailing list
>>>>> UNSUBSCRIBE and account-management ->
>>>>> http://lists.puredata.info/listinfo/pd-list
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> PD-list at iem.at mailing list
>>>> UNSUBSCRIBE and account-management ->
>>>> http://lists.puredata.info/listinfo/pd-list
>>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> PD-list at iem.at mailing list
>> UNSUBSCRIBE and account-management -> 
>> http://lists.puredata.info/listinfo/pd-list
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------------- 
> 
> 
> "It is convenient to imagine a power beyond us because that means we 
> don't have to examine our own lives.", from "The Idols of 
> Environmentalism", by Curtis White
> 
> 
> 
> 
> 





More information about the Pd-list mailing list