Hi
Maybe silly question - but no luck in finding ansfer.
I use CommandBuffer to inject some calculations after GBuffer generation, for this I need a bunch of TemporaryRTs (half the size of GBuffer) - here is the code:
// allocate temporary RT's (with point filtering)
RenderBeforeLights.GetTemporaryRT( ID_SomeFancyEFX_RT0, -2, -2, 0, FilterMode.Point, RenderTextureFormat.RGHalf, RenderTextureReadWrite.Linear );
RenderBeforeLights.GetTemporaryRT( ID_SomeFancyEFX_RT1, -2, -2, 0, FilterMode.Point, RenderTextureFormat.RGHalf, RenderTextureReadWrite.Linear );
// do gbuffer information downsampling
RenderBeforeLights.Blit( BuiltinRenderTextureType.CurrentActive, ID_SomeFancyEFX_RT0, ...);
// do some calculations (RT's should be accesed with point filtering)
RenderBeforeLights.Blit( ID_SomeFancyEFX_RT0, ID_SomeFancyEFX_RT1, ...);
RenderBeforeLights.Blit( ID_SomeFancyEFX_RT1, ID_SomeFancyEFX_RT0, ...);
// release the unneeded RT
RenderBeforeLights.ReleaseTemporaryRT( ID_SomeFancyEFX_RT1);
// set the resulting rt as global texture (will be accesed from deferred composition pass)
RenderBeforeLights.SetGlobalTexture( ID_CompositePassFancyTexture, ID_SomeFancyEFX_RT0 );
// submit command buffer
RenderCamera.AddCommandBuffer(CameraEvent.BeforeLighting, RenderBeforeLights);
I see no way to change filtering mode to BILINEAR before calling ‘RenderBeforeLights.SetGlobalTexture’
(in composite pass I want to access ID_SomeFancyEFX_RT0 texture with bilinear filtering)
for ‘normal’ RT’s (without command buffers I could call .filterMode = FilterMode.Bilinear;) but is there any trick to do this for temporary RT’s ?
Another question that troubles me with command buffers - as you see in code above the ID_SomeFancyEFX_RT0 is leaking (there is no ReleaseTemporaryRT for it)
but as I saw in RenderingCommandBuffers example, there is also no corresponding ReleaseTemporaryRT for some temporaryRTs whose are set as GlobalTextures - this is ok ? (I dont want to end with situation where there are tons of unused temporary RT’s lurking around)