Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Frustrum + Foggin = Frustration  (Read 530 times)
xavram
Community Member
*
Posts: 481


« on: March 12, 2003, 05:31:03 PM »

Why isn't this working?  I'm using a mesh that acts like a skybox; in other words, its a large cube around the player that moves with the player and shows the sky in the distance.  Why not just use the standard TV Skybox?  Because I actually have 2 of these boxes and fade them in and out as I want to transition between one sky texture and another, like when you're moving from one region into another.  Works very well but I'm having a problem with fogging.

In theory, I thought I could set my frustrum very high, render my skybox, then set the frustrum down to reasonable level to only include the stuff I want the player's vision to include.  What's happening is, I'm losing my fog.  If I keep the frustrum as a given amount, my fog shows up fine but setting the frustrum to always be at 10000 results in a massive drop in FPS and I don't want the players to be able to see the landscape that far away anyway.  Here's the numbers I want.

Max viewing distance : 5000
Fog Minimum : 4000
Fog Maximum : 5000

This gives me the visual effect that I want but when I use the code like this...

Atmos.Fog_Enable False
  Scene.SetViewFrustrum 38, 10000
  SkyBox(1).Render
  SkyBox(2).Render
  Scene.SetViewFrustrum 38, 5000
Atmos.Fog_Enable True
Atmos.Atmosphere_Render

Code that renders the landscape and meshes

...I no longer see any fog.  The skybox renders fine but the landscape is cut off my just an abrupt line, not the fogging effect that I want.  If I modify the code like this...

  Scene.SetViewFrustrum 38, 5000 ' This only gets called once

Atmos.Fog_Enable False
  SkyBox(1).Render
  SkyBox(2).Render
Atmos.Fog_Enable True
Atmos.Atmosphere_Render

Code that renders the landscape and meshes

...then I get the fogging effect I want but parts of my skybox are cut off.  The skybox mesh is very large, about 10000x10000x10000.  If I make it smaller, then it cuts into my viewing range of 5000, so that's no good.

Any suggestions would be, as always, appreciated.
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4824


WWW
« Reply #1 on: March 12, 2003, 06:33:48 PM »

for the skybox, disable the Z Writting, it will prevent other meshs to be clipped by that.

Mesh.SetAlphaTest False, 0, False

It should fix part of the problem.

Also, fog might be not working correctly with different far planes in the same scene.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
xavram
Community Member
*
Posts: 481


« Reply #2 on: March 12, 2003, 11:11:46 PM »

Huh, never even seen that before...didn't realize SetAlphaTest had anything to do with that.  WIll give it a shot tomorrow and let you know if it helped at all.
Logged
xavram
Community Member
*
Posts: 481


« Reply #3 on: March 13, 2003, 01:23:18 PM »

That seems to have done the trick Sylvain, thanks...now can you explain exactly why that worked?  I guess I don't understand how the SetAlphaTest property works.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks