3
\$\begingroup\$

How can I make a black shadow/glow around my drawn rectangle made of primitives? Drop-shadowing is easy, but it's not exactly what I am looking for.

\$\endgroup\$
6
\$\begingroup\$

Render your primitives to a render target, and then use a pixel shader to blur and blacken the render target when you draw it back onto the screen. Then simply draw your render target without a pixel shader (or render your original primitives) to the backbuffer.

The Bloom Postprocess sample on App Hub should provide a sufficient example of how to render to a render target and then post-process it with a blur, to implement your effect.

\$\endgroup\$
1
\$\begingroup\$

Make two textures - foreground and background.
First draw your shapes in black color on first texture, and then blur this texture.
Next draw your shapes in normal color on second texture.
Draw first, then second.
Keywords: postprocessing, RenderTarget2D, gaussian blur

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.