GenericMaterial
by Rafa M. · in Torque X 3D · 01/26/2009 (10:51 am) · 4 replies
Hey!
I'm trying to use GenericMaterial class and getting an odd error when defining EffectFilename property, either in C# or XML code. Whenever I try that, I get a NullReferenceException in GenericMaterial._ClearParameters.
Just can't figure it out. I got TX3D builder to find out if I was doing something wrong, but the same error pops up when inputing EffectFilename property at GenericMaterial Properties definition.
Can anybody shed some light?
Thanks.
I'm trying to use GenericMaterial class and getting an odd error when defining EffectFilename property, either in C# or XML code. Whenever I try that, I get a NullReferenceException in GenericMaterial._ClearParameters.
Just can't figure it out. I got TX3D builder to find out if I was doing something wrong, but the same error pops up when inputing EffectFilename property at GenericMaterial Properties definition.
Can anybody shed some light?
Thanks.
#2
Can you give me more information about how do you get a GenericMaterial instance and how do you configure your MyCoolShaderEffect.fx? (Build Action = Compile...Copy if newer)?
This is the code I tried:
01/27/2009 (7:58 am)
John, thanks for the answer but still not working.Can you give me more information about how do you get a GenericMaterial instance and how do you configure your MyCoolShaderEffect.fx? (Build Action = Compile...Copy if newer)?
This is the code I tried:
GarageGames.Torque.Materials.GenericMaterial m = new GarageGames.Torque.Materials.GenericMaterial(); m.EffectFilename = @"data\effects\Effect1";
#3
I thought you just needed the filename assignment. Mapping a custom shader to a generic material is much more complicated. I've been putting off an article on working with generic materials. I'll try to get to that today with a real-world example and post it as a resource.
What kind of shader are you trying to make, fullscreen post effect or a material effect shader for a single object on screen (like color replacement).
John K.
www.envygames.com
01/27/2009 (8:42 am)
Oh, sorry. Build Action must be compile. I thought you just needed the filename assignment. Mapping a custom shader to a generic material is much more complicated. I've been putting off an article on working with generic materials. I'll try to get to that today with a real-world example and post it as a resource.
What kind of shader are you trying to make, fullscreen post effect or a material effect shader for a single object on screen (like color replacement).
John K.
www.envygames.com
#4
Looking forward for your article. If you would be so kind to post the link when it's done, I would apreciate it. Got something wrong with Resources page around here and don't wanna miss your work.
Thanks again John. Keep on the good work!
01/27/2009 (8:51 am)
I'm trying to understand material effect shaders for single objects. But got stuck. There's no shader in particular that I'm doing for the moment, this is studying purpose only. Think I'll try color replacement like you said, but first need to understand how materials works and how to define them.Looking forward for your article. If you would be so kind to post the link when it's done, I would apreciate it. Got something wrong with Resources page around here and don't wanna miss your work.
Thanks again John. Keep on the good work!
Associate John Kanalakis
EnvyGames
I'm setting the value in code, like this:
... to point to a file named MyCoolShaderEffect.fx
John K.
www.envygames.com