Shadow Map and Movers
by Devin Golberg · in Torque Game Engine · 09/19/2009 (5:01 pm) · 2 replies
Ok, I'll admit, I'm a bit of a noob when it comes to TGE. We're just learning the basics of it this quarter as part of our Game Design and Development course, but, I've run into a couple of snags. I've asked my instructor about it and he's fairly new to teaching TGE (hence why he's teaching the intro class) so we're nearly on the same level at the moment with the final project due this coming Tuesday.
Pretty much the majority of what we've been taught is simply how to add static shapes to torque, how to create/use triggers, how to create and spawn pickups, and how to create/use a projectile, and how to use the replicators/terrain editing tools to change the terrain height/texture blending.
Anyway, my first issue is:
I have some simple objects spread around the map using the fxShapeReplicator. These objects are rather large as far as actual mesh is concerned, but look much smaller in Torque due to the majority of them being transparent. The issue I'm having with the object is that, when I do a relight of the level, I get a huge blocky shadow from the object that pretty much hides the entire object when viewed from certain angles because of it's coloring and the lighting of the level. I need to either change the shadow that is baked to the terrain to recognize the transparent parts of the mesh (if this is even possible) or simply turn off the shadows on the shape replicator. I'd think there would be a simple on/off option for shadows, but I'm not finding anything about turning off shadows on replicated objects.
My second issue:
We've been taught how to create a character to replace the blue player model and how to create static shapes, but I'm unsure how to go about creating simple movers that can be triggered by the character such as doors using imported meshes. What I'm attempting to do is create an elaborate door that only opens when the player is in possession of the needed items to open it. The trigger part should be pretty easy for me, but I don't know what method would work best when importing the mesh to get it to move properly. I'm guessing I would create the object in a similar fashion as the player character then have the trigger activate a sequence on the object similar to:
sequence1 = "~/data/shapes/door/door.dsq open";
Will this also allow the collision to move to allow the player to pass through the door when it's open but not when it's closed? Or am I going at this all wrong? Anyway, I'm still working on modeling the door at the moment, so I'll try this when it's done unless someone knows of a better way of doing it.
Maybe I'm just missing something or stress is getting to me, but if anyone could point me to the solutions to these issues, it would be much appreciated. Just remember, I'm about as new to TGE as they come, and coding isn't exactly my specialty either, I can read code better than I can write it.
Pretty much the majority of what we've been taught is simply how to add static shapes to torque, how to create/use triggers, how to create and spawn pickups, and how to create/use a projectile, and how to use the replicators/terrain editing tools to change the terrain height/texture blending.
Anyway, my first issue is:
I have some simple objects spread around the map using the fxShapeReplicator. These objects are rather large as far as actual mesh is concerned, but look much smaller in Torque due to the majority of them being transparent. The issue I'm having with the object is that, when I do a relight of the level, I get a huge blocky shadow from the object that pretty much hides the entire object when viewed from certain angles because of it's coloring and the lighting of the level. I need to either change the shadow that is baked to the terrain to recognize the transparent parts of the mesh (if this is even possible) or simply turn off the shadows on the shape replicator. I'd think there would be a simple on/off option for shadows, but I'm not finding anything about turning off shadows on replicated objects.
My second issue:
We've been taught how to create a character to replace the blue player model and how to create static shapes, but I'm unsure how to go about creating simple movers that can be triggered by the character such as doors using imported meshes. What I'm attempting to do is create an elaborate door that only opens when the player is in possession of the needed items to open it. The trigger part should be pretty easy for me, but I don't know what method would work best when importing the mesh to get it to move properly. I'm guessing I would create the object in a similar fashion as the player character then have the trigger activate a sequence on the object similar to:
sequence1 = "~/data/shapes/door/door.dsq open";
Will this also allow the collision to move to allow the player to pass through the door when it's open but not when it's closed? Or am I going at this all wrong? Anyway, I'm still working on modeling the door at the moment, so I'll try this when it's done unless someone knows of a better way of doing it.
Maybe I'm just missing something or stress is getting to me, but if anyone could point me to the solutions to these issues, it would be much appreciated. Just remember, I'm about as new to TGE as they come, and coding isn't exactly my specialty either, I can read code better than I can write it.
#2
09/20/2009 (4:37 am)
Awesome! Thanks a ton for the script and link, you're a lifesaver! I'll tell my instructor about these, he might find them useful for future classes.
Torque Owner Bill Vee
First in fxShapeReplicator.h in the fxShapeReplicatedStatic class declaration find
void setTransform(const MatrixF & mat) { Parent::setTransform(mat); setRenderTransform(mat); };and after it addvoid setmTypemask(U32 type){mTypeMask -= type;};Then in fxShapeReplicator.cc in function void fxShapeReplicator::CreateShapes(void) find
and after it add
You could extend this by adding a PersistField variable to check to see if shadows should be used with the in game editor.
As for the door this should help a little.
Simple Scripted Doors