mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
Added extra rendertarget for environment probes
This commit is contained in:
parent
bb2a5e523c
commit
71e2ea9aa3
6 changed files with 43 additions and 15 deletions
|
@ -132,6 +132,7 @@ struct globalFramebuffers_t
|
|||
#endif
|
||||
// Framebuffer* hdrQuarterFBO;
|
||||
Framebuffer* hdr64FBO;
|
||||
Framebuffer* envprobeFBO;
|
||||
Framebuffer* bloomRenderFBO[MAX_BLOOM_BUFFERS];
|
||||
Framebuffer* ambientOcclusionFBO[MAX_SSAO_BUFFERS];
|
||||
Framebuffer* csDepthFBO[MAX_HIERARCHICAL_ZBUFFERS];
|
||||
|
|
|
@ -573,6 +573,8 @@ public:
|
|||
idImage* currentRenderHDRImageQuarter;
|
||||
idImage* currentRenderHDRImage64;
|
||||
idImage* bloomRenderImage[2];
|
||||
idImage* envprobeHDRImage;
|
||||
idImage* envprobeDepthImage;
|
||||
idImage* heatmap5Image;
|
||||
idImage* heatmap7Image;
|
||||
idImage* smaaInputImage;
|
||||
|
|
|
@ -262,6 +262,16 @@ static void R_HDR_RGBA16FImage_Res64( idImage* image )
|
|||
image->GenerateImage( NULL, 64, 64, TF_NEAREST, TR_CLAMP, TD_RGBA16F );
|
||||
}
|
||||
|
||||
static void R_EnvprobeImage_HDR( idImage* image )
|
||||
{
|
||||
image->GenerateImage( NULL, RADIANCE_CUBEMAP_SIZE, RADIANCE_CUBEMAP_SIZE, TF_NEAREST, TR_CLAMP, TD_RGBA16F );
|
||||
}
|
||||
|
||||
static void R_EnvprobeImage_Depth( idImage* image )
|
||||
{
|
||||
image->GenerateImage( NULL, RADIANCE_CUBEMAP_SIZE, RADIANCE_CUBEMAP_SIZE, TF_NEAREST, TR_CLAMP, TD_DEPTH );
|
||||
}
|
||||
|
||||
static void R_SMAAImage_ResNative( idImage* image )
|
||||
{
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_LINEAR, TR_CLAMP, TD_LOOKUP_TABLE_RGBA );
|
||||
|
@ -997,6 +1007,9 @@ void idImageManager::CreateIntrinsicImages()
|
|||
currentRenderHDRImageQuarter = globalImages->ImageFromFunction( "_currentRenderHDRQuarter", R_HDR_RGBA16FImage_ResQuarter );
|
||||
currentRenderHDRImage64 = globalImages->ImageFromFunction( "_currentRenderHDR64", R_HDR_RGBA16FImage_Res64 );
|
||||
|
||||
envprobeHDRImage = globalImages->ImageFromFunction( "_envprobeHDR", R_EnvprobeImage_HDR );
|
||||
envprobeDepthImage = ImageFromFunction( "_envprobeDepth", R_EnvprobeImage_Depth );
|
||||
|
||||
bloomRenderImage[0] = globalImages->ImageFromFunction( "_bloomRender0", R_HDR_RGBA16FImage_ResQuarter_Linear );
|
||||
bloomRenderImage[1] = globalImages->ImageFromFunction( "_bloomRender1", R_HDR_RGBA16FImage_ResQuarter_Linear );
|
||||
|
||||
|
|
|
@ -133,6 +133,19 @@ void Framebuffer::Init()
|
|||
globalFramebuffers.hdrNonMSAAFBO->Check();
|
||||
#endif
|
||||
|
||||
// HDR CUBEMAP CAPTURE
|
||||
|
||||
globalFramebuffers.envprobeFBO = new Framebuffer( "_envprobeRender", RADIANCE_CUBEMAP_SIZE, RADIANCE_CUBEMAP_SIZE );
|
||||
globalFramebuffers.envprobeFBO->Bind();
|
||||
|
||||
globalFramebuffers.envprobeFBO->AddColorBuffer( GL_RGBA16F, 0 );
|
||||
globalFramebuffers.envprobeFBO->AddDepthBuffer( GL_DEPTH24_STENCIL8 );
|
||||
|
||||
globalFramebuffers.envprobeFBO->AttachImage2D( GL_TEXTURE_2D, globalImages->envprobeHDRImage, 0 );
|
||||
globalFramebuffers.envprobeFBO->AttachImageDepth( GL_TEXTURE_2D, globalImages->envprobeDepthImage );
|
||||
|
||||
globalFramebuffers.envprobeFBO->Check();
|
||||
|
||||
// HDR DOWNSCALE
|
||||
|
||||
globalFramebuffers.hdr64FBO = new Framebuffer( "_hdr64", 64, 64 );
|
||||
|
|
|
@ -235,6 +235,13 @@ typedef struct
|
|||
} renderEnvironmentProbe_t;
|
||||
// RB end
|
||||
|
||||
|
||||
// RB: added back refdef flags from Quake 3
|
||||
const int RDF_NOSHADOWS = BIT( 0 ); // force renderer to use faster lighting only path
|
||||
const int RDF_NOAMBIENT = BIT( 1 ); // don't render indirect lighting
|
||||
const int RDF_IRRADIANCE = BIT( 2 ); // render into 256^2 HDR render target for irradiance/radiance GGX calculation
|
||||
const int RDF_UNDERWATER = BIT( 3 ); // TODO enable automatic underwater caustics and fog
|
||||
|
||||
typedef struct renderView_s
|
||||
{
|
||||
// player views will set this to a non-zero integer for model suppress / allow
|
||||
|
@ -258,6 +265,8 @@ typedef struct renderView_s
|
|||
// the viewEyeBuffer may be of a different polarity than stereoScreenSeparation if the eyes have been swapped
|
||||
int viewEyeBuffer; // -1 = left eye, 1 = right eye, 0 = monoscopic view or GUI
|
||||
float stereoScreenSeparation; // projection matrix horizontal offset, positive or negative based on camera eye
|
||||
|
||||
int rdflags; // RB: RDF_NOSHADOWS, etc
|
||||
} renderView_t;
|
||||
|
||||
|
||||
|
|
|
@ -879,17 +879,13 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
|
|||
idMat3 axis[6], oldAxis;
|
||||
idVec3 oldPosition;
|
||||
renderView_t ref;
|
||||
viewDef_t primary;
|
||||
int blends;
|
||||
const char* extension;
|
||||
int size;
|
||||
int res_w, res_h, old_fov_x, old_fov_y;
|
||||
int old_fov_x, old_fov_y;
|
||||
|
||||
static const char* envDirection[6] = { "_px", "_nx", "_py", "_ny", "_pz", "_nz" };
|
||||
|
||||
res_w = renderSystem->GetWidth();
|
||||
res_h = renderSystem->GetHeight();
|
||||
|
||||
baseName = tr.primaryWorld->mapName;
|
||||
baseName.StripFileExtension();
|
||||
|
||||
|
@ -902,7 +898,7 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
|
|||
return;
|
||||
}
|
||||
|
||||
primary = *tr.primaryView;
|
||||
const viewDef_t primary = *tr.primaryView;
|
||||
|
||||
memset( &axis, 0, sizeof( axis ) );
|
||||
|
||||
|
@ -940,14 +936,6 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
|
|||
// CAPTURE SCENE LIGHTING TO CUBEMAPS
|
||||
//--------------------------------------------
|
||||
|
||||
// let's get the game window to a "size" resolution
|
||||
if( ( res_w != size ) || ( res_h != size ) )
|
||||
{
|
||||
cvarSystem->SetCVarInteger( "r_windowWidth", size );
|
||||
cvarSystem->SetCVarInteger( "r_windowHeight", size );
|
||||
R_SetNewMode( false ); // the same as "vid_restart"
|
||||
} // FIXME that's a hack!!
|
||||
|
||||
// so we return to that axis and fov after the fact.
|
||||
oldPosition = primary.renderView.vieworg;
|
||||
oldAxis = primary.renderView.viewaxis;
|
||||
|
@ -980,7 +968,8 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
|
|||
}
|
||||
}
|
||||
|
||||
// restore the original resolution, axis and fov
|
||||
// restore the original axis and fov
|
||||
/*
|
||||
ref.vieworg = oldPosition;
|
||||
ref.viewaxis = oldAxis;
|
||||
ref.fov_x = old_fov_x;
|
||||
|
@ -988,6 +977,7 @@ CONSOLE_COMMAND( generateEnvironmentProbes, "Generate environment probes", NULL
|
|||
cvarSystem->SetCVarInteger( "r_windowWidth", res_w );
|
||||
cvarSystem->SetCVarInteger( "r_windowHeight", res_h );
|
||||
R_SetNewMode( false ); // the same as "vid_restart"
|
||||
*/
|
||||
|
||||
common->Printf( "Wrote a env set with the name %s\n", baseName.c_str() );
|
||||
|
||||
|
|
Loading…
Reference in a new issue