Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Strange fog problem

Author
Message
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 26th Feb 2011 16:50
Hi
I have my game up and running nicely but I have a slight problem with my fog.
The area in front of me looks nice and foggy but the area off to either side isn't a foggy and I can see buildings through the fog which I can not see if I turn and face the buildings directly.

It seems like the fog is applied in an oval shape with me at the centre so that things to either side can be seen through less fog but things directly in front of me can't be seen at all.

I'm not sure what to do about this or what the problem really is. Is it a camera aspect ratio problem? or something else?

Any help would be appreciated
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Feb 2011 17:54
Sample code?
Screenshot?
DBPro version?
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 26th Feb 2011 20:19
that makes 2 of us who would like to have a looky

If a thought is Just a thought ~ so whats the main thought ?
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 26th Feb 2011 21:09
Ok some more info.

I'm using the latest version of dbpro 7.7 I believe - it's the one that fixes the problem with win 7 service pack 1 though it has happened in all versions I've used

fog code =
set camera range 1,500
fog on
fog distance 400
fog color rgb(25,0,0)

Pic one attached
The object is directly in front of the camera but is almost totally obscured by fog (notice heading of 0 degrees)
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 26th Feb 2011 21:10
Turning just 40 degrees to the right makes the object much more visible
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 26th Feb 2011 21:12
or 40 degrees left.

I'm viewing this on a wide screen monitor 1920 * 1080 and am wondering if this makes any difference?
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 26th Feb 2011 21:15
When I use my eyefinity setup (3 x 1920 * 1080) = 5760*1080 the problem is much worse. It's almost as if there is no fog to the sides of the view and it is all in front.
You can see a craft approaching from the side but if you turn to face it, it disappears into the fog to become totally invisible before appearing slowly after a few seconds. It just makes the thing look really rubbish.

Do you think it has anything to do with the camera aspect ratio? or a fog problem? or what?
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 26th Feb 2011 21:44
ummm it would seem to me that it clearly is a distance thing

my guess is either dbp or the video card is
if it is out side the range you you are facing
then it should not show the object

Adrian could you please upload every thing
so I can find out if it's windows or dbp or both
that are not getting the message you want to project

If a thought is Just a thought ~ so whats the main thought ?
Mr Bigger
21
Years of Service
User Offline
Joined: 31st Jan 2005
Location: was here!
Posted: 26th Feb 2011 22:20 Edited at: 2nd Mar 2011 19:13
You might find this a useful read.
http://msdn.microsoft.com/en-us/library/bb206336%28v=vs.85%29.aspx

I think you can minimize the effect by setting the near fog value to a negative number but it would envelope the camera in the fog.
Could be usefull in some situations.


As a side note i think i remember a fog shader
made by Evolved probably. It could be worth searching for.

AMD 2600+/1GB ram/GeForce 6600oc 256MB/W2KPro/DBPro 6.6.b
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Feb 2011 00:59 Edited at: 27th Feb 2011 00:59
There is a problem with fog with the latest update. Perhaps this is related? I'll investigate tomorrow.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 27th Feb 2011 01:39
You could try setting SET CAMERA ASPECT to something like 1.77 and see what that does.

You can also mess with field of view, since you are using a widescreen resolution. It might make a difference.

Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 27th Feb 2011 12:35
Hi and thanks for the replies.

Quote: "
Adrian could you please upload every thing
so I can find out if it's windows or dbp or both"


I would love to but the project is very large and I don't think it would help much.

Quote: "You might find this a useful read.
http://msdn.microsoft.com/en-us/library/bb206336%28v=vs.85%29.aspx"

That looks exactly what is happening. Turning towards an object you can see pushes it back into the fog. I guess I'll start looking for a fog shader. I'm surprised no one has mentioned this sort of thing before though.
I have made the fog near distance negative, it help mask the effect a little but it's still pretty obvious though.


Quote: "There is a problem with fog with the latest update. Perhaps this is related? I'll investigate tomorrow. "

It's happened on several versions of DBPro, I just haven't bothered to ask about it before. There may well be a new problem but I don't think it's related to this one.

Quote: "You could try setting SET CAMERA ASPECT to something like 1.77 and see what that does.
"

Tried that but it made no difference unfortunately. Also messed around with the FOV, but nothing seems to make much difference.

I'm using a Radaeon 5770 using CCC 10.11
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Feb 2011 14:18
Quote: "Quote: "There is a problem with fog with the latest update. Perhaps this is related? I'll investigate tomorrow. "
It's happened on several versions of DBPro, I just haven't bothered to ask about it before. There may well be a new problem but I don't think it's related to this one."


I think you're right.

I haven't checked yet but as, others have suggested, I'm fairly sure your problem is the standard one with camera depth based fog (which I believe is the one used by the built-in DBPro commands) - i.e. objects a given distance from the camera but in peripheral vision will have low depth values compared to those directly in front of the camera. The only satisfactory way of dealing with that is to use distance based fog which needs a shader as others have said.

Quote: "I'm surprised no one has mentioned this sort of thing before though."


I'm sure they have - but it's the sort of thing that is obvious in some scenes and not others. It wouldn't be noticeable in a scene with a narrow field of view but would in a scene with a wide field of view for example.

Quote: "Also messed around with the FOV, but nothing seems to make much difference."


That should make a big difference. I'll knock up a demo to illustrate.
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 27th Feb 2011 14:44
Green Gandalf - how big a file ?

I know DBP forum has a max file size of 50 megs
I saw one persons post ware they uploaded it in peaces
of that amount

but you could use
http://www.mediafire.com/

you do not have to create and account to upload a file
and from I read the max upload is a 2gb file
or it could be broken down into smaller files

If a thought is Just a thought ~ so whats the main thought ?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Feb 2011 15:42
Why do you need a big file to demonstrate this problem?

Surely a simple demo using spheres and boxes or cubes in place of the "real" buildings and objects would suffice?

Actually, I've had to use some fairly extreme values to see a problem at all. I think it would help a lot if Adrian posted a complete simple demo of his problem.
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 27th Feb 2011 20:53
The complete thing is over 3000 lines of code which is too much for most people to plough through for a relatively simple problem.

I will try to get a small demo together over the next day or two to demonstrate the problem, but I'm quite busy at the moment.

The FOV commands did make a difference, but when using a 5760*1080 screen you still get quite a severe problem. With a much narrower field of view it makes the game much harder to play too. I'm hoping to use a 90 degree field if I possibly can.

I was just hoping there might have been a simple solution. At least I know why it's happening now.
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 27th Feb 2011 21:38
OK, Here's a very quick hack version to demonstrate what is going on.



Use arrow keys to turn. As you turn, I see the cube disappear when it is in front of me, and reappear when it is to the side.
Does everyone see this?
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 28th Feb 2011 05:40
it seems the setting
"fog distance -10,400"

when I changed the number to 450 then I could see the block
better and if I went down to 420 then it it was not so easy to see

but much better than the current 400 setting

If a thought is Just a thought ~ so whats the main thought ?
sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 28th Feb 2011 17:58
I think it is a distance thing, when you turn the camera you are not turning in a true ark.
renny

Life is not fair, so deal with it.
http://www.gusroundtable.com/
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 28th Feb 2011 18:43
I started playing with fog and I'm seeing this too. It's not that the camera isn't moving in an arc, it's that the fog isn't being projected in an arc. It's taking the direction of the camera, going out the SET FOG DISTANCE value, and projecting the fog in a straight line along that plane. The fog plane needs to be curved to appear properly.

I'm seeing this effect in the huge terrain demo for Blitzwerks Terrain, and it really stands out as a flat plane of fog when you turn the camera.

Mr Bigger
21
Years of Service
User Offline
Joined: 31st Jan 2005
Location: was here!
Posted: 28th Feb 2011 18:53 Edited at: 28th Feb 2011 18:57
Quote: "Does everyone see this?"


I see it in all games that use vertex fog.

Quote: "fog distance -10,400"


Sorry Adrian, I meant a large negative value,say... -5000

In the spirit of trying to be helpfull i said Evolved but i was mistaken, it was CuCumber that made the shader i was thinking of.

and here is the link.

http://forum.thegamecreators.com/?m=forum_view&t=120873&b=1

AMD 2600+/1GB ram/GeForce 6600oc 256MB/W2KPro/DBPro 6.6.b
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 1st Mar 2011 01:17
what it sounds like is that the fox command is flawed
instead of it being circular it is oval

even by increating the distance that
still means it stuck with the same problem

If a thought is Just a thought ~ so whats the main thought ?
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 1st Mar 2011 01:22
Quote: "what it sounds like is that the fox command is flawed
instead of it being circular it is oval

even by increating the distance that
still means it stuck with the same problem
"

Fog is circular by nature: the calculations are based on the distance of the vertex from the camera.

gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 1st Mar 2011 01:27
ya you would think fox should be oval

so maybe thenerd there is bug in DBP that no one has rile know about
until now ?

If a thought is Just a thought ~ so whats the main thought ?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Mar 2011 12:56 Edited at: 1st Mar 2011 20:40
Yes, it should be circular. Doesn't look quite circular to me. Not sure why. It might be an error in the way aspect ratio is implemented.

Try this version of Adrian's snippet. (You may need to reduce the number of cubes on slower systems.)



Typical screenshot:



Edit I'm not convinced that the oval shape is genuine. Further investigation suggests that the control camera using arrowkeys command has an unexpected effect on camera orientation, even if you don't press any keys, which might be part of the problem. When I change the demo to fix that the oval shape becomes circular.

Edit2 Correction - it IS oval and it's nothing to do with fog. Try the following and measure the sphere before touching any keys. It seems the default camera aspect ratio is incorrect - on my laptop at least. I would expect it to be calculated from the computer's display dimensions.

The same snippet illustrates the camera orientation problem - press "c" to activate the control camera command and the camera's orientation suddenly changes - look at the displayed info (and also the sphere is instantly out of view). This feature ought to be mentioned in the Help file.

Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 2nd Mar 2011 16:47
Mr Bigger - thank you for the link I shall devour it's contents.

Green Gandalf - Your fog sphere displays exactly what I've been seeing (displayed in a much more elagant way than I explained it)

I guess it's time I learnt to use shaders then *gulp*
Unless you guys know different?
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 2nd Mar 2011 16:50
I not using the control camera with arrowkeys in my main program, just for the demo above, but I didn't know it altered the display like that. That seems rather bad to me. It's hard enough to work out what's going on in 3D space without the language playing tricks on you too.
Lucka
21
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 2nd Mar 2011 17:47
I'm a little surprised..
This problem with the built-in fog is normal.
It was like that since the first day of Dark basic..

It's exactly what GG said, the fog is calculated with the depth instead of the distance..
Years ago, with 4/3 monitor ratio, was less visible. With 16/9 or 16/10 resolution you see it more.
It was visible in a huge amount of commercial games years ago..
For example Raven's FPS.

There's nothing to do. Only using a distance based fog you can obtain something.


Sorry for my bad english guys..

Lucka - gawteam coder - www.gawgames.com
Adrian
22
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 3rd Mar 2011 20:24
The attached pic shows the extent of the fog problem when using Green Gandalf's program running in my Eyefinity setup. It looks more like a greasy thumbprint on the lens rather than fog. Definitely time to try something else.

@Lucka
Quote: "Sorry for my bad english guys.."

Your English is actually very good - no need to say sorry

Login to post a reply

Server time is: 2026-07-16 01:44:30
Your offset time is: 2026-07-16 01:44:30