How to use tha shader library (mtlFX)

Posted By: mEnTaL

How to use tha shader library (mtlFX) - 08/05/10 15:11

I have to use the mtlFX shader library (because i need to create water), but how to use all this shaders? Maybe I have to #include <mtlFX.c> into my project, but then how I will assign mtlFX shader actions to the entities in my level? And the engine always can't find the mtlFX.c which is in the folder. It is a little confusing so can you tell me how to use it or give me a sample plz
Posted By: Alan

Re: How to use tha shader library (mtlFX) - 08/05/10 17:18

Hi,

yes, it is true that you need to have

#include <mtlFX.c>

in your code, preferrably somewhere in your main file at the very beginning. Every shader which comes with 3DGS has a material which CONTAINS the shader information. So if you want to add a certain shader to a model, you just have to assign the shader to it. Example:

Code:
action myEntityAction(){
  my.material = mtl_toon;
}



This would cause the entity which uses the action "myEntityAction" to be toon-shaded. Basically it is that simple, but certain Shaders (phong shading, water shading etc.) have special requirements. To inform yourself about these and to get a full list of all shaders, visit:

http://manual.3dgamestudio.net/acknex.htm


Oh, one more thing: these shaders work only with 3DGS 7 Commercial or above. There are some fixed-pipeline-shaders which will work with ALL versions of 3DGS (including the free version), they can be found in the GameStudio Wiki.


Hope this helps.



Alan
Posted By: mEnTaL

Re: How to use tha shader library (mtlFX) - 08/05/10 18:37

I did as you said: I included the mtlFX at the beginning of my game script

Code:
#include <mtlFX.c>;



and then I made an action for my entity:

Code:
action test()
{
my.material = mtl_toon;
}



and also the mtlFX.c and the rest of the shaders are in the game folder. But when I try to compile I always get this error


Help plz
Posted By: djfeeler

Re: How to use tha shader library (mtlFX) - 08/05/10 19:12

To include a file it is necessary to make #include "mtlFX.c"; not #include <mtlFX.c>;

Posted By: Rei_Ayanami

Re: How to use tha shader library (mtlFX) - 08/05/10 19:14

Originally Posted By: djfeeler
To include a file it is necessary to make #include "mtlFX.c"; not #include <mtlFX.c>;


That would be new to me, as <> means: include from "include"-folder in the gs path, and "" means include from the actual work_folder (plus given path,if)
Posted By: TrackingKeks

Re: How to use tha shader library (mtlFX) - 08/05/10 19:35

I think you have forgotten this part:

Code:
MATERIAL* mtl_toon =
{
	effect= "toon.fx";
	flags= AUTORELOAD;
}


Posted By: mEnTaL

Re: How to use tha shader library (mtlFX) - 08/05/10 20:04

Actually the problem has been that I have to include it this way:
#include "mtlFX.c";
because it is in the project folder. Otherwise the engine doesn't find it.
Problem fixed! Thx to all for answers.
© 2024 lite-C Forums