A constructor defined in BBMOD_DeferredRenderer.gml
Extends BBMOD_BaseRenderer
new BBMOD_DeferredRenderer()
A deferred renderer with support for unlimited number of shadow-casting lights. Implemented render passes are: BBMOD_ERenderPass.ReflectionCapture, BBMOD_ERenderPass.Id, BBMOD_ERenderPass.Shadows, BBMOD_ERenderPass.GBuffer, BBMOD_ERenderPass.DepthOnly, BBMOD_ERenderPass.Background, BBMOD_ERenderPass.Forward and BBMOD_ERenderPass.Alpha.
Name | Description |
---|---|
ClearColor | The color to clear the background with. Default value is c_black . |
Name | Description |
---|---|
ButtonSelect | The mouse button used to select instances when edit mode is enabled. Default value is mb_left . |
EditMode | If true then edit mode is enabled. Default value is false . |
EnableMousepick | If true then mousepicking of gizmo and instances is enabled. Default value is true . |
EnableSSAO | Enables screen-space ambient occlusion. This requires the depth buffer. Defaults to false . Enabling this requires the SSAO submodule! |
EnableShadows | Enables rendering into a shadowmap in the shadows render pass. Defauls to false . |
Gizmo | A gizmo for transforming instances when BBMOD_BaseRenderer.EditMode is enabled. This is by default undefined . |
Height | The height of the renderer on the screen. If undefined then the window height is used. Default value is undefined . |
InstanceHighlightColor | Outline color of instances selected by gizmo. Default value is BBMOD_C_ORANGE. |
KeyMultiSelect | The keyboard key used to add/remove instances from multiple selection when edit mode is enabled. Default value is vk_shift . |
PostProcessor | Handles post-processing effects if isn't undefined and BBMOD_BaseRenderer.UseAppSurface is enabled. Default value is undefined . |
RenderInstanceIDs | If true then rendering of instance IDs into an off-screen surface is enabled. This must be enabled if you would like to use method BBMOD_BaseRenderer.get_instance_id for mouse-picking instances. Default value is false . |
RenderScale | Resolution multiplier for the application_surface . BBMOD_BaseRenderer.UseAppSurface must be enabled for this to have any effect. Defaults to 1. Use lower values to improve framerate. |
Renderables | An array of renderable objects and structs. These are automatically rendered in BBMOD_BaseRenderer.render. |
SSAOAngleBias | SSAO angle bias in radians. Default value is 0.03. |
SSAOBlurDepthRange | Maximum depth difference over which can be SSAO samples blurred. Defaults to 2. |
SSAODepthRange | Maximum depth difference of SSAO samples. Samples farther away from the origin than this will not contribute to the effect. Default value is 10. |
SSAOPower | Strength of the SSAO effect. Should be greater than 0. Default value is 1. |
SSAORadius | Screen-space radius of SSAO. Default value is 16. |
SSAOScale | Resolution multiplier for SSAO surface. Defaults to 1. |
SSAOSelfOcclusionBias | Defaults to 0.01. Increase to fix self-occlusion. |
ShadowmapNormalOffset | When rendering shadows, offsets vertex position by its normal scaled by this value. Defaults to 1. Increasing the value can remove some artifacts but using too high value could make the objects appear flying above the ground. |
UseAppSurface | Set to true to enable the application_surface . Use method BBMOD_BaseRenderer.present to draw the application_surface to the screen. Defaults to false . |
Width | The width of the renderer on the screen. If undefined then the window width is used. Default value is undefined . |
X | The X position of the renderer on the screen. Default value is 0. |
Y | The Y position of the renderer on the screen. Default value is 0. |
Name | Description |
---|---|
add | Adds a renderable object or struct to the renderer. |
destroy | Frees memory used by the struct. |
get_height | Retrieves the height of the renderer on the screen. |
get_instance_id | Retrieves an ID of an instance at given position on the screen. |
get_render_height | Retrieves the height of the renderer with BBMOD_BaseRenderer.RenderScale applied. |
get_render_width | Retrieves the width of the renderer with BBMOD_BaseRenderer.RenderScale applied. |
get_width | Retrieves the width of the renderer on the screen. |
present | Presents the rendered graphics on the screen, with post-processing applied (if BBMOD_BaseRenderer.PostProcessor is defined). |
remove | Removes a renderable object or a struct from the renderer. |
render | Renders all added renderables to the current render target. |
set_position | Changes the renderer's position on the screen. |
set_rectangle | Changes the renderer's position and size on the screen. |
set_size | Changes the renderer's size on the screen. |
update | Updates the renderer. This should be called in the Step event. |
Following code is a typical use of the renderer.
/// @desc Create event
renderer = new BBMOD_DeferredRenderer();
renderer.EnableShadows = true;
postProcessor = new BBMOD_PostProcessor();
postProcessor.add_effect(new BBMOD_ExposureEffect());
postProcessor.add_effect(new BBMOD_ReinhardTonemapEffect());
postProcessor.add_effect(new BBMOD_GammaCorrectEffect());
renderer.PostProcessor = postProcessor;
camera = new BBMOD_Camera();
camera.FollowObject = OPlayer;
/// @desc Step event
camera.set_mouselook(true);
camera.update(delta_time);
renderer.update(delta_time);
/// @desc Draw event
camera.apply();
renderer.render();
/// @desc Post-Draw event
renderer.present();
/// @desc Clean Up event
renderer = renderer.destroy();
Deferred renderer requires multiple render targets and 16 bit floating point texture format! You can use function bbmod_deferred_renderer_is_supported to check whether the current platform meets all requirements.
BBMOD_Camera, bbmod_deferred_renderer_is_supported
Copyright © 2024, BlueBurn. Built on September 07, 2024 using GMDoc.