FX Composer shader
by Khaled AlMoukhtar · in Torque Game Engine Advanced · 01/08/2008 (5:09 am) · 8 replies
TDN says:
"So you want to take your shader you developed in FX composer or RenderMonkey? Here's how to go about doing it. This tutorial is more centered on RenderMonkey, but since the HLSL files are the same, you don't need to worry about a thing."
I actually followed the steps in this resource but I somehow lost.
how can I divide the *.fx file into Vertex and Pixel I know a little about shaders but I have so many samples and I want to test it using TGEA, maybe if I get some simple shader I can split it but what if I am trying to port a complex comprehensive shader it will be VERY difficult to split it....,however, the sample that is used in TDN doesn't work there so many things that doesn't match like
1-
"Open server/scripts/shaders.cs"
there is no shader.cs in server/scripts
2-
"Open server/scripts/materials.cs and add a new CustomMaterial definition:"
I did not find the materials.cs file in server/shaders.cs
3-
"datablock CustomMaterial(Glitter)"
I think it should be like this
new CustomMaterial(Glitter)
finally, as I understand from TDN each time I want to add a new shader I have to modify the source code and re-compile
you said : http://www.garagegames.com/products/torque/tgea/featurecomp/
"Users can drop in shaders from demos or tools such as FX Composer and RenderMonkey. Also included are exclusive fallback..."
how could I do that...
why there is no complete tutorial with workable step by step to import shaders from other tools ????
why there is no documentation for TGEA like TGE,
oh I know you will say there is much tuts for TGE and it still work for TGEA, well lets say it will works but what about the new features that doesn't exist in TGE at all
I have to say that I am very disappointed, I was very excited when you announce TSE and I continued all the news about it ... and every other day there was anew thing about it, but when the final release finished and released as TGEA the hole project is just STOPPED!!!
I am just asking WHY????
-sorry for bad english-
"So you want to take your shader you developed in FX composer or RenderMonkey? Here's how to go about doing it. This tutorial is more centered on RenderMonkey, but since the HLSL files are the same, you don't need to worry about a thing."
I actually followed the steps in this resource but I somehow lost.
how can I divide the *.fx file into Vertex and Pixel I know a little about shaders but I have so many samples and I want to test it using TGEA, maybe if I get some simple shader I can split it but what if I am trying to port a complex comprehensive shader it will be VERY difficult to split it....,however, the sample that is used in TDN doesn't work there so many things that doesn't match like
1-
"Open server/scripts/shaders.cs"
there is no shader.cs in server/scripts
2-
"Open server/scripts/materials.cs and add a new CustomMaterial definition:"
I did not find the materials.cs file in server/shaders.cs
3-
"datablock CustomMaterial(Glitter)"
I think it should be like this
new CustomMaterial(Glitter)
finally, as I understand from TDN each time I want to add a new shader I have to modify the source code and re-compile
you said : http://www.garagegames.com/products/torque/tgea/featurecomp/
"Users can drop in shaders from demos or tools such as FX Composer and RenderMonkey. Also included are exclusive fallback..."
how could I do that...
why there is no complete tutorial with workable step by step to import shaders from other tools ????
why there is no documentation for TGEA like TGE,
oh I know you will say there is much tuts for TGE and it still work for TGEA, well lets say it will works but what about the new features that doesn't exist in TGE at all
I have to say that I am very disappointed, I was very excited when you announce TSE and I continued all the news about it ... and every other day there was anew thing about it, but when the final release finished and released as TGEA the hole project is just STOPPED!!!
I am just asking WHY????
-sorry for bad english-
#2
I hope I can help a little.
1. A quick search found shader.cs in client\scripts\
2. material.cs is a script file, it can not be inside shader.cs, instead, my "main" material.cs is found in the data directory. I said "main" because you can have several of these in your data directories to define materials belonging to content in those directories. Materials definitions are loaded automatically (and all of them).
3. the line should indeed be: new CustomMaterial
4. source code recompile: Only the shader files (.hlsl) need to be recompiled, not the engine. The ratio behind that is, that during the game, a new definition of a shader is unlikely.
Stefan
01/10/2008 (2:06 am)
Hi Khaled,I hope I can help a little.
1. A quick search found shader.cs in client\scripts\
2. material.cs is a script file, it can not be inside shader.cs, instead, my "main" material.cs is found in the data directory. I said "main" because you can have several of these in your data directories to define materials belonging to content in those directories. Materials definitions are loaded automatically (and all of them).
3. the line should indeed be: new CustomMaterial
4. source code recompile: Only the shader files (.hlsl) need to be recompiled, not the engine. The ratio behind that is, that during the game, a new definition of a shader is unlikely.
Stefan
#3
thanks for trying to help anyway :)
01/10/2008 (2:39 am)
How to recompile the .hlsl files and yes I do just what you said I can't see the glitter effect taking place in my demothanks for trying to help anyway :)
#4
- errors in the respective .cs or .hlsl files (see console.log for error messages)
- wrong naming (material name should be the same name as the textures the shader should "replace")
- double material names (materials that are defined later overwriter earlier definitions)
To debug, you could start off with a standard Material and enable e.g. glow. Like that you can make sure that the material is applied at all and applied to the correct texture/surface. This would rule out the latter two problems. Also make sure that the respective material.cs file is executed (check console.log)
01/10/2008 (3:24 am)
The .hlsl files are automatically recompiled when you restart the engine. Some problems that can prevent materials from showing up:- errors in the respective .cs or .hlsl files (see console.log for error messages)
- wrong naming (material name should be the same name as the textures the shader should "replace")
- double material names (materials that are defined later overwriter earlier definitions)
To debug, you could start off with a standard Material and enable e.g. glow. Like that you can make sure that the material is applied at all and applied to the correct texture/surface. This would rule out the latter two problems. Also make sure that the respective material.cs file is executed (check console.log)
#5
01/10/2008 (3:50 am)
Thanks for quick reply I'll give it another shot , I hope it works this time...
#6
01/14/2008 (12:24 am)
Nothing new, nobody in this forum know how to export .fx file to TGEA.... well that's great :P
#7
You want to work out everything in the moment ... no way. It is impossible.
Understanding shaders well needs more than 2 years learning.
02/05/2008 (11:46 am)
A lot of people here knows how to export shaders, be sure about that.You want to work out everything in the moment ... no way. It is impossible.
Understanding shaders well needs more than 2 years learning.
#8
The same information is relevant inside of TGEA. Depending on how much the effect you have created relies on the FX framework for it's set-up, you may have to do code modification rather than just dropping in the HLSL. If you understand the data that the shader uses, it shouldn't be very difficult to get the effect into TGEA. I recommend looking at CustomMaterial, and the uses of it in the TGEA demo.
02/05/2008 (12:05 pm)
A .fx file contains HLSL shader code, state, constant and render-pass information.The same information is relevant inside of TGEA. Depending on how much the effect you have created relies on the FX framework for it's set-up, you may have to do code modification rather than just dropping in the HLSL. If you understand the data that the shader uses, it shouldn't be very difficult to get the effect into TGEA. I recommend looking at CustomMaterial, and the uses of it in the TGEA demo.
Torque Owner Khaled AlMoukhtar
so I'll just sit here and wait for the answer .... I hope somebody respond.