Multiple Lights [HLSL][Direct3D9]
Personally I use 3 different techniques in one effect file. And then I have different effect files. For example one for normal mapping, another one for normal/parallax mapping and so on. In my opinion it makes it easier to structure.
Hi,
Whatever you want :)
* You can write a .fxh file and declare your shader variables/data types in it, then write seperate .fx files (for each light equation/type) that use this .fxh file with #include lines.
* Or, you can write a single .fx file, seperate shaders (for each light equation/type) and seperate techniques in it (maybe one technique, seperate "passes").
* Or, you can write a single .fx file, single technique and single shader in it. How can you manage your code with light type? You can use "if" statemens:
Hope this helps.
Quote:So I have say 3 different effects, Directional light, point light and spot light, should I have 3 different effect files, or 3 different techniques within a single effect file?
Whatever you want :)
* You can write a .fxh file and declare your shader variables/data types in it, then write seperate .fx files (for each light equation/type) that use this .fxh file with #include lines.
* Or, you can write a single .fx file, seperate shaders (for each light equation/type) and seperate techniques in it (maybe one technique, seperate "passes").
* Or, you can write a single .fx file, single technique and single shader in it. How can you manage your code with light type? You can use "if" statemens:
...if (light_type == LIGHT_DIR){...}if (light_type == LIGHT_SPOT){...}if (light_type == LIGHT_POINT){...}
Hope this helps.
I was thinking more along the lines of what is fastest, it's cheaper to change techniques rather than effects isn't it?
I would suppose you are right. That's what I think at least, as you still can use all the constants you uploaded.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement