microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++
https://walbourn.github.io/directxtk/
MIT License
2.57k stars 511 forks source link

Shader on SpriteBatch? #277

Closed ghost closed 3 years ago

ghost commented 3 years ago

I swear I saw a tutorial somewhere about applying shaders to spritebatch objects, like making edge glow? Is this possible, or am I out of my mind? Ok, the answer to that is obvious, but, you know... ;)

walbourn commented 3 years ago

https://github.com/microsoft/DirectXTK/wiki/Writing-custom-shaders

ghost commented 3 years ago

You are truly a saint, sir!

ghost commented 3 years ago

Can I ask for a slight clarification, then? This is how to make a custom effect on a 3D object. You had said in another thread that the SpriteBatch is just a particular projection, but I'm wondering if there's a way to apply shader effects to objects in the sprite batch? If I just need to read the above article in depth and it will answer my question, that's all I need to know. Basically doing a simple GUI system and I'd like to be able to make a button glow when I hover over it without having to make "glowing graphics" sprites. Seems it MAY be simpler just to figure out how to apply a "glow the edges of this" shader on the sprite.

walbourn commented 3 years ago

I have a todo to add a specific tutorial on authoring a custom IEffect implementation which is what you need for 3D objects. SpriteBatch uses it's own shaders, which is what that tutorial covers.