Partially fog

Blitz3D Forums/Blitz3D Programming/Partially fog

Play(Posted 2004) [#1]
Hello. We are making a fishing game (like Trophy Bass etc.). Right now we are stuck with creating a fog which would be only underwater. When player throws his/hers bait into the water it would be nice to have a some kind of fog, simulating negative opacity of the water. However the fog is not recommended above the water. The problem is, that when we enalbe the fog on the camera the whole scene gets it (under and over the water surface) whether only underwater is desireable. I've tried dividing the scene with CameraViewPort func but didn't succeed.


Play(Posted 2004) [#2]
okey, my budy came with idea that worked :-)
here it is:

;render upper view(without fog)
CameraFogMode g_hNormalCamera, 0 ;turn of fog
HideEntity g_hUnderwaterScene
EntityAlpha g_hPlayer, 0 ;'HideEntity g_hPlayer
ShowEntity g_hAboveWaterScene
ShowEntity hWaterPlane
RenderWorld
CopyRect 0, 0, 1024, 768, 0, 0, BackBuffer(),ImageBuffer(g_hImageBufferUp)

;render down view (with fog)
CameraFogMode g_hNormalCamera, 1
EntityAlpha g_hPlayer, 1 ;'ShowEntity g_hPlayer
HideEntity g_hAboveWaterScene
HideEntity hWaterPlane
Showentity g_hUnderWaterScene
RenderWorld
CopyRect 0, 0, 1024, 768, 0, 0, BackBuffer(), ImageBuffer(g_hImageBufferDown)

; SetBuffer BackBuffer()
DrawImage g_hImageBufferUp, 0, 0
DrawImage g_hImageBufferDown, 0, 0


Beaker(Posted 2004) [#3]
That isn't the easiest way to do this.

Take a look at CameraClsMode() to avoid having to use 2 CopyRect commands and two DrawImage commands (the latter will be very slow).


IPete2(Posted 2004) [#4]
(1) You could look for the camera Y position, below a certain height switch on the fog in the camera, turn it off above that level.

(2) Use a second camera with the fog already set, and switch to viewing from that camera.

IPete2.


RifRaf(Posted 2004) [#5]
i think he wants to see the fog from any Y position.. but doenst want the fog to extend above the water


IPete2(Posted 2004) [#6]
oh okay

IPete2.


DarkEagle(Posted 2004) [#7]
disable fog for everything above the water?