Game Development Community

Sun/fxsunlight

by Dave · in Torque Game Engine Advanced · 04/20/2006 (4:57 am) · 10 replies

Hi folks,

Sorry if this question is already answered somewhere, but I've searched the forums, looked on TDN and checked the milestone plans and can't see the answer.

I saw that fxSunlight had been added to TSE so decided to play with it. I have a sun object and also an fxSunlight object in my mission. However, I can see no sun or any lens flare effects. All I get is flat general lighting.

Should I be able to see a sun object in TSE, or is this part of the dynamic lighting that has not yet been implemented?

Thanks a lot,

Dave.

#1
04/20/2006 (12:15 pm)
For myself, it works very well.
#2
04/20/2006 (3:04 pm)
Care to copy your sun/fxSunlight object's settings from the .mis in here?
#3
04/21/2006 (10:50 am)
Surely, appreciate any help you might be able to give.

new Sun() {
direction = "0 0.954268 -0.298953";
elevation = "35";
color = "1 1 0.8 1";
ambient = "0.4 0.4 0.5 1";
locked = "true";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
};

new fxSunLight(fxsun) {
position = "1140.77 667.938 271.406";
rotation = "1 0 0 0";
scale = "1 1 1";
Enable = "0";
LocalFlareBitmap = "common/lighting/corona";
RemoteFlareBitmap = "common/lighting/corona";
SunAzimuth = "0";
SunElevation = "30";
LockToRealSun = "1";
FlareTP = "1";
Colour = "1 1 1 1";
Brightness = "1";
FlareSize = "1";
LocalScale = "1";
FadeTime = "0.1";
BlendMode = "0";
AnimColour = "0";
AnimBrightness = "0";
AnimRotation = "0";
AnimSize = "0";
AnimAzimuth = "0";
AnimElevation = "0";
LerpColour = "1";
LerpBrightness = "1";
LerpRotation = "1";
LerpSize = "1";
LerpAzimuth = "1";
LerpElevation = "1";
LinkFlareSize = "0";
SingleColourKeys = "1";
MinColour = "0 0 0 1";
MaxColour = "1 1 1 1";
MinBrightness = "0";
MaxBrightness = "1";
MinRotation = "0";
MaxRotation = "359";
minSize = "0.5";
MaxSize = "1";
MinAzimuth = "0";
MaxAzimuth = "359";
MinElevation = "-30";
MaxElevation = "210";
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RotationKeys = "AZA";
SizeKeys = "AZA";
AzimuthKeys = "AZ";
ElevationKeys = "AZ";
ColourTime = "5";
BrightnessTime = "5";
RotationTime = "5";
SizeTime = "5";
AzimuthTime = "5";
ElevationTime = "5";
};

These are the defaults set when you add them to the mission. i added the elevation var to the sun as I saw it in another post. But it made no difference.

Thanks a lot,

Dave.
#4
04/21/2006 (6:13 pm)
You've got

Enable = "0";

Does it not work when Enable is set to true?
#5
04/22/2006 (3:56 am)
OK, excuse me while I quietly go out and hang myself. Thanks Max! What a bloody plonker I am. I looked through those settings a hundred times without seeing it.

I would go off and cringe for a while, except that now the flare is working, but I still don't see a sun. The flare is in the area where the sun should be. Changing the sun colours changes the colours on the landscape, changing the flare colour changes the flare. But there is no sun image itself. Unless there is a default sun image that is always white no matter what you do to the colour params?

Thanks,

Dave.
#6
04/22/2006 (2:43 pm)
Good! I'm glad there aren't any problems with it. I rehabilitated it for TSE, so it pleases me greatly to know it functions for everyone :)

The sun is never visible, I guess fxSunLight is the workaround for that. I would reccomend using a diffuse circular dot texture for the remote, and a bitmap similar like the current corona one for the local (or just use that one).

If you want to change the flare color, go ahead. There is a "Colour" field. Also, mess with Brightness, FlareSize, and LocalScale. Those will let you change the size so its big/small enough for your map.

And Enable is not set as false by default, is it?
#7
04/22/2006 (7:56 pm)
Like Max said, the sun is just a light vector, it's never visible.

The TGE demos and starter kits used 2 fxSunLight for drawing the sun. One would be small and very bright, acting as the sun itself, and the other would be just the corona/flare.
#8
04/23/2006 (3:05 am)
Thanks guys. Very helpful.

Max, I think I must have copied the initial code from an example somewhere on the forums or TDN. I've just deleted and added an fxSunlight object in the editors and it is set to enabled as default. So you can relax there :-) Thanks again. Great work on the resource!

Manoel, thanks, that sounds like a good path. I assume that route would leave me free to change the sun colour with the time of day, whereas a bitmap would not?
#9
04/23/2006 (7:56 pm)
Yeah, Melv designed the fxSunLight with the intent of allowing it to animate. Probably 3/4 or more of the fields on it are for animating.

There is a day/night resource for TGE, I'm not sure if that has been adapted for TSE at all.
#10
04/24/2006 (3:36 am)
Thanks Max, will check that out. Who knows, if it's not too complex I might be able to make something useful from it for the community.

Heh, just looked at this and it's wayyyy too scary for me at this stage of my learning process.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5417