This project has moved and is read-only. For the latest updates, please go here.

Shader example 2D

Nov 28, 2014 at 5:40 PM
Edited Nov 28, 2014 at 7:01 PM

i want to add a glow effect to my Button , but i have no idea ,how to do that.

I would very appriciate it when somebody can give me a full example, how too add effects on a 2D Texture. I have never used XNA or C# . Some links refering to XNA , i dont get it... how to port this to the Toolkit.
All my attempts failed badly...
Pls a full example , and dont let the "unimportend" stuff away, i am a beginner.

(I am a not english native speaker, i hope you understand my problems) =D
Nov 28, 2014 at 10:43 PM
Edited Nov 28, 2014 at 11:48 PM
The reason we point to a lot of XNA Game Studio content is that much of it applies (at least in theory) to the DirectX Tool Kit which is a C++ library but it makes use of the design of the XNA Game Studio APIs. As such, most anything you can do with say XNA Game Studio's C# SpriteBatch class, you can do in the same way with DirectX Tool Kit's C++ SpriteBatch class.

Of course, since XNA Game Studio is built around Direct3D 9 with the Effects framework shaders built with the fx_2_0 shader profile with C# code, and DirectX Tool Kit is built around Direct3D 11 with direct HLSL shaders using the Shader Model 4.0 profiles (and their Feature Level 9.1 equivalents) with C++ code, they are not the same line-by-line but the concepts certainly apply.

I would love to see more tutorials and samples for the DirectX Tool Kit, and there are a few out there, but there's limited resources available to do this work.

Glow effects are achieved with a post-process filter, usually applied with a fullscreen alpha-blended sprite via SpriteBatch. Glow and bloom are very similar, so take a look at this Windows Store app sample using the DirectX Tool Kit.
Marked as answer by walbourn on 11/28/2014 at 2:47 PM
Nov 29, 2014 at 2:06 AM
Edited Nov 29, 2014 at 2:23 AM
thank you for your reply,

you have done a nice work with the DirectX Toolkit, but it needs a proper Documentation(as all Libraries), with compileable examples, for the most common cases.
The best Library , is nothing without a well written Documentation, i cant use it...
All pages on msdn and stuff said use DirectX Toolkit its the future.... and microsoft makes all D3DX stuff deprecated.
I am on Windows 7, cant open your example. Opening all files , to hopefully find what i need, its a pain in the ass.(Sorry)

I think you know that already...
And theres work out there with higher priority.

For me its a shame...
I will start again at the beginning(with pure DirectX), to understand the hole thing better.
At least is back, and try to write my own stuff.

Maybe i will be back, when there is a good Documentation for it.
And with it would come a growing Community, not a one man Army =)
Thanks again for your Attention, i hope for the Library that the day comes...
Nov 29, 2014 at 5:44 AM
Edited Nov 29, 2014 at 8:25 AM
There is documentation and samples for DirectX Tool Kit.

What it appears you really need is a complete step-by-step book as a beginner's guide to DirectX. There are a number available, although finding a new enough book that doesn't have legacy references to the D3DX library is a bit challenging. The book publishing industry has difficultly moving fast enough to keep up with the technology, and often misses important shifts like the Windows 8.x SDK transition that happened a few years after DirectX 11 was released.

How to use DirectX 11 interfaces and writing HLSL shaders is the same in the books that use the legacy DirectX SDK as it would be in the Windows 8.x SDK. You can fairly easily shift from legacy D3DX11 to using DirectX Tool Kit per this blog post. See Living without D3DX for a complete list of alternatives to the legacy D3DX libraries. In the meantime, you can mix the Windows 8.x SDK that comes with VS 2012 and 2013 with the legacy DirectX SDK if needed per the instructions on MSDN as long as you are only targeting Win32 desktop applications.

Everything about the XNAMath SIMD C++ library applies to using DirectXMath. There's also porting information from moving from D3DXMath as well. You can also use SimpleMath in the DirectX Tool Kit as a way to get something closer to XNA Game Studio's math library.

The big challenge with writing a tutorial series for DirectX Tool Kit is target platform. Most of the MSDN beginner DirectX content is focused today on Window Store apps for Windows 8.x, Windows phone 8 apps, and Windows Universal apps (which only currently run on Windows 8.1 or Windows Phone 8.1 but will be a major focus of Windows 10). VS 2012 and 2013 includes a rich array of project templates which makes targeting these platforms easier. DirectX Tool Kit supports all of these platforms as well as Xbox One XDK, Xbox One ADK, and Win32 desktop apps on Windows Vista or later. Writing and updating the same tutorial series a half-dozen times is just not practical.

If you are specifically working with Windows 7 and VS 2012 or VS 2013, you should start with the basic Direct3D 11 tutorial which covers the basics of setting up a swapchain and device. Then you can take a look at DirectXTK Simple Win32 Sample for some simple usage scenarios for DirectX Tool Kit graphics components.

The key thing to remember is that DirectX Tool Kit is just that, a tool kit. It is not a game engine or even a framework. It's just a collection of exceedingly useful Direct3D 11 utility classes, functions, and pre-written shaders that make it much easier to develop Direct3D 11 programs. You can always debug into the code to see how it works, replace it piecemeal with your own stuff, or otherwise modify it and use as a learning sample itself. You can write programs that heavily use DirectX Tool Kit components, just use a few key pieces, or not use it at all. It is also a demonstration of how to write C++ code that is portable to the wide array of modern Microsoft platforms as discussed in this blog article series.
Marked as answer by walbourn on 11/28/2014 at 9:57 PM
Nov 30, 2014 at 3:53 PM
thanks, for your answer!

I have a look on it!

I begin to read through the hole msdn DirectX docs, and now im feel a bit less stupid^^

I developing my own wrapper , to understand the concept about DirectX11 .
(It seemed to be fun for me, learned a lot)

I will have look on Toolkit in special cases, I copied the WIC and DDS Loader, because there is nothing wrong with it =D
(also too avoid D3DX stuff)

The C++11 standard is already adapted in my codestyle. RAII concept and stuff also.

I will upgrade to Windows 10 once , it released.

I feeling less frustrated , then on my last post ;) I am motivated to get this done.

(Sorry for my english have hard issues with the grammar times ;D)