Embedded default HDR light probe data

This commit is contained in:
Robert Beckebans 2021-03-26 10:49:16 +01:00
parent d5a4dda542
commit 1f796a1f08
6 changed files with 41020 additions and 29 deletions

View file

@ -400,7 +400,7 @@ public:
textureFilter_t filter,
textureRepeat_t repeat,
textureUsage_t usage,
textureSamples_t samples = SAMPLE_1 );
textureSamples_t samples = SAMPLE_1, cubeFiles_t cubeFiles = CF_2D );
void GenerateCubeImage( const byte* pic[6], int size,
textureFilter_t filter, textureUsage_t usage );

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013-2020 Robert Beckebans
Copyright (C) 2013-2021 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -39,6 +39,9 @@ If you have questions concerning this license or the applicable additional terms
//#include "Image_blueNoiseVC_1M.h" // 256^2 R8 data
#include "Image_blueNoiseVC_2.h" // 512^2 RGB8 data
#include "Image_env_UAC_lobby_amb.h"
#include "Image_env_UAC_lobby_spec.h"
#define DEFAULT_SIZE 16
/*
@ -939,31 +942,19 @@ static void R_CreateImGuiFontImage( idImage* image )
static void R_CreateBrdfLutImage( idImage* image )
{
#if 0
static byte data[BRDFLUT_TEX_HEIGHT][BRDFLUT_TEX_WIDTH][4];
for( int x = 0; x < BRDFLUT_TEX_WIDTH; x++ )
{
for( int y = 0; y < BRDFLUT_TEX_HEIGHT; y++ )
{
#if 0
data[AREATEX_HEIGHT - y][x][0] = areaTexBytes[ y * AREATEX_PITCH + x * 2 + 0 ];
data[AREATEX_HEIGHT - y][x][1] = areaTexBytes[ y * AREATEX_PITCH + x * 2 + 1 ];
data[AREATEX_HEIGHT - y][x][2] = 0;
data[AREATEX_HEIGHT - y][x][3] = 1;
#else
data[y][x][0] = brfLutTexBytes[ y * BRDFLUT_TEX_PITCH + x * 2 + 0 ];
data[y][x][1] = brfLutTexBytes[ y * BRDFLUT_TEX_PITCH + x * 2 + 1 ];
data[y][x][2] = 0;
data[y][x][3] = 1;
#endif
}
}
#endif
image->GenerateImage( ( byte* )brfLutTexBytes, BRDFLUT_TEX_WIDTH, BRDFLUT_TEX_HEIGHT, TF_LINEAR, TR_CLAMP, TD_RG16F );
}
static void R_CreateEnvprobeImage_UAC_lobby_irradiance( idImage* image )
{
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_AMB_H_Bytes, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
}
static void R_CreateEnvprobeImage_UAC_lobby_radiance( idImage* image )
{
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_SPEC_H_Bytes, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
}
// RB end
@ -1055,9 +1046,13 @@ void idImageManager::CreateIntrinsicImages()
hellLoadingIconImage = ImageFromFile( "textures/loadingicon3", TF_DEFAULT, TR_CLAMP, TD_DEFAULT, CF_2D );
// RB begin
// FIXME change back to TF_DEFAULT
#if 0
defaultUACIrradianceCube = ImageFromFile( "env/UAC5_amb", TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, CF_2D_PACKED_MIPCHAIN );
defaultUACRadianceCube = ImageFromFile( "env/UAC5_spec", TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, CF_2D_PACKED_MIPCHAIN );
#else
defaultUACIrradianceCube = ImageFromFunction( "_defaultUACIrradiance", R_CreateEnvprobeImage_UAC_lobby_irradiance );
defaultUACRadianceCube = ImageFromFunction( "_defaultUACRadiance", R_CreateEnvprobeImage_UAC_lobby_radiance );
#endif
// RB end
release_assert( loadingIconImage->referencedOutsideLevelLoad );

View file

@ -764,20 +764,27 @@ void idImage::Reload( bool force )
GenerateImage
================
*/
void idImage::GenerateImage( const byte* pic, int width, int height, textureFilter_t filterParm, textureRepeat_t repeatParm, textureUsage_t usageParm, textureSamples_t samples )
void idImage::GenerateImage( const byte* pic, int width, int height, textureFilter_t filterParm, textureRepeat_t repeatParm, textureUsage_t usageParm, textureSamples_t samples, cubeFiles_t _cubeFiles )
{
PurgeImage();
filter = filterParm;
repeat = repeatParm;
usage = usageParm;
cubeFiles = CF_2D;
cubeFiles = _cubeFiles;
opts.textureType = ( samples > SAMPLE_1 ) ? TT_2D_MULTISAMPLE : TT_2D;
opts.width = width;
opts.height = height;
opts.numLevels = 0;
opts.samples = samples;
// RB
if( cubeFiles == CF_2D_PACKED_MIPCHAIN )
{
opts.width = width * ( 2.0f / 3.0f );
}
DeriveOpts();
// RB: allow pic == NULL for internal framebuffer images
@ -800,7 +807,14 @@ void idImage::GenerateImage( const byte* pic, int width, int height, textureFilt
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.height );
}
im.Load2DFromMemory( width, height, pic, opts.numLevels, opts.format, opts.colorFormat, opts.gammaMips );
if( cubeFiles == CF_2D_PACKED_MIPCHAIN )
{
im.Load2DAtlasMipchainFromMemory( width, opts.height, pic, opts.numLevels, opts.format, opts.colorFormat );
}
else
{
im.Load2DFromMemory( width, height, pic, opts.numLevels, opts.format, opts.colorFormat, opts.gammaMips );
}
commonLocal.LoadPacifierBinarizeEnd();

View file

@ -1359,7 +1359,7 @@ CONSOLE_COMMAND( makeImageHeader, "load an image and turn it into a .h file", NU
headerFile->Printf( "#define %s_TEX_WIDTH %i\n", uppername.c_str(), width );
headerFile->Printf( "#define %s_TEX_HEIGHT %i\n\n", uppername.c_str(), height );
headerFile->Printf( "#define static const unsigned char %s_Bytes[] = {\n", uppername.c_str() );
headerFile->Printf( "static const unsigned char %s_Bytes[] = {\n", uppername.c_str() );
int bufferSize = width * height * 4;