Game Development Community

Lighting DTS objects in space.

by Kevin Summers · in Torque Game Engine · 11/07/2007 (11:19 am) · 6 replies

I have a mission set up that is based in space.

My question is, how do you give the lighting effects of the sun, when the sun is
one of your DTS objects?

I've tried adding various lighting effects in the mission editor, but they aren't really
giving the effect that's needed. (ie, lighting up the other planets, and the other
planets casting shadows)

#1
11/07/2007 (12:26 pm)
There also seems to be a light source coming from below. However nothing is visible
and nothing is listed in the mission file. It must be a general light source built into the
engine. It's causing the bottoms of the planets to receive light.

Any ideas on how to shut that off?
#2
11/12/2007 (3:43 pm)
The lighting options available on DTS objects are used to tweak that object's lighting. You can achieve really cool self-illumination on your sun using these.

To cast lighting onto other objects you'll need to create a point mission light with a really large radius and place it in the same location as the DTS object that represents the sun.

Make sure to remove the sun mission object (not your sun DTS) from the mission, this is probably causing the unexpected lighting you're seeing.
#3
11/12/2007 (9:30 pm)
I was able to find the information to set up a light source within my sun that is now
casting the proper amount of light to the outer planets. Just need to figure out how
to make them cast shadows.

The actual Sun object from the mission was deleted. All the objects are still getting
some light from somewhere underneath them. I'm re-exporting the DTS objects from
GameSpace without the GameSpace lighting in the scene to see if that is the source
since the infinite lights in GameSpace are placed under the center of the objects by
default that seemed the most logical conclusion. If that doesn't do it, then it's got to
be something in TGE that's casting the light. There are still some switches I need to
play with in the DTS object that I'm creating. Something like "casts shadows" and
"receives sunlight" might be something worth looking at to see if those little things
that are bugging me go away. :-)
#4
11/13/2007 (1:28 pm)
I'm having a heck of a time with this.

I've got some planets specified through script that I can't get collision working with
unless I specify them as StaticShapes, and they currently are receiving light from some
source that I can't track down. Any help would be appreciated.

If there's some other object type I should be specifying for these planets, please let
me know. They can't be static because I'll be changing their position through script.

They are currently set up like this..

datablock ItemData(Sol)
{
gravityMod = 0;
lightType = noLight;
shapeFile = "~/data/shapes/Space/Sun.dts";
};

new Item(Sol)
{
collidable = true;
receiveSunLight = false;
receiveLMLight = false;
position = "0 0 0";
rotation = "0 0 0";
scale = "500 500 500";
datablock = "Sol";
};
#5
11/28/2007 (12:51 am)
Try changing the following code in sceneObject.cc line 1831:

SceneObject::LightingInfo::LightingInfo()
{
   mUseInfo = false;
   mDirty = false;
   mHasLastColor = false;

   // set the colors to half white for invalid surfaces and all...
[b][i]   mDefaultColor.set(0.0f, 0.0f, 0.0f);
   mLastColor.set(0.0f, 0.0f, 0.0f);[/i][/b]

   mLastTime = 0;
}

When no terrain or interior is below a DTS object env lighting is disabled and the default lighting color is used, setting it to {0, 0, 0} should remove any odd env light sources.
#6
11/28/2007 (9:59 am)
Sadly that didn't seem to do it.

Um, I take it back. I did a clean compile while doing something else and the
errant lighting went away.

Thanks.