Shader Help
by Philip Crabtree · in Torque X 2D · 10/06/2010 (1:44 pm) · 3 replies
Hi All,
Sorry if this is a bit of a noob question but I've just started developing with the Torque X Engine (i've tried before but had a few false starts due to time restraints). A few years ago I did a lot of work with C++ and C# so I've decided to use XNA as a way to get back in to it.
I've looked though the documentation although there isn't much in the way of direction for shaders (unless I'm missing something). Can anyone point me in the right direction for getting started on applying a shader to either objects or to the whole scene.
Thanks!
Phil
Sorry if this is a bit of a noob question but I've just started developing with the Torque X Engine (i've tried before but had a few false starts due to time restraints). A few years ago I did a lot of work with C++ and C# so I've decided to use XNA as a way to get back in to it.
I've looked though the documentation although there isn't much in the way of direction for shaders (unless I'm missing something). Can anyone point me in the right direction for getting started on applying a shader to either objects or to the whole scene.
Thanks!
Phil
#2
It uses the LightingEffect2D.fx file
You need to change your materials to be able to use the effects, I found this link that might give you a good idea of how to do this.
I have yet to touch shaders, but hopefully this will help you out! :-)
10/06/2010 (5:44 pm)
Check out LightingDemo2D (\Torque X 3.1.5 Pro\Demos\LightingDemo2D)It uses the LightingEffect2D.fx file
<EffectFilename>LightingEffect2D</EffectFilename>
You need to change your materials to be able to use the effects, I found this link that might give you a good idea of how to do this.
I have yet to touch shaders, but hopefully this will help you out! :-)
#3
@Will - Sorry, I probably didn't phrase my question well. I am aware of how shaders function and how they are implemented in a normal instance (i.e. when not using the Torque X Framework) although I was looking for some engine specific advice. Having said that, I've only really played with the XNA shader demos and a few demos for other engines (Ogre 3D for example) so I'm sure there is still a lot to learn!
@Aaron - Thanks for the link. Don't know how I missed it before. If I get time (and learn enough) I'll post a general 'getting started' thread to help out people in future.
10/07/2010 (8:45 am)
Thanks both!@Will - Sorry, I probably didn't phrase my question well. I am aware of how shaders function and how they are implemented in a normal instance (i.e. when not using the Torque X Framework) although I was looking for some engine specific advice. Having said that, I've only really played with the XNA shader demos and a few demos for other engines (Ogre 3D for example) so I'm sure there is still a lot to learn!
@Aaron - Thanks for the link. Don't know how I missed it before. If I get time (and learn enough) I'll post a general 'getting started' thread to help out people in future.
Torque 3D Owner Will O-Reagan
Modern Intrigues
My idea would be to take a look at how certain shader's are implemented in the engine already, and modify those.
Those .fx files actually look quite standard, but I imagine you'll want to download the whole directX package and look at that documentation, to start doing stuff with shader's.
Just so you know, that is a bit of a noob question. Shaders are written in a high level shader language which is not c, but it's own language, just fyi. So you might want to start off just using the custom shaders that are provided (I've even modified how my shaders are used to provide benefits in my own game). Your post makes it sound like you don't know what you are trying to do, which is never good in game development. Try to have a clear and concise plan, which is executable.
-Will