A constructor defined in BBMOD_ReflectionProbe.gml
Implements BBMOD_IDestructible
new BBMOD_ReflectionProbe([_position[, _sprite]])
Used to capture surrounding scene at a specific position into a texture which is then used for reflections.
Name | Type | Description |
---|---|---|
_position | Struct.BBMOD_Vec3 |
The position of the reflection probe. Defaults to vector (0, 0, 0) if undefined . |
_sprite | Asset.GMSprite |
Pre-captured reflection probe sprite. Useful for example if you want to skip your game with pre-baked probes instead of capturing them on runtime. The sprite is deleted when the probe is re-captured or destroyed! |
Name | Description |
---|---|
EnableShadows | If true then shadows are enabled when capturing the reflection probe, which takes longer to render. Default is false . |
Enabled | If false then the probe is disabled and unused. Default value is true . |
Infinite | If true then the reflection probe has infinite extents, otherwise they are defined by the BBMOD_ReflectionProbe.Size property. Default value is false . |
NeedsUpdate | If true then the reflection probe needs to be re-captured. Equals true when _sprite is not passed to the constructor. Setting this to true every frame has severe impact on performance, even for a single reflection probe! |
Position | The position in the world. Default value is (0, 0, 0) . |
Resolution | The resolution of a cubemap used when capturing the probe. Default is 128 or the height of the sprite from which was the reflection probe created. |
Size | Size of AABB on each axis that marks the probe's area of influence. The probe is active only when camera enters this area. Default value is (0.5, 0.5, 0.5) , i.e. a 1x1x1 box. |
Sprite | The captured sprite used for reflections. |
Name | Description |
---|---|
destroy | Frees memory used by the struct. |
set_position | Changes the position of the reflection probe. |
set_size | Changes the probe's area of influence. |
set_sprite | Destroys the reflection probe's sprite and replaces it with a new one. |
A reflection probe object:
/// @desc Create event
reflectionProbe = new BBMOD_ReflectionProbe();
reflectionProbe.set_position(new BBMOD_Vec3(x, y, z));
reflectionProbe.set_size(new BBMOD_Vec3(100, 100, 20));
bbmod_reflection_probe_add(reflectionProbe);
/// @desc Step event
if (x != xprevious || y != yprevious || z != zprevious)
{
// Re-capture the reflection probe if its position changes
reflectionProbe.set_position(new BBMOD_Vec3(x, y, z));
reflectionProbe.NeedsUpdate = true;
}
/// @desc Clean Up event
bbmod_reflection_probe_remove(reflectionProbe);
reflectionProbe = reflectionProbe.destroy();
A model captured into reflection probes:
/// @desc Create event
material = BBMOD_MATERIAL_DEFAULT.clone();
// Add a shader for the ReflectionCapture render pass to make the model
// visible during reflection capture!
material.set_shader(BBMOD_ERenderPass.ReflectionCapture, BBMOD_SHADER_DEFAULT);
model.set_material("Material", material);
/// @desc Draw event
model.render();
You need to be using a BBMOD_BaseRenderer for reflection probes to work! By default only materials BBMOD_MATERIAL_TERRAIN and BBMOD_MATERIAL_SKY are captured into reflection probes!
BBMOD_ERenderPass.ReflectionCapture, bbmod_reflection_probe_add, bbmod_reflection_probe_clear, bbmod_reflection_probe_count, bbmod_reflection_probe_get, bbmod_reflection_probe_remove, bbmod_reflection_probe_remove_index
Copyright © 2024, BlueBurn. Built on September 07, 2024 using GMDoc.