1
\$\begingroup\$

So as I have been learning DirectX 11, I have been looking at a few tutorials online and in the sample code provided there are more than the usual pixel and vertex shaders (along with the geometry shaders etc..). Based on my understanding there should be minimum 2 shaders (vertex & pixel) which work together.

enter image description here

With these additional shaders how do they work with the vertex and pixel shaders? In these additional shaders there are alse PS and VS functions so could someone explain whats going on here? So as soon as I call the return function in one shader the data is passed to the next?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Might be misunderstanding your question but from the screenshot, it looks like you have a common library of functions to use with your three different shaders: BasicEffect [VS, PS] Brdf [VS, PS] RadianceMap [VS, PS]

You probably already know that, for example, you can link BasicEffectPS and BasicEffectVS, then render a model with your uniform variables, to achieve a BasicEffect on the final render.

You can perform more than one effect in a number of different ways, just depends on how you want it to look.

For example, you can create a new technique that has three passes. Each pass represents each of your three shaders. If you need the output of one shader as the input into the next shader. You will have to create a texture for it as a uniform, then set that texture before moving onto the next pass.

Otherwise, if you just want to draw on the frame three times, just render the model against all three passes and stack the outputs on top of each other like layers.

So to recap, the data from one shader is not passed to the next, but there is a way to link them by passes. That's how I have done it anyway.

\$\endgroup\$
1
  • \$\begingroup\$ But with .FX files being no longer supported how would I use effects, techniques and passes with.HLSL files? Is it the same? By the way you answered my question perfectly :). \$\endgroup\$ Sep 12, 2016 at 6:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .