HDR Rendering (Average Luminance)

Started by
30 comments, last by Medo Mex 8 years, 3 months ago

@Styves: I tried to do something simple, pass a texture to the shader, then increase the color value every frame

So, every frame the texture color value should increase.

This will let me know if I'm passing the texture incorrectly.


float lastVal = Tex[0].Sample(SampleType, float2(0.5, 0.5)).r;
float newVal = lastVal + 0.1f;
return float4(newVal, newVal, newVal, 1.0f);

newVal should increase by 0.1f; every frame.

But, what I get is that this pixel shader always output the same color 0.1f on the screen.

In C++:


Texture* pTexSwap = pLastTexture;
pLastTexture = pCurrentTexture;
pCurrentTexture = pTexSwap;

FullScreenQuad->RenderToTexture(renderTexture, pLastTexture); // <- pLastTexture will be passed to the shader as a texture
pCurrentTexture = renderTexture->GetTexture();

memcpy(ppFinalTexture, &pCurrentTexture, sizeof(pCurrentTexture));

// Code here to render ppFinalTexture to the screen to see the color

Why the color is not increasing every frame?

Advertisement

@Styves: I resolved the problem by creating two RenderTextureClass and swap between them each frame by using a boolean.

Thanks,

This topic is closed to new replies.

Advertisement