G3D Fog – Giavapps 3D

 

G3D Fog

 

PLEASE NOTE: these functions are available for GameMaker Studio 2 only!

gpu_set_fog(Enable, Colour, Start, End) function which you can find in GameMaker Studio 2 is not supported by Giavapps 3D Shaders since this function does not work correctly for Shaders at the moment (this feature could be added in the future). You can use g3d_fog_set() function instead.

 

g3d_fog_set(Enabled, Red, Green, Blue, Start, End) This function can be used to enable or disable fog drawing. Fog can be used in 3D games to make instances in the distance look blurred or even disappear, which helps in creating atmosphere as well as masking the fact that you are not drawing instances that are far away. You set whether it is enabled (true) or disabled (false), the colour that the fog should use for blending, as well as the start and end draw distances. Note that the fog start indicates the radius relative to the view camera where the fog starts, and the fog end indicates at which radius (also relative) instances will be completely invisible.

Enabled: Enables (true) or disables (false) fog drawing.
Red: Red component value from 0 to 1+.
Green: Green component value from 0 to 1+.
Blue: Blue component value from 0 to 1+.
Start: Start draw distance.
End: End draw distance.

 

g3d_fog_get(FogFlag) This function can be used to retrieve the fog settings.

FogFlag: fog flag.

FogFlag argument can be one of the following constants:

G3D_FOG_ENABLED Returns whether the fog is enabled (true) or disabled (false).

G3D_FOG_R Returns the red component value.

G3D_FOG_G Returns the green component value.

G3D_FOG_B Returns the blue component value.

G3D_FOG_START Returns the start draw distance.

G3D_FOG_END Returns the end draw distance.

 

Code Examples

 

Enabling Fog Drawing

 

g3d_fog_set(1, 1, 0, 0, 300, 1000);//enables fog drawing with the specified settings

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*