Sampling the Render target while rendering to it

Started by
12 comments, last by JB3DG 9 years, 7 months ago

If you want a overdraw 'debug' shader, you should simple render the scene using additive blending with a static color (for example float4(0.1, 0.1 ,0.1 ,1) ).

places with little overdraw will be quite dark while places with a lot of overdraw will be white.

In case everthing is black or white (the minimum/maximum), simple adjust the fixed color. for example change it to float4(0.25, 0.25 ,0.25 ,25) if it is to dark, float4(0.02, 0.02 ,0.02 ,1) if it is to bright. Even better is to have a user-controlled slider ;)

You could do it dynamically (determine the blend color based on the minimum/maximum overdraw count) but that will be quite a lot of work for a debug feature... If you chose to calculate it dynamically, I recommend something like this

Advertisement

Sorted. It was a lack of understanding how the blend state works. Changing from SRC_COLOR/INV_SRC_COLOR to ONE for both the source and dest blends gave me what I wanted.

I'm not sure if it applies to your situation, but it is pretty common to use the stencil buffer for counting the number of times that a pixel is touched during rendering. Perhaps that could be suitable in your situation?

I am using it for other info. Its a weather radar simulation where I determine the area of the cloud with the highest density in order to create the precipitation zone and then render the return.

This topic is closed to new replies.

Advertisement