G3D Material – Giavapps 3D

 

G3D Material

 

Once initialized a GameMaker: Studio Object with g3d_object_init/() function you can then define the following Material properties for that instance:

 

g3d_material_set_emit(Object, Red, Green, Blue) Sets the Emit Material Colour value for the specified Object.

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_material_get_emit(Object, RedGreenOrBlue) Returns the Red, Green or Blue Emit Material 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_material_set_metallic(Object, Value) Sets the Metallic Material Value for the specified Object. This function has effect only if G3D_USING_DYNAMIC_NORMALS is defined inside the Giavapps 3D Shader script.

Object: A valid GameMaker: Studio Object ID.
Value: A value from 0 to 1+.

 

g3d_material_get_metallic(Object) Returns the Metallic Material Value assigned to the specified Object.

Object: A valid GameMaker: Studio Object ID.

 

g3d_material_set_specular(Object, Red, Green, Blue) Sets the Specular Material Colour for the specified Object. This function has effect only if G3D_USING_SPECULAR_REFLECTIONS is defined inside the Giavapps 3D Shader script. This function gives different results based on if G3D_USING_SPECULAR_REFLECTIONS_FRAGMENT is defined or not inside the Giavapps 3D Shader script. Usually the Fragment Shader version is slower but a lot better looking and it is suitable for effects like Phong Shading. The Vertex Shader version is faster and gives you a cool effect that could be used for things like crystals, metal and other shiny materials with pronounced geometry. Please note that for using the Vertex Shader Specular Reflections version you should manually comment the G3D_USING_SPECULAR_REFLECTIONS_FRAGMENT definition inside Vertex and Fragment Shader script otherwise you will get compilation errors.

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_material_get_specular(Object, RedGreenOrBlue) Returns the Specular Material Colour assigned to the specified Object.

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_material_set_shininess(Object, Value) Sets the Shininess Material Value for the specified Object.

Object: A valid GameMaker: Studio Object ID.
Value: A value from 0 to 1+.

 

g3d_material_get_shininess(Object) Returns the Shininess Material Value for the specified Object.

Object: A valid GameMaker: Studio Object ID.

 

Code Examples

 

Setting Materials

 

g3d_material_set_emit(id, 1, 0, 0);//Sets Red Emit Material Value
g3d_material_set_metallic(id, 0.02);//Sets Metallic Material Value
g3d_material_set_specular(id, 0, 0, 8);//Sets Blue Specular Material Colour
g3d_material_set_shininess(id, 20);//Sets Shininess Material Value

 

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 *

*