Two rendering passes with different shaders in DirectX11?

Started by
2 comments, last by BlurEffect 10 years, 1 month ago

Hey guys,

This question is probably kind of stupid or simple but I'm having a bit of a hard time to decide how to have two rendering passes to draw my geometry. I'm creating a cel-shaded environment and I have a vertex/pixel shader for the colouring and a second pair of shaders for the rendering of black outlines. In my renderer class, I'm looping through the scene objects and draw them.

What I don't really get is the following: Some shaders I found declare a technique containing several passes in the HLSL file, is it possible to call such a technique from c++ code without using the effects framework (I read some posts discouraging people from using it). And how would I achieve the same effect without declaring a technique at all? Should I simply loop through all objects twice and switch the shader in between? Thank you very much in advance. Any advice is appreciated.

Cheers

Advertisement

is it possible to call such a technique from c++ code without using the effects framework

No. “Passes” in this context is part of the syntax of the effects framework.

And how would I achieve the same effect without declaring a technique at all? Should I simply loop through all objects twice and switch the shader in between?

If every single object is going to have this (cel-shading) done to them, then yes.
If not, there is no need to draw a second time anything that will not be cel-shaded or does not need a second pass.
Draw them once, then change shaders and draw them again.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Although consider a post-processing pass instead of a geometry pass (the first one often only needs a fullscreen quad to be rendered). I use a cel-shader in my game without a second geometry pass, though I use a deferred render engine to accomplish it. With a forward render engine it might be more difficult.


Should I simply loop through all objects twice and switch the shader in between?

Yes, this would be the way to go. Eg OpenGL don't have effect files, there you need to mange it by yourself.

Alright guys. Thanks for clarifying that!

This topic is closed to new replies.

Advertisement