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 / Problem with Fog!

Author
Message
Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 30th Mar 2011 10:33


Left Click to move forward , Right click to move backward.

So the problem is that I want the fog to keep a steady distance between the camera and the point it starts.
If you run the code above, you'll notice that when moving forward it gets darker, why is that ?
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Mar 2011 11:41 Edited at: 30th Mar 2011 11:51
I think it has to do with the fact that you are making one big object. If you make several smaller objects, it works fine.

Try this:


I would guess it is a matter of how many vertices are available for the fog system to spread out over. Lights work the same way, I think.

IanM's matrix utilities has a command that lets you build a single large plane object with many vertices. Also DBPro has terrain matrix commands that build a similar object. But IanM's is easier to work with.

EDIT: Hmm... even with 10 planes, there is still a brightness change on each plane as the camera goes by. Using 100 planes evens it out.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 30th Mar 2011 11:59
Yup, Rich has it - fog and colouring are really just alterations to vertex diffuse colouring. So if a polygon is too big, fog and lighting won't be very accurate or pretty.

Health, Ammo, and bacon and eggs!
Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 30th Mar 2011 15:22 Edited at: 30th Mar 2011 15:29
Well, thanks.

But I believe that this problem isn't affected by polygons, to be more clear , I attached a small project where the problem can be noticed..
The fog effect is good, but when the camera moves, why the fog doesn't move ? That's the problem .

Mouse click to move
Shift/Control to switch fog
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Mar 2011 16:53 Edited at: 30th Mar 2011 16:58
Well, okay, but did you run the code I posted?

Try running this version of your project...



If you turn off the fog, you will see that your hall object uses really long polygons, with no vertices between the beginning and end.

Again, it's the number of vertices that matter here. The fog needs more vertices to be able to map the color change to the hallway.

I'm speaking from experience here, I was working on a big 3D dungeon, and I thought, "Why put a separate small floor tile on each dungeon segment? Why not just put a big floor poly down and scale the texture?" And this is why it didn't work.

Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 30th Mar 2011 17:26
I increased the object's polygons and the problem was solved ..
thanks man.
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Mar 2011 17:45
You're welcome! Glad it was that easy.

Login to post a reply

Server time is: 2026-07-11 14:57:07
Your offset time is: 2026-07-11 14:57:07