Visibility underwater
by Simon Goodchild · in Torque Developer Network · 10/05/2007 (2:44 am) · 15 replies
Having read all through the forums, I've not managed to get quite what I'm after, can anyone help?
I would like visibility on the surface to be clear (or massively far away at least), but when you go underwater, visibility is not that great (20 to 30m for the sake of argument).
Fairly sure I need to use fog, but may not be right!
My water block is large (the game is set underwater primarily), with main settings of:
position: -1024 -1024 0
rotation: 1 0 0 0
scale: 2048 2048 200
and fog entries as follows:
new Sky(Sky) {
canSaveDynamicFields = "1";
position = "152 -32 0";
rotation = "1 0 0 0";
scale = "1 1 1";
materialList = "~/data/skies/sky_day.dml";
cloudHeightPer[0] = "0.1";
cloudHeightPer[1] = "0.2";
cloudHeightPer[2] = "0";
cloudSpeed1 = "0.001";
cloudSpeed2 = "0.001";
cloudSpeed3 = "0.001";
visibleDistance = "900";
fogDistance = "50";
fogColor = "0.8 0.8 0.9 1";
fogStorm1 = "0";
fogStorm2 = "0";
fogStorm3 = "0";
fogVolume1 = "4000 0 200";
fogVolume2 = "30 200 500";
fogVolume3 = "20 500 800";
fogVolumeColor1 = "128.000000 128.000000 128.000000 1";
fogVolumeColor2 = "128.000000 128.000000 128.000000 1";
fogVolumeColor3 = "128.000000 128.000000 128.000000 1";
windVelocity = "5 1 0";
windEffectPrecipitation = "1";
SkySolidColor = "0.6 0.6 0.6 1";
useSkyTextures = "1";
renderBottomTexture = "0";
noRenderBans = "0";
};
Can't get my head around it!!!
I would like visibility on the surface to be clear (or massively far away at least), but when you go underwater, visibility is not that great (20 to 30m for the sake of argument).
Fairly sure I need to use fog, but may not be right!
My water block is large (the game is set underwater primarily), with main settings of:
position: -1024 -1024 0
rotation: 1 0 0 0
scale: 2048 2048 200
and fog entries as follows:
new Sky(Sky) {
canSaveDynamicFields = "1";
position = "152 -32 0";
rotation = "1 0 0 0";
scale = "1 1 1";
materialList = "~/data/skies/sky_day.dml";
cloudHeightPer[0] = "0.1";
cloudHeightPer[1] = "0.2";
cloudHeightPer[2] = "0";
cloudSpeed1 = "0.001";
cloudSpeed2 = "0.001";
cloudSpeed3 = "0.001";
visibleDistance = "900";
fogDistance = "50";
fogColor = "0.8 0.8 0.9 1";
fogStorm1 = "0";
fogStorm2 = "0";
fogStorm3 = "0";
fogVolume1 = "4000 0 200";
fogVolume2 = "30 200 500";
fogVolume3 = "20 500 800";
fogVolumeColor1 = "128.000000 128.000000 128.000000 1";
fogVolumeColor2 = "128.000000 128.000000 128.000000 1";
fogVolumeColor3 = "128.000000 128.000000 128.000000 1";
windVelocity = "5 1 0";
windEffectPrecipitation = "1";
SkySolidColor = "0.6 0.6 0.6 1";
useSkyTextures = "1";
renderBottomTexture = "0";
noRenderBans = "0";
};
Can't get my head around it!!!
#2
to be larger than this:
especially as you have this value set to a ridiculous low amount:
Not very logical.
10/05/2007 (8:02 am)
I would not recommend this:Quote:fogVolume1 = "4000 0 200";
to be larger than this:
Quote:visibleDistance = "900";
especially as you have this value set to a ridiculous low amount:
Quote:fogDistance = "50";
Not very logical.
#3
@Ehab - it would be great to not have fog above ground, but fog underwater, thanks for your suggestion. I have found playing around with the stuff in sky it does effect underwater, but with odd results!!! [goes off to try out underwaterFog setting....]
10/05/2007 (10:04 am)
@Stephan - thanks, my lack of understanding! Probably explains some wierd happenings!@Ehab - it would be great to not have fog above ground, but fog underwater, thanks for your suggestion. I have found playing around with the stuff in sky it does effect underwater, but with odd results!!! [goes off to try out underwaterFog setting....]
#4
10/05/2007 (10:09 am)
Hmmm... can't see where underwaterFog is set. Is it in the "new Sky(Sky)" definition, or should it be added to my "new WaterBlock(Water)"? Have you got an example you can paste here? Many thanks!!
#5
10/05/2007 (11:48 am)
TGE ?
#6
10/05/2007 (12:52 pm)
Yep, version 1.5.2
#7
and i doubt it would have been introduced in 1.5, so it may be a red herring.
actually in the 1.3 waterblock object i don't see any fields related to underwater visibility;
you might continue experimenting with the sky fog. when you change the sky fog, do you see any effect underwater ?
10/05/2007 (1:02 pm)
Grepping through the 1.3 and 1.4 codebases, i don't see the string "underwaterFog" anywhere,and i doubt it would have been introduced in 1.5, so it may be a red herring.
actually in the 1.3 waterblock object i don't see any fields related to underwater visibility;
you might continue experimenting with the sky fog. when you change the sky fog, do you see any effect underwater ?
#8
I've found that part talking abt "underwaterFog" in the book "Game Programmer's Guide to Torque" (page 274 if u dont believe me) but I too can't manage to find it in TGE :-s
10/05/2007 (1:20 pm)
Well I've been trying to look for it too :-sI've found that part talking abt "underwaterFog" in the book "Game Programmer's Guide to Torque" (page 274 if u dont believe me) but I too can't manage to find it in TGE :-s
#9
I tested adding the variable in the waterblock but it doesn't seem to work.
I checked the code, and see no reference to underwaterFog either.
I'll check mor later.
10/05/2007 (11:20 pm)
Just checked in the book myself, I recalled something like that too.I tested adding the variable in the waterblock but it doesn't seem to work.
I checked the code, and see no reference to underwaterFog either.
I'll check mor later.
#10
So far a solution is using:
Using these values in FPS starter with waterblock "2048 2048 200" works fine.
Hope it helps.
10/06/2007 (12:24 am)
Ok, can't find info on it in my references, tested in console and underwaterfog is not recognized.So far a solution is using:
fogVolume1 = "50 0 200";where "50" is the viewing distance, "0" the bottom and "200" the water surface height.
Using these values in FPS starter with waterblock "2048 2048 200" works fine.
Hope it helps.
#11
One thing - I have some long .dts files (I know what you're going to say....!) - but I love 3ds Max and so tend to make objects and export them as .dts files - it's just so much more flexible and powerful than producing them with the packages available as DIFs.
What happens, with the visibility set to say '50' - and .dts files that are longer than the visibility don't display the texture for the whole .dts - even though they exist and you can collide with them.
Anyway around this other than use DIFs? (I'm assuming this is the problem, going to make a long DIF to check in a minute, will add a note to this post....)
Edit: ok, with a DIF you do get the whole interior to appear with it's texture, but I put in a 200m long white narrow box, with 50m fog, and if you stand (or float in the case underwater!) you can see the whole long interior for it's whole length, at the same "visibility" as at it's nearest point. I check by standing at the side of the long box, and moving away, and sure enough both ends of the box are the same visibility as the centre of the box (it's nearest point).
What I need, if for example I am in a large swimming pool say, is for the far end of the pool to disappear in the "fog", not be as visible as it's nearest point. I would make the pool is a single DIF.
10/06/2007 (3:23 am)
Thanks guys - Stephan - works perfectly! :)One thing - I have some long .dts files (I know what you're going to say....!) - but I love 3ds Max and so tend to make objects and export them as .dts files - it's just so much more flexible and powerful than producing them with the packages available as DIFs.
What happens, with the visibility set to say '50' - and .dts files that are longer than the visibility don't display the texture for the whole .dts - even though they exist and you can collide with them.
Anyway around this other than use DIFs? (I'm assuming this is the problem, going to make a long DIF to check in a minute, will add a note to this post....)
Edit: ok, with a DIF you do get the whole interior to appear with it's texture, but I put in a 200m long white narrow box, with 50m fog, and if you stand (or float in the case underwater!) you can see the whole long interior for it's whole length, at the same "visibility" as at it's nearest point. I check by standing at the side of the long box, and moving away, and sure enough both ends of the box are the same visibility as the centre of the box (it's nearest point).
What I need, if for example I am in a large swimming pool say, is for the far end of the pool to disappear in the "fog", not be as visible as it's nearest point. I would make the pool is a single DIF.
#12
10/06/2007 (4:20 am)
Hmm, well, I would really appreciate some screenshots of both cases... ;-)
#13

This grab shows a view from the end of a long DIF, notice how the visibility of the far end is the same as the near end.

This grab shows a side on view - as the nearest point is very similar right across if appears to fade out at the same rate, which is fine. The problem is when viewing "along" as in the other screenshot.
Hope these help. The long DIF was produced in Constructor, simple texture, and exported with map2dif export.
10/06/2007 (5:10 am)
Ok - some screenshots.
This grab shows a view from the end of a long DIF, notice how the visibility of the far end is the same as the near end.

This grab shows a side on view - as the nearest point is very similar right across if appears to fade out at the same rate, which is fine. The problem is when viewing "along" as in the other screenshot.
Hope these help. The long DIF was produced in Constructor, simple texture, and exported with map2dif export.
#14
The fog is set to a height of the water, that's why you can see a long way above - but I guess as the .dts is spanning above and below it gets effected. Underwater, .dts shapes "pop" into view as they enter the visibility distance (which I could live with when they are small shapes, but problem here as with the pool if they are big).
You can see the pool as it should show here (screenshots).
10/06/2007 (5:15 am)
Oh, and for the ".dts texture not showing if it's longer than the fog visibility issue", here's a screenshot of the swimming pool with the pool as a big .dts file (I know....!). With fog visibility set to less than the size of the pool, the textures are not showing at all (there should be a tiled area all around). However, you can still jump down and walk around on top of the .dts, so it's there and collision is working fine! The fog is set to a height of the water, that's why you can see a long way above - but I guess as the .dts is spanning above and below it gets effected. Underwater, .dts shapes "pop" into view as they enter the visibility distance (which I could live with when they are small shapes, but problem here as with the pool if they are big).
You can see the pool as it should show here (screenshots).
#15
10/07/2007 (1:38 am)
As the problem has changed from visibility underwater, I've set up a new thread. Thanks very much for all the help with the visibility underwater!
Torque Owner Ehab Yosry Amer