A question about fxLight..
by Jonathan Tarbox · in Torque Game Engine · 09/15/2002 (1:23 am) · 10 replies
Well, as Wendell was doing, I am working on a space scene within the torque engine and I'm working on using the fxLight as a basis for a fxDistantStar object. Firstly, I want to work out some querks I'm running into before I continue on..
In my game, I'm going to have 3 initial modes of play. And RTS type mode (simular to Homeworld which I can probably do well with a camera view), a space flight combat mode (simular to wing commander/freespace which I can do with a player mode), and I want's to be able to have the classic behind-the-ship space flight combat mode as well (simular to SW: Starfighter/Jedi Starfighter).
Well, temporarilly using Wendell's mission for star data and setting up the fxLightDB's, I'm seeing everything properly in FPS mode (which will turn into the space flight sim mode), but the third person mode is the problem... The stars are rendering OVER the player model (yeah, it's still the stock player model.. I just bought my license 2 days ago so I'm just getting into the feel of things)
I've tried altering the sort setting in the prepRenderImage().. BeginSort and Normal have no effect. I've tried altering the Transparency boolean in prepRenderImage().. No effect. I've tried commenting out the ControlObj->disableCollision()/enableCollision() in TestLOS().. that did effect the stars.. it turned em all off! =) Kinda figured that might since the control object is centered at the castray()'s begin point.
However, it's 3am and I'm running low on ideas. So, I'm posting and hoping someone can give me some pointers.. that and maybe a few hours of sleep should help a bit.
-jtarbox
(note i'm doing these alterations in both the fxLight and fxLightDB files at the same time.)
In my game, I'm going to have 3 initial modes of play. And RTS type mode (simular to Homeworld which I can probably do well with a camera view), a space flight combat mode (simular to wing commander/freespace which I can do with a player mode), and I want's to be able to have the classic behind-the-ship space flight combat mode as well (simular to SW: Starfighter/Jedi Starfighter).
Well, temporarilly using Wendell's mission for star data and setting up the fxLightDB's, I'm seeing everything properly in FPS mode (which will turn into the space flight sim mode), but the third person mode is the problem... The stars are rendering OVER the player model (yeah, it's still the stock player model.. I just bought my license 2 days ago so I'm just getting into the feel of things)
I've tried altering the sort setting in the prepRenderImage().. BeginSort and Normal have no effect. I've tried altering the Transparency boolean in prepRenderImage().. No effect. I've tried commenting out the ControlObj->disableCollision()/enableCollision() in TestLOS().. that did effect the stars.. it turned em all off! =) Kinda figured that might since the control object is centered at the castray()'s begin point.
However, it's 3am and I'm running low on ideas. So, I'm posting and hoping someone can give me some pointers.. that and maybe a few hours of sleep should help a bit.
-jtarbox
(note i'm doing these alterations in both the fxLight and fxLightDB files at the same time.)
#2
the fxSunLight, what are the differences? I'll go check it out in a min...
Basically, I'm trying to make lil bits of lights all over the place of different colors and sizes to represent a starfield.
What part of the code did you alter for 3rd person? And how would I confirm if the player model has a collision box in 3rd person?
-jtarbox
09/15/2002 (10:49 am)
Well, I can't say much for Wendell's version of fxLight, but I have tried with the zip file I downloaded from here yesterday and it does the same.the fxSunLight, what are the differences? I'll go check it out in a min...
Basically, I'm trying to make lil bits of lights all over the place of different colors and sizes to represent a starfield.
What part of the code did you alter for 3rd person? And how would I confirm if the player model has a collision box in 3rd person?
-jtarbox
#3
I believe fxLight to be what I need, or at least a basis for what I need. As mentioned, I'm just generating a star field. As it's possible to see a ton of em on the screen at once, they are typically fairly tiny effects except when nearer the camera.
hmm.. So, the model used for third person view, what type would it be for the castRay to check against? I toyed with adding some, but it didn't work. Guess I'll toy some more..
-jtarbox
09/15/2002 (11:02 am)
Ok, I took a look at fxSunLight, and it looks no different from fxLight except for some of the animation effects.. I'm not using animations.I believe fxLight to be what I need, or at least a basis for what I need. As mentioned, I'm just generating a star field. As it's possible to see a ton of em on the screen at once, they are typically fairly tiny effects except when nearer the camera.
hmm.. So, the model used for third person view, what type would it be for the castRay to check against? I toyed with adding some, but it didn't work. Guess I'll toy some more..
-jtarbox
#4
ok, just as a test, I commented out the if(1st person) disableCollision() for all lights.. and it still was not colliding with the player object, so that makes me think that the object type of the player is either setup wrong (I haven't altered it at all, my dir is a dupe of fps with a new mission file) or TestLOS isn't passing the right type into the mask.. currently, the default mask is:
static U32 losMask = STATIC_COLLISION_MASK |
ShapeBaseObjectType |
StaticTSObjectType |
PlayerObjectType;
which makes me believe is should catch it, but it doesn't. So, I guess, where is the model shown in third person get it's type set? Here's a sample image of the issue.. (atm, pretend the player model is a spaceship of some type):

So.. I guess I hunt around and try to figure out where the third person model is defining the type.
-jtarbox
09/15/2002 (11:43 am)
Ok, I saw your checks for ControlObj->isFirstPerson() which to me look like they just don't disable ControlObj's collision during the castRay() call...ok, just as a test, I commented out the if(1st person) disableCollision() for all lights.. and it still was not colliding with the player object, so that makes me think that the object type of the player is either setup wrong (I haven't altered it at all, my dir is a dupe of fps with a new mission file) or TestLOS isn't passing the right type into the mask.. currently, the default mask is:
static U32 losMask = STATIC_COLLISION_MASK |
ShapeBaseObjectType |
StaticTSObjectType |
PlayerObjectType;
which makes me believe is should catch it, but it doesn't. So, I guess, where is the model shown in third person get it's type set? Here's a sample image of the issue.. (atm, pretend the player model is a spaceship of some type):

So.. I guess I hunt around and try to figure out where the third person model is defining the type.
-jtarbox
#5
-jtarbox
09/15/2002 (11:45 am)
BTW, the image above is with the stock fxLight I had just downloaded. It doesn't have the size and color alterations the final star objects will have.-jtarbox
#6
The fxLight code is just that, a light that lights geometry within a specified distance. I also added the ability to create a lens flare at the same position to give it that extra nice look. The fxLights exist at an absolute position and so if you require them to be at an unreachable distance then you need to constantly move them in relation to the camera.
The fxSunLight differs in a few critical ways. Firstly, it does not have any lighting. Secondly, it's still got the lens flare effect but also has the ability to render a local and remote image both of which are optional. The local one is occluded by objects around you but the remote one is not and is useful when you want to still see the remote object but have a local lens flare come on and off as you pass by objects.
The fxSunlight is more of a cut-down fxLight object and can be controlled in almost an identical fashion.
If all you are doing is rendering a star-field then you have to remember that these objects are not the best way to do that and so you are hacking it to fit.
If you require a star-field that will always be rendered then the fxSunLight would be the best choice of the two.
A better way would be to have the star-field rendered by a single object, especially if you are creating lots of stars, as that would be much faster.
With regards to the LOS tests, the fxLight does work as I've just tried it. Try it with an unmodified SDK.
Hope this helps,
- Melv.
09/15/2002 (11:47 am)
Johnathan,The fxLight code is just that, a light that lights geometry within a specified distance. I also added the ability to create a lens flare at the same position to give it that extra nice look. The fxLights exist at an absolute position and so if you require them to be at an unreachable distance then you need to constantly move them in relation to the camera.
The fxSunLight differs in a few critical ways. Firstly, it does not have any lighting. Secondly, it's still got the lens flare effect but also has the ability to render a local and remote image both of which are optional. The local one is occluded by objects around you but the remote one is not and is useful when you want to still see the remote object but have a local lens flare come on and off as you pass by objects.
The fxSunlight is more of a cut-down fxLight object and can be controlled in almost an identical fashion.
If all you are doing is rendering a star-field then you have to remember that these objects are not the best way to do that and so you are hacking it to fit.
If you require a star-field that will always be rendered then the fxSunLight would be the best choice of the two.
A better way would be to have the star-field rendered by a single object, especially if you are creating lots of stars, as that would be much faster.
With regards to the LOS tests, the fxLight does work as I've just tried it. Try it with an unmodified SDK.
Hope this helps,
- Melv.
#7
-jtarbox
09/15/2002 (11:54 am)
I'll try out the fxSunLight, as I truely only want the flare effect. However, I'm still having the problem shown in the above image with stock cvs download of 1_1_2 and the latest fxLight.-jtarbox
#8
I've just tried it on two pc's here on R1_1_2 and it works fine.
I'm a little confused here. Are you using an unmodified fxLightDB and putting it in-place using the editor or are you using some automated way?
- Melv.
09/15/2002 (12:20 pm)
Johnathan,I've just tried it on two pc's here on R1_1_2 and it works fine.
I'm a little confused here. Are you using an unmodified fxLightDB and putting it in-place using the editor or are you using some automated way?
- Melv.
#9
new fxLightDB("BETELGEUSE") {
position = "98.5214890511662 4610.17473578382 599.234863585027";
rotation = "1 0 0 0";
scale = "1 1 1";
// The fxDefaultLight looks identical to your example one
dataBlock = "fxDefaultLight";
Enable = "1";
IconSize = "1";
// Wendell's star info data, which with a
// default fxLight install does nothing
HD = "39801";
vmag = "0.4";
sptype = "M0";
ScolorI = "4287614207";
lum = "-5.37250936458732";
ly = "465";
AppPixelsize = "0.04";
dan1 = "244.035469016144";
daz = "386.770153562742";
dao = "612.989383428729";
datwo = "971.522700847128";
dathree= "1539.75971489405";
dafour = "2440.35469016144";
};
09/15/2002 (12:34 pm)
I'm using 1_1_2 and an unmodified fxLight.. the lights are being placed within the mission file (so they are really fxLightDB's).. here's a sample star (taken from wendell's mission file till I get my own implementation done)new fxLightDB("BETELGEUSE") {
position = "98.5214890511662 4610.17473578382 599.234863585027";
rotation = "1 0 0 0";
scale = "1 1 1";
// The fxDefaultLight looks identical to your example one
dataBlock = "fxDefaultLight";
Enable = "1";
IconSize = "1";
// Wendell's star info data, which with a
// default fxLight install does nothing
HD = "39801";
vmag = "0.4";
sptype = "M0";
ScolorI = "4287614207";
lum = "-5.37250936458732";
ly = "465";
AppPixelsize = "0.04";
dan1 = "244.035469016144";
daz = "386.770153562742";
dao = "612.989383428729";
datwo = "971.522700847128";
dathree= "1539.75971489405";
dafour = "2440.35469016144";
};
#10
datablock fxLightData(fxDefaultLight)
{
LightOn = true;
Radius = 2.0;
Brightness = 1.0;
Colour = "1 1 1";
FlareOn = true;
FlareTP = true;
FlareBitmap = "common/lighting/corona";
FlareColour = "1 1 1";
ConstantSizeOn = false;
ConstantSize = false;
NearSize = 1.0;
FarSize = 0.05;
NearDistance = 0.005;
FarDistance = 40.0;
FadeTime = 4.0;
BlendMode = 0;
AnimColour = false;
AnimBrightness = true;
AnimRadius = false;
AnimOffset = false;
AnimRotation = false;
LinkFlare = true;
LinkFlareSize = false;
MinColour = "1 1 1";
MaxColour = "1 1 1";
MinBrightness = 1.0;
MaxBrightness = 1.0;
MinRadius = 0.1;
MaxRadius = 0.5;
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MinRotation = 0;
MaxRotation = 10;
SingleColourKeys = true;
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RadiusKeys = "AZA";
OffsetKeys = "AZA";
RotationKeys = "AZA";
ColourTime = 1.0;
BrightnessTime = 4.0;
RadiusTime = 5.0;
OffsetTime = 5.0;
RotationTime = 5.0;
LerpColour = false;
LerpBrightness = false;
LerpRadius = false;
LerpOffset = false;
LerpRotation = false;
};
again, this is from Wendell's space settings, just trying to get it working in all view modes (as I plan on using all)
-jtarbox
09/15/2002 (12:45 pm)
ok, scratch that, it's a lil different..datablock fxLightData(fxDefaultLight)
{
LightOn = true;
Radius = 2.0;
Brightness = 1.0;
Colour = "1 1 1";
FlareOn = true;
FlareTP = true;
FlareBitmap = "common/lighting/corona";
FlareColour = "1 1 1";
ConstantSizeOn = false;
ConstantSize = false;
NearSize = 1.0;
FarSize = 0.05;
NearDistance = 0.005;
FarDistance = 40.0;
FadeTime = 4.0;
BlendMode = 0;
AnimColour = false;
AnimBrightness = true;
AnimRadius = false;
AnimOffset = false;
AnimRotation = false;
LinkFlare = true;
LinkFlareSize = false;
MinColour = "1 1 1";
MaxColour = "1 1 1";
MinBrightness = 1.0;
MaxBrightness = 1.0;
MinRadius = 0.1;
MaxRadius = 0.5;
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MinRotation = 0;
MaxRotation = 10;
SingleColourKeys = true;
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RadiusKeys = "AZA";
OffsetKeys = "AZA";
RotationKeys = "AZA";
ColourTime = 1.0;
BrightnessTime = 4.0;
RadiusTime = 5.0;
OffsetTime = 5.0;
RotationTime = 5.0;
LerpColour = false;
LerpBrightness = false;
LerpRadius = false;
LerpOffset = false;
LerpRotation = false;
};
again, this is from Wendell's space settings, just trying to get it working in all view modes (as I plan on using all)
-jtarbox
Associate Melv May
The fxLight(DB) code I wrote wasn't really designed for what you are using it for. You might be better off using the fxSunLight to create star effects. It's fields and functions are almost identical to the fxLights'.
In either case, the line-of-sight tests do work in both the first and third person views. If you can see a flare through any objects then it normally means they don't have any collision boxes defined. Either that or the code you are using is prior to the amendment I made on 23/5/02 that allowed flares in third-person.
Hope this helps,
- Melv.