HDR/DRL Implementation Question
by William Todd Scott · in Torque Game Engine Advanced · 11/04/2006 (2:47 pm) · 4 replies
Hi,
I noticed that the code for creating the HDR/DRL render targets is as follows:
Both sgDRLTextureFormat and sgHDRTextureFormat are R8G8B8A8 and both calls use the DRLTargetTextureProfile. So. it looks like there is no difference between the render targets being created. Is this correct?
Second, it appears that the sgDRLTextureFormat does NOT specify NoMipMaps. Should it? This is more a question on how things work. Will the mipmap levels be created when/if the renderTarget is set as a texture to be sampled or will the mipmaps be created when the texture is first set as a render target, making the mip map levels useless?
Thanks
Todd
I noticed that the code for creating the HDR/DRL render targets is as follows:
if((i == 0) && (LightManager::sgAllowFullHighDynamicRangeLighting()) && (GFX->getPixelShaderVersion() >= 3.0))
{
sgSurfaceChain[i] = GFXTexHandle(size.x, size.y, sgFormatManager::sgHDRTextureFormat, &DRLTargetTextureProfile);
}
else
{
sgSurfaceChain[i] = GFXTexHandle(size.x, size.y, sgFormatManager::sgDRLTextureFormat, &DRLTargetTextureProfile);
}Both sgDRLTextureFormat and sgHDRTextureFormat are R8G8B8A8 and both calls use the DRLTargetTextureProfile. So. it looks like there is no difference between the render targets being created. Is this correct?
Second, it appears that the sgDRLTextureFormat does NOT specify NoMipMaps. Should it? This is more a question on how things work. Will the mipmap levels be created when/if the renderTarget is set as a texture to be sampled or will the mipmaps be created when the texture is first set as a render target, making the mip map levels useless?
Thanks
Todd
#2
Thanks for taking the time to talk this through with me.
The following two lines are in sgFormatManager.cc
GFXFormat sgFormatManager::sgDRLTextureFormat = GFXFormatR8G8B8A8;
GFXFormat sgFormatManager::sgHDRTextureFormat = GFXFormatR8G8B8A8;
So, I don't see where TGEA is looking for the highest render target format which supports blending. Can you point me in the right location? It still seems to me that the if-then statement I pointed out is not doing anything.
On the mipmaps, it seems then that there is no need for the DRLTargetTextureProfile because it should just use the DefaultRenderTargetTextureProfile that is declared. Do you agree?
Thanks.
Todd
11/06/2006 (4:26 pm)
Hi Manoel,Thanks for taking the time to talk this through with me.
The following two lines are in sgFormatManager.cc
GFXFormat sgFormatManager::sgDRLTextureFormat = GFXFormatR8G8B8A8;
GFXFormat sgFormatManager::sgHDRTextureFormat = GFXFormatR8G8B8A8;
So, I don't see where TGEA is looking for the highest render target format which supports blending. Can you point me in the right location? It still seems to me that the if-then statement I pointed out is not doing anything.
On the mipmaps, it seems then that there is no need for the DRLTargetTextureProfile because it should just use the DefaultRenderTargetTextureProfile that is declared. Do you agree?
Thanks.
Todd
#3
11/07/2006 (1:18 am)
The formats are selected in sgFormatManager::sgInit() based on hardware support. DRL and HDR (also shadows and a few others) have their own texture profiles, so if the base format changes it won't affect them.
Associate Manoel Neto
Default Studio Name
As for mipmaps, you need to manually call up a function to generate them. I'm not sure if such functions is exposed on the GFX layer, but usually you do not want to generate mipmaps for render targets or real-time dynamically updated textures in general, because there's no guarantedd on how the vendor implemented the feature in the specific video card. It may or may not be a major performance issue (it usually is).