Bug Fog Layer Color Doesn't Work
by Dan - · in Torque Game Engine · 02/01/2004 (10:23 am) · 29 replies
I have looked in my release 1.2.0 and the head and in both cases the fog layers color are not set. Instead the fog layers us the main fog color.
from the .mis file:
I have tried my best as a fairly new person to debug into the C++ code what I have found is:
- The Alpha (the 4th parameter) is ignored and set to odd values because it is never initilized. Sky::Sky() initilizes the other values but not the .alpha. Also the .alpha is part of the color structure but never passed from the .mis file to the engine.
- It appears the the other colors ARE referenced in the code and used for calculations. For the live of me I can't figure out where the disconnect is.
The current head has for these values (from starter.fps):
I have search the forums and over time the fog layer color seems to have been broken and then fixed.
So the am I missing something, are these values on the way out or is this just another fog layer bug?
Thank you,
Dan
from the .mis file:
fogVolumeColor1 = "0.9000000 0.000000 0.000000 0.000000";
fogVolumeColor2 = "0.9000000 0.5000000 0.000000 1.000000";
fogVolumeColor3 = "0.9000000 0.9000000 0.000000 1.000000";Does not work and is ignored. Only the fogColoris used for setting the color.
I have tried my best as a fairly new person to debug into the C++ code what I have found is:
- The Alpha (the 4th parameter) is ignored and set to odd values because it is never initilized. Sky::Sky() initilizes the other values but not the .alpha. Also the .alpha is part of the color structure but never passed from the .mis file to the engine.
- It appears the the other colors ARE referenced in the code and used for calculations. For the live of me I can't figure out where the disconnect is.
The current head has for these values (from starter.fps):
fogVolumeColor1 = "128.000000 128.000000 128.000000 -222768174765569861149077900047473967104.000000";
fogVolumeColor2 = "128.000000 128.000000 128.000000 0.000000";
fogVolumeColor3 = "128.000000 128.000000 128.000000 -170698929442160049016675429178998259712.000000";Which seems to be way off from the way it was suppost to work.I have search the forums and over time the fog layer color seems to have been broken and then fixed.
So the am I missing something, are these values on the way out or is this just another fog layer bug?
Thank you,
Dan
#22
Thanx for your (and that of the other contributers) patience.
02/03/2004 (11:46 am)
Thanx a million. I think I'm on track now, finally. I'm going to change Sky.cc to use the fogvolumecolors and (maybe allow for the percentage from script also). (I'll post back to share if I get it working acceptably).Thanx for your (and that of the other contributers) patience.
#23
There are some "effects" that would be nice to have the fog layers have different colors. Looks like Matthew might have a patch before I finish hunting it down.
Thanks your help.
02/03/2004 (2:53 pm)
I orginally made this thread because I was under the impression that at one time it did work. From the docs I have found that time was Tribes 2 (pre-torque) There are some "effects" that would be nice to have the fog layers have different colors. Looks like Matthew might have a patch before I finish hunting it down.
Thanks your help.
#24
02/04/2004 (9:49 am)
Dan, I'm giving it a go. Expect feedback in a week or so.
#25
Thanks for you help.
02/04/2004 (2:16 pm)
I "gave it a go" last night. Learned a lot about the engine, but didn't get closer to a solution. Thanks for you help.
#26
So here's a fix that gives three fog colours ...
Find the section in buildFogTextureSpecial that goes...
and replace it with...
I've tested this and it seems to work fine, but I'd appeciate someone else giving it a run because my code has a lot of other changes in it which could be affecting fog (Daylightcycle).
Also, the code needs a tweak for MAC (if you look at the buildFogTexture routine you'll see what I mean), which I haven't done.
And remember, this code is only executed when the specialFog flag is set in console or script.
I've also cleaned up the routine, but those changes are cosmetic. If you'all agree this works, I'll submit the whole routine as a fix, hopefully with the MAC tweak too.
02/17/2004 (9:26 am)
Ok, I finally got a chance to look at this. Seems the bug is in the sceneGraph.cc routine called buildFogTextureSpecial, where the ColorI is created. The multiply by 255 is superflous as the array is loaded with valid rgb colours already, not percentages.So here's a fix that gives three fog colours ...
Find the section in buildFogTextureSpecial that goes...
ColorI c((S32)(hazePct * ffogColor.red + bandPct * (array[0].red * 255)),
(S32)(hazePct * ffogColor.green + bandPct * (array[0].green * 255)),
(S32)(hazePct * ffogColor.blue + bandPct * (array[0].blue * 255)),
(S32)((hazePct + bandPct) * 255));and replace it with...
ColorI c((S32)(hazePct * ffogColor.red + bandPct * array[0].red), (S32)(hazePct * ffogColor.green + bandPct * array[0].green), (S32)(hazePct * ffogColor.blue + bandPct * array[0].blue), (S32)((hazePct + bandPct) * 255));
I've tested this and it seems to work fine, but I'd appeciate someone else giving it a run because my code has a lot of other changes in it which could be affecting fog (Daylightcycle).
Also, the code needs a tweak for MAC (if you look at the buildFogTexture routine you'll see what I mean), which I haven't done.
And remember, this code is only executed when the specialFog flag is set in console or script.
I've also cleaned up the routine, but those changes are cosmetic. If you'all agree this works, I'll submit the whole routine as a fix, hopefully with the MAC tweak too.
#27
02/17/2004 (2:44 pm)
I'm getting 3 diff fogs now, but changing the values doesn't seem to affect them. Other than changing the main value, which changes layer 1.
#28
If I get a chance I will upload some screen shots.
02/17/2004 (4:26 pm)
The fogs didn't work in my local version. The current head download did have some effect, but it wasn't great. When looking down or looking up you would not see the fog color you were in. It was clear. Walking forward and back seemed to work ok. Decreasing the distance you could see seemed to help a bit.If I get a chance I will upload some screen shots.
#29
(The three layers do appear, but only as terrain colouring, and not for the layer you are in).
The change above is a step in the right direction, but it's a long way from the complete solution. (Another oddity in that routine... Why does it use the base fogcolor at all? The array called 'array' contains the fogvolume colours we need).
Further, it seems the three fogvolume colour system has only been implemented for terrain. One can test this by changing the base fogcolor to something obvious (like bright red) while leaving the specialFog flag on to activate the three fogvolumes.
TSStatic, Interior, StaticShape, ShapeBase, Sky, and the Water classes, all show red fog, so it seems all these only use the base fog colour.
Unless I'm hopelessly mistaken, this is not so much a bug, but an imcomplete implementation... Does anyone know if T2 allows three different coloured fog layers? ie. was the code ripped or just never finished?
I doubt I'll have the engine knowhow or time to tackle such a big change anytime soon, but if it had to be done, what would be required?
For starters:
1) a good understanding of the fog system is a must...
2) further work on the buildFogTextureSpecial routine... as mentioned above.
3) a getFogColor routine that returns the appropriate fogcolor for an object at the objects z, which is what seems to be missing in the classes listed above. (And then what about objects that span fog layers?)
Thoughts, suggestions... commiserations?
02/18/2004 (8:28 am)
Dan, Erik, others, I applied the changes to the latest head (as I should have done in the first place, sorry all) and got the same results you did :( (The three layers do appear, but only as terrain colouring, and not for the layer you are in).
The change above is a step in the right direction, but it's a long way from the complete solution. (Another oddity in that routine... Why does it use the base fogcolor at all? The array called 'array' contains the fogvolume colours we need).
Further, it seems the three fogvolume colour system has only been implemented for terrain. One can test this by changing the base fogcolor to something obvious (like bright red) while leaving the specialFog flag on to activate the three fogvolumes.
TSStatic, Interior, StaticShape, ShapeBase, Sky, and the Water classes, all show red fog, so it seems all these only use the base fog colour.
Unless I'm hopelessly mistaken, this is not so much a bug, but an imcomplete implementation... Does anyone know if T2 allows three different coloured fog layers? ie. was the code ripped or just never finished?
I doubt I'll have the engine knowhow or time to tackle such a big change anytime soon, but if it had to be done, what would be required?
For starters:
1) a good understanding of the fog system is a must...
2) further work on the buildFogTextureSpecial routine... as mentioned above.
3) a getFogColor routine that returns the appropriate fogcolor for an object at the objects z, which is what seems to be missing in the classes listed above. (And then what about objects that span fog layers?)
Thoughts, suggestions... commiserations?
Torque Owner Nicolas Quijano
As he's probably the most accessible GG employee (via the forums or IRC/IM) atm. Don't know if there are any interns there atm, but they can be also be good contacts.
I'm not saying the rest of GG aren't accessible, to the contrary, but they're busy and can't be accepted to follow up on all bug reports, as alas, they do contain a lot of noise, or repetitions of old issues (not saying this is the case)
The link I pointed you to shows you how to set up Fog, and the 3 fog layers (aka volumes). What more do you want ?
ie Obviously, those values are getting set and getting sent through the pack/unpack methods, as you can modify the fog layers in real time in the Mission Editor.
As I've been saying, afaik and iirc, the different color thingies have never worked since Torque's initial release, and everyone has been using them, using one fog color for all for in the level/mission.
I can't help you farther than that, as I said before, 'cause I haven't hacked that part of the code at all :)
And I suspect that for anyone to help you on this particular issue (remember that everyone who worked on the Dynamix Engine is not at GG, but lot of their code is in Torque), they're going to have to do what you or me do, that is jump into the code, and figure it out for themselves :)
Have fun ! (and no, no harm taken, or given ;))