Forums > Jitter

Binding multiple shaders ?

June 26, 2007 | 6:59 pm

Hi.

Question for you ladies and gents. Say I have two shaders, and I want
to bind them both to jit.gl.model. Is this even possible? Do I need
to combine the code? Say one adds noise to the verts, and the other
does some lighting stuff? Is this not possible?

Ive tried a few variations of shader messages to jit.gl.model, but
have gotten no errors, but no results. Thanks, super curious as to
how this would be accomplished.

v a d e //

http://www.vade.info
abstrakt.vade.info


June 26, 2007 | 7:04 pm

This is not possible. Only 1 vertex and 1 fragment shader can be
bound at any given time. Combine the code or do > 1 pass and add the
results together.

wes

On 6/26/07, vade wrote:
> Hi.
>
> Question for you ladies and gents. Say I have two shaders, and I want to
> bind them both to jit.gl.model. Is this even possible? Do I need to combine
> the code? Say one adds noise to the verts, and the other does some lighting
> stuff? Is this not possible?
>
> Ive tried a few variations of shader messages to jit.gl.model, but have
> gotten no errors, but no results. Thanks, super curious as to how this would
> be accomplished.
>
>
> v a d e //
>
> http://www.vade.info
> abstrakt.vade.info
>
>
>
>
>
>


June 26, 2007 | 7:16 pm

Ah. Ok. I was wondering how apps like Maya and Modo handle this,
because they have bindings for multiple shaders, but I guess they do
multiple passes, which is why they have opacity and blend mode
controls, since they are outputting bitmaps for each pass.

Cool, thanks Wes!

On Jun 26, 2007, at 3:04 PM, Wesley Smith wrote:

> This is not possible. Only 1 vertex and 1 fragment shader can be
> bound at any given time. Combine the code or do > 1 pass and add the
> results together.
>
> wes
>
> On 6/26/07, vade wrote:
>> Hi.
>>
>> Question for you ladies and gents. Say I have two shaders, and I
>> want to
>> bind them both to jit.gl.model. Is this even possible? Do I need
>> to combine
>> the code? Say one adds noise to the verts, and the other does some
>> lighting
>> stuff? Is this not possible?
>>
>> Ive tried a few variations of shader messages to jit.gl.model, but
>> have
>> gotten no errors, but no results. Thanks, super curious as to how
>> this would
>> be accomplished.
>>
>>
>> v a d e //
>>
>> http://www.vade.info
>> abstrakt.vade.info
>>
>>
>>
>>
>>
>>

v a d e //

http://www.vade.info
abstrakt.vade.info


May 28, 2014 | 5:37 am

Old thread, I know..
But what means Wesley here with:

"or do > 1 pass and add the results together"

Thanks

  • This reply was modified 2 months by  jirko.

June 3, 2014 | 10:03 am

"or do > 1 pass and add the results together"

you render the scene with one shader attached, store the resulting texture – there are different ways of doing this, one possibility could be the @capture attribute with jit.gl.camera (my preference) – and then attach the other shader and capture the scene again, then take the two textures and blend them together with an object like jit.gl.slab. which leads to the final result.


June 11, 2014 | 4:50 am

Thanks, but I dont want to process textures . I thought there is a way to combine for example a vertex shader and lighting shaders..


June 11, 2014 | 5:59 am

if you mean by lighting shader a fragmentshader (there is no such thing as a lighting shader to my knowledge. only shaders that deal with lighting), then yes, it is possible to combine the two. if you look at the shader-examples of jitter you will see how this is done.

however to clearify: it is possible to attach only one shader-file to an model. but the shader-file itself is structured into (usually) two parts: a vertex shader, that deals with each vertice, and a fragment shader, that deals with each pixel of the output texture. inbetween the two there can also be a geometry shader, that allows to create (add) new vertices and faces based on vertices of the model. I thinks there are some examples of this as well somehwere hidden inside the jitter-shader folder.


June 11, 2014 | 9:09 am

Thanks again, but I cant find any example in jitter-examples/render/shaders that combines a fragment and a vertex shader..
or even two shaders of that type. In my case im using a vertex shader bind to a mesh but I also want to use a phong shader..


June 11, 2014 | 9:42 am

look here: Max 6.1/Cycling ’74/jitter-shaders/material


Viewing 9 posts - 1 through 9 (of 9 total)