Game Development Community

Lighting a T2DShape3D Object

by David A Young · in Torque X 2D · 07/05/2009 (1:24 am) · 11 replies

I've looked through the metadata but I don't have access to the TorqueX 2D source since I'm a CC.

Is it possible? or a total lost cause.

Thanks

#1
07/14/2009 (10:35 am)
lost cause...

mine end up looking like "Out Of This World" characters.
#2
07/27/2009 (10:10 am)
David,

Any progress on doing anything about the "flattness" of these T2DShape3D objects?
#3
07/27/2009 (10:12 am)
The best I could do is shadowing the textures themselves. Since my models only need to rotate around their y-axis it's not too much of an issue for me.
#4
07/27/2009 (12:06 pm)
I'm trying to outline it at least, but so far no luck. Not sure if I can even do it with shaders and I tried using the Ink 'n Paint material in 3d studio max, but dts doesnt support it. ugh.
#5
07/27/2009 (5:09 pm)
Do you have ATI RenderMonkey or NVIDIA FX Composer? Both of those come with shaders that *should* work in TX.

Looing at the source for TorqueCore the shaders all seem to be in a folder "effects" in the Content (data) folder. So you should be able to load them into your project through the content pipeline without (m)any problems.
#6
07/27/2009 (6:02 pm)
But how do I add them to my T2DShape3D? it only seems to understand Materials and only SimpleMaterials can have an effect on them. Or can you implement it throughout the level?

I guess my main question is how to I implement an fx shader on a T2DShape3D?
#7
07/28/2009 (9:03 am)
I think you need to derive a class from SimpleMaterial and use the EffectFilename property to set the name of the fx shader.
#8
07/28/2009 (9:18 am)
Sean is correct, you would tie the .fx file by assigning it to the EffectFileName property on the SimpleMaterial.

You'll also probably want to override the _LoadParameters(), _ClearParameters(), _SetupGlobalParameters(), _SetupObjectParameters(), SetupPass(), CleanupEffect() methods.

You can use the _LoadParameters(), _ClearParameters(), _SetupGlobalParameters(), _SetupObjectParameters() to setup your parameters and dispose of them properly.

You can use the SetupPass() to setup your techniques and passes for rendering and then use the CleanupEffect() for cleanup after rendering.

There are some other methods you might want to override depending on the effect you want, but these are usually the ones I need to use most of the time for my shaders just because they have custom parameters, passes and techniques.
#9
07/28/2009 (9:35 am)
Then do I add the Simple Material to the desired material in my T2DShape3D object?
#10
07/28/2009 (9:49 am)
Yeah, although I don't see an easy way to do this looking briefly over the T2DShape3D class. There doesn't seem to be a Material propertly like the T2DStateSprite.

How are you setting up your material now for your T2DShape3D object?
#11
07/28/2009 (10:31 am)
see that's my problem. I don't think you can do it.

Right now, I simply create a new material and change the appropriate material on the model (chest, head, legs, etc.).
Material 8 is the chest I believe.

T2DShape3D shape = (T2DShape3D)TorqueObjectDatabase.Instance.FindObject("wrestler");
Material m = new Material();

m.Name = "default.png";
shape.Shape.MaterialList[8] = m;