Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Additive blending artifacts


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 3DModelerMan   Members   -  Reputation: 1026

Like
0Likes
Like

Posted 18 August 2014 - 03:34 PM

I'm trying to setup forward rendering with additive blending, and I'm running into some problems with blending. I'm getting weird artifacts when I render my lighting pass. The first stage is a depth pre-pass that just outputs ambient light from the pixel shader (and renders any shadeless/special single pass materials). The second stage is multiple forward lighting passes, I only have one directional light setup in the screenshot, but for some reason, when I output anything in the lighting passes, I end up with blue background pixels randomly showing through. I also tested with a lighting shader that just outputs a plain white color, and it still gives artifacts, so I'm pretty sure it's not some sort of weird alpha blending bug. If I just leave my lighting pass disabled, then no artifacts appear. Does anyone have an idea what could be causing these? I've attached a screenshot of the artifacts, and a screenshot from GPU Perf Studio showing my render states.

Attached Thumbnails

  • error-example.png
  • error-render-states.png


Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 8176

Like
1Likes
Like

Posted 18 August 2014 - 03:52 PM

Sounds like Z-fighting to me.  The most likely reason for this is that you may not be using the same transforms in your VS for the pre-pass as you're using in the additive passes, so you end up getting slightly different Z values for each pass.  Maybe you tried to optimize by pre-calculating a matrix on the CPU in one pass that you do a per-vertex calculation on the GPU in the other passes?

 

I also saw this with D3D9 and on certain hardware if I used triangles via indexed primitives for one pass and triangle strips via non-indexed primitives for another pass, so it's important that the setup be the same too.


Edited by mhagain, 18 August 2014 - 03:53 PM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 3DModelerMan   Members   -  Reputation: 1026

Like
0Likes
Like

Posted 18 August 2014 - 06:21 PM

I just checked the transform matrices in Perf Studio... They're identical for every single draw call. Interestingly, the artifacts don't show up as bad when the model is closer to the camera, I also tried moving it further away, and they got worse the further I moved it. I just tested with quite a sizable depth bias too and got the same results.



#4 3DModelerMan   Members   -  Reputation: 1026

Like
1Likes
Like

Posted 18 August 2014 - 06:36 PM

Wow... Alright, for other people's future reference, that pattern is what it looks like when you output the wrong type to SV_TARGET. It doesn't give you a warning or anything, it'll compile just fine. It turns out there was a bug in my shader generator that left the 4 off of the return type. Hopefully no one else will spend 5 hours debugging depth buffers now only to find it was a simple return value issue.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS