Bloom race condition with animation causing black squares?

Started by
4 comments, last by mrMatrix 7 years, 3 months ago

I have a bloom shader which works perfectly when I have static objects. I do a 6x down sampling then 6x gaussian blur then I composite the bloom over the source.

When I add in Assimp animation I get NaN errors at certain angles in the form of black squares which I can confirm are NaN by doing isnan(). Certain angles while animating also make my tonemapping shader go crazy. I've tried to add in fences with glFenceSync and glClientWaitSync but it doesnt do anything. Is synchronization the issue? I assume the animated assimp model isn't in sync with the bloom.

k4a2pc.jpg

Advertisement

It's much more likely that you have a bad calculation (such as a divide by 0) in one of your shader programs. Since it's related to animation, I would guess that you're somehow producing a zero-length (or otherwise invalid) normal vector in your vertex shader program. You may want to try a debugging tool like RenderDoc to see if you can validate the outputs from your vertex shader.

Thanks, NaN was indeed the cause for the black squares. However, a real solution is proving to be quite tricky.

I had some issues with both RenderDoc and Nsight. With RenderDoc I was getting consistently the wrong final color. With Nsight I am unable to do live shader debugging on my current card (gtx 950) since they only support it on old Kepler / Fermi cards. Is it worth it to spend cash on an old card to do Shader Debugging in Nsight?

Just debug by hand. Grab your animation shader and, in the fragment shader, write something visible when fragments become NaNs. Like bright pink/green/yellow. That ought to tell you something.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Just debug by hand. Grab your animation shader and, in the fragment shader, write something visible when fragments become NaNs. Like bright pink/green/yellow. That ought to tell you something.

But isnt it common practice to shader debug with Nsight? And all that I've read says that it can only be done with a Kepler gpu such as a 670/680. I've been looking at this problem for over a week now and I'll do anything to solve it. The problem does have to do with NaN but why it happens isnt easy for me to describe or fix without having that "edge" that I've seen in Nsight tutorial videos. I think my best option would be to order a Kepler gpu. This could help me in the future as well as my shaders get more complex.

This topic is closed to new replies.

Advertisement