Sign in to follow this  
NeonLibra

[DX10] FX File Deployment

Recommended Posts

NeonLibra    100
I'm still wholly and completely new to graphics programming in general, let alone DirectX 10+. I did scan through the FAQ for this and honestly any search time I tried online related "FX" to the Java UI framework. If there is a better term to describe these files I'd love to hear it.

I'm wondering how seasoned hobbyists, and professionals deal with FX file deployment, since any of the DX applications that I have on my machines expose no FX file in their flat file installation.

Also, a side hobbyist question. Why aren't these FX files exposed to the end users? It seems like having these available to the end user would be a source of modding "fun".

Share this post


Link to post
Share on other sites
MJP    19755
Most big budget commercial games don't use the Effects framework, and instead have their own material/shader management systems built into their engine. But even if they did use effects, they would likely compile them ahead of time because compiling a lot of shaders can take a looooong time. If you only have a few shaders it doesn't matter, but a lot of commercial games will have hundreds or thousands of shader permutations. Aside from that, a lot of companies probably also don't want people ripping off their source code or doing something unintended with it.

If you want to precompile your effect files so that you don't have to distribute the source code, it's really easy. Just use fxc.exe to precompile the effect to a binary output file, then at runtime load all of the data in that file and pass the pointer to D3D10CreateEffectFromMemory. Or if you want to just distribute the source code and compile at runtime, you can do that too.

Share this post


Link to post
Share on other sites
griffin77    125
As demonstrated by [url="http://www.gamedev.net/topic/607827-fxc-fh-option-doesnt-seem-to-work/"]my rather dumb post[/url] I am embeding my shader files directly in my C headers. This avoids any runtime loading/compiling, which makes life easier (of course you usually need this for other games assets, shaders are a weird intermediate step between code and assets).

Of course runtime loading/compiling can be a godsend if you want to edit shaders on the fly and see the results in real time.

Share this post


Link to post
Share on other sites
NeonLibra    100
Since I'm obviously new to this whole world of programming and skimming through various tutorial libraries I don't see a lot of discussion on this, I have another question. Is it possible to contain this within the binary? Keep everything nice and self contained, etc.

I honestly wasn't aware that it's possible to use another effects framework. I guess this relates to the question in a previous thread, to which I would amend. What's the simplest way to display a spliced photo/image onto a quad. I don't obviously possess the ability or knowledge to even begin a search on this it would seem as my attempts have been futile. With the answer you have given me, about not being bound to the DirectX (or HLSL?) effects system, my desired function seems incredibly simple, and it would seem to me, again with an obvious lack of understanding, that the DirectX effects system is incredibly complex for what I need.

Going through the Microsoft tutorials, I don't find a link between them and what I seek. I'm perfectly capable of reading, if there are better sources I would appreciate a direction. As much as I might appreciate a handout, I am not seeking one. This isn't for any coursework, I'm merely a hobbyist that's never done anything with graphics programming since the Mode13 days.

Share this post


Link to post
Share on other sites
griffin77    125
[quote name='NeonLibra' timestamp='1312516107' post='4844854']
Since I'm obviously new to this whole world of programming and skimming through various tutorial libraries I don't see a lot of discussion on this, I have another question. Is it possible to contain this within the binary? Keep everything nice and self contained, etc.
[/quote]
The way I describe above (where the shader binary is embeded in the C header file) will do this

Share this post


Link to post
Share on other sites
MJP    19755
Yeah you can make a header, or you can embed the binary data as a resource in the executable.

The absolute simplest path to drawing an image on a quad would be to use ID3DX10Sprite. It can render a sprite with a given size, rotation, and position.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this