Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

RDSamplerState

Inherits: RefCounted < Object

Sampler state (used by RenderingDevice).

Description

This object is used by RenderingDevice.

Properties

float

anisotropy_max

1.0

SamplerBorderColor

border_color

2

CompareOperator

compare_op

7

bool

enable_compare

false

float

lod_bias

0.0

SamplerFilter

mag_filter

0

float

max_lod

1e+20

SamplerFilter

min_filter

0

float

min_lod

0.0

SamplerFilter

mip_filter

0

SamplerRepeatMode

repeat_u

2

SamplerRepeatMode

repeat_v

2

SamplerRepeatMode

repeat_w

2

bool

unnormalized_uvw

false

bool

use_anisotropy

false


Property Descriptions

float anisotropy_max = 1.0

  • void set_anisotropy_max ( float value )

  • float get_anisotropy_max ( )

Maximum anisotropy that can be used when sampling. Only effective if use_anisotropy is true. Higher values result in a sharper sampler at oblique angles, at the cost of performance (due to memory bandwidth). This value may be limited by the graphics hardware in use. Most graphics hardware only supports values up to 16.0.

If anisotropy_max is 1.0, forcibly disables anisotropy even if use_anisotropy is true.


SamplerBorderColor border_color = 2

The border color that will be returned when sampling outside the sampler's bounds and the repeat_u, repeat_v or repeat_w modes have repeating disabled.


CompareOperator compare_op = 7

The compare operation to use. Only effective if enable_compare is true.


bool enable_compare = false

  • void set_enable_compare ( bool value )

  • bool get_enable_compare ( )

If true, returned values will be based on the comparison operation defined in compare_op. This is a hardware-based approach and is therefore faster than performing this manually in a shader. For example, compare operations are used for shadow map rendering by comparing depth values from a shadow sampler.


float lod_bias = 0.0

  • void set_lod_bias ( float value )

  • float get_lod_bias ( )

The mipmap LOD bias to use. Positive values will make the sampler blurrier at a given distance, while negative values will make the sampler sharper at a given distance (at the risk of looking grainy). Recommended values are between -0.5 and