combining shaders

Jul 8, 2012 at 2:53pm

combining shaders

I feel really bad for posting this, but I was hoping somebody would sympathise and point me in the right direction..
I am very new to gl objects and have only just read up on the shader tutorial which comes with max.
At the end of that tutorial they show off the vd.gravity.jxs shader which instantly made my mind scream at the tutorial.. this shader only affects geometry and doesn’t have any fragment operations.. but they never addressed what the obvious next step would be, how can I create combinations of vertex and fragment shaders?
I read in a forum post 5 years ago where someone asked a simmilar question, the reply was:
“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.”
To this I have 3 very embarrassing questions:
How can they be bound? how can I combine the code? what does “do > 1 pass and add the results together” mean?

Jul 9, 2012 at 10:32am


To answer your questions:
- How can they be bound?
The normal way (in max) is: You add one or more object, read your shader and then bind it to a object by using the
“shader yourshadername” message. Or have a look at the helpfile.

how can I combine the code?
Did you have a loot at this page?
Helped me alot. Also did a search on the forums for example shaders.

what does “do > 1 pass and add the results together” mean?
A pass is a complete rendering of the scene.
Example: One pass.. a little blur. Six passes six times more blur, each in a different color..whatever. (e.g. combining the results of different renderings)

Jul 11, 2012 at 2:42pm

Thanks for getting back to me.
I tried making two objects both addressing the same window but with different names. I can only ever have one of them selected though, unless there is a bind command or something.
I am guessing with the passes you meant to read name1 then name2 then clear the frame, I guess with what I am trying to do I will have to combine the code, since the vertex shader distorts the geometry, but when I then load the fragment shader it reverts to the original geometry.
I’ve seen that shader tutorial a few times but never read through the whole thing, I will try to as soon as I get a good amount of free time..

failed attempt/example:

– Pasted Max Patch, click to expand. –

You must be logged in to reply to this topic.