simvx.graphics.renderer.colour_grading

Colour grading pass: LUT-based colour correction via compute shader.

Module Contents

Classes

ColourGradingPass

Compute-based colour grading: LUT lookup + brightness/contrast/saturation/temperature.

Functions

create_lut_sampler

Create a trilinear, clamp-to-edge sampler for a 3D LUT.

upload_lut_3d

Upload an (size, size, size, 4) uint8 LUT as a 3D sampled image.

Data

API

simvx.graphics.renderer.colour_grading.__all__

[‘ColourGradingPass’, ‘create_lut_sampler’, ‘upload_lut_3d’]

simvx.graphics.renderer.colour_grading.log

‘getLogger(…)’

class simvx.graphics.renderer.colour_grading.ColourGradingPass(engine: Any)[source]

Compute-based colour grading: LUT lookup + brightness/contrast/saturation/temperature.

Operates in-place on the HDR colour image. Apply after fog, before tone mapping.

Initialization

setup(width: int, height: int, colour_view: Any) None[source]

Initialize colour grading pipeline and upload default neutral LUT.

set_lut(lut_data: numpy.ndarray) None[source]

Upload a new 3D LUT texture. Shape should be (size, size, size, 4) uint8.

render(cmd: Any) None[source]

Dispatch colour grading compute shader. Call after fog, before tonemap.

Args: cmd: Active command buffer (outside any render pass).

resize(width: int, height: int, colour_view: Any) None[source]

Update descriptors for new dimensions.

cleanup() None[source]

Release all GPU resources.

simvx.graphics.renderer.colour_grading.create_lut_sampler(device: Any) Any[source]

Create a trilinear, clamp-to-edge sampler for a 3D LUT.

Matches the web runtime’s LUT sampler (linear mag/min, clamp on all three axes) so desktop and web sample identical texels for the same LUT data.

simvx.graphics.renderer.colour_grading.upload_lut_3d(engine: Any, lut_data: numpy.ndarray) tuple[Any, Any, Any][source]

Upload an (size, size, size, 4) uint8 LUT as a 3D sampled image.

Returns (image, memory, view). The format is VK_FORMAT_R8G8B8A8_UNORM with a VK_IMAGE_VIEW_TYPE_3D view, the byte-for-byte match for the web runtime’s rgba8unorm 3D LUT texture. The image is left in SHADER_READ_ONLY_OPTIMAL, ready for either a fragment or compute sampler.