1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Add options to reduce lightmaps disk usage.

Added BakedLightmap.use_hdr and BakedLightmap.use_color properties
that can reduce the flie size of lightmap texture at the expense of quality.

Changed the denoiser to work in a single buffer, reducing RAM
usage. Also added the `-mstackrealign` flag in the denoiser compilation
for MinGW builds. This flag helped fix a bug in Embree, so I want to see
if it will help fix GH #45296.
This commit is contained in:
JFonS
2021-02-15 12:32:31 +01:00
parent 7241139356
commit 56bf256d76
7 changed files with 112 additions and 18 deletions

View File

@@ -43,9 +43,7 @@ void *oidn_denoiser_init() {
bool oidn_denoise(void *deviceptr, float *p_floats, int p_width, int p_height) {
OIDNDeviceImpl *device = (OIDNDeviceImpl *)deviceptr;
OIDNFilter filter = oidnNewFilter(device, "RTLightmap");
void *input_buffer = memalloc(p_width * p_height * 3 * sizeof(float));
copymem(input_buffer, p_floats, p_width * p_height * 3 * sizeof(float));
oidnSetSharedFilterImage(filter, "color", input_buffer, OIDN_FORMAT_FLOAT3, p_width, p_height, 0, 0, 0);
oidnSetSharedFilterImage(filter, "color", (void *)p_floats, OIDN_FORMAT_FLOAT3, p_width, p_height, 0, 0, 0);
oidnSetSharedFilterImage(filter, "output", (void *)p_floats, OIDN_FORMAT_FLOAT3, p_width, p_height, 0, 0, 0);
oidnSetFilter1b(filter, "hdr", true);
oidnCommitFilter(filter);