G3D Lighting – Giavapps 3D

 

GMS Lighting

 

Most relevant GameMaker Studio Lighting functions have been integrated and fully supported by our Giavapps 3D Shader. PLEASE NOTE: the final result may differ from the GameMaker Studio Lighting Engine but the concept behind these functions is almost the same so you can just refer to the GameMaker Studio manual for these functions.

GMS 2

draw_set_lighting(Enable) Supported.

draw_light_define_direction(Index, X, Y, Z, Colour) Supported.

draw_light_define_point(Index, X, Y, Z, Range, Colour) Supported.

draw_light_enable(Index, Enable) Supported.

draw_light_define_ambient(Colour) Supported.

GMS 1.4

d3d_set_lighting(Enable) Not supported. This feature does not work correctly for Shaders.

d3d_light_define_direction(Index, X, Y, Z, Colour) Supported.

d3d_light_define_point(Index, X, Y, Z, Range, Colour) Supported.

d3d_light_enable(Index, Enable) Supported.

d3d_light_define_ambient(Colour) Supported.

 

G3D Lighting

 

Once initialized a GameMaker: Studio Object with g3d_object_init() function, thanks to Giavapps 3D Lighting Engine you have also access to the following functions:

 

g3d_light_set_input_level(Object, Red, Green, Blue) Sets the Light Input Level for the specified instance. This function is very useful for colour correcting the shadows.

Object: A valid GameMaker: Studio Object ID.
Red: Red component value from 0 to 1.
Green: Green component value from 0 to 1.
Blue: Blue component value from 0 to 1.

 

g3d_light_get_input_level(Object, RedGreenOrBlue) Returns the Red, Green or Blue Light Input colour component assigned to the specified instance.

Object: A valid GameMaker: Studio Object ID.
RedGreenOrBlue: colour component to return.

RedGreenOrBlue argument can be one of the following values:

G3D_RED Returns the Red component.

G3D_GREEN Returns the Green component.

G3D_BLUE Returns the Blue component.

 

g3d_light_set_output_level(Object, Red, Green, Blue) Sets the Light Output Level for the specified instance. This function is very useful for colour correcting the highlights.

Object: A valid GameMaker: Studio Object ID.
Red: Red component.
Green: Green component.
Blue: Blue component.

 

g3d_light_get_output_level(Object, RedGreenOrBlue) Returns the Red, Green or Blue Light Output colour component assigned to the specified instance.

Object: A valid GameMaker: Studio Object ID.
RedGreenOrBlue: colour component to return.

RedGreenOrBlue argument can be one of the following values:

G3D_RED Returns the Red component.

G3D_GREEN Returns the Green component.

G3D_BLUE Returns the Blue component.

 

Code Examples

 

Setting up a Directional Light

 

d3d_light_define_direction(0, 0, 0, –1, c_white);//Sets a directional light
d3d_light_enable(0,1);//Enables the light otherwise we can’t see it!

 

Setting Light Input And Output Levels

 

g3d_light_set_input_level(id, 0.3, 0.3, 0.3);//Sets the Light Input Level
g3d_light_set_output_level(id, 1, 1, 1);//Sets the Light Output Level

 

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 *

*