Search code examples
shadereffecthlsldirectx-11glow

Directx 11 HLSL Glow Effect


In Directx 11 how can you make an outline glow effect for an object (yes, I do understand that I have to pass only this shader for the object), so it seems like it's kind of selected.

I have seen some examples, but they are all in .fx files, which I don't like.

I appreciate any kind of comment or answer on how this may be made.


Solution

  • You should be able to just take the relevant stuff out of the fx file, the fx file just encapsulates pipeline state and some pixel/vertex shaders that typically represent one 'effect'.

    Short of that, being new to graphics I find your question a bit ambiguous. However, I am familiar with one type of glow which is similar to that of Left 4 Dead (when you see the outline glows of players/objects through the walls). Here are some references:

    More or less you draw the object to the stencil buffer, then you draw the object with the color glow you want into a separate buffer. You then run a Gaussian blur on the separate buffer. Finally you render the blurred buffer onto the screen, restricted by the stencil buffer.