Shader pipeline vs. fixed pipeline z-fighting

Started by
1 comment, last by Filousov 19 years, 5 months ago
Hi, I'm using both fixed and shader processing. I first render scene with fixed processing and then for some lights I want to add the amount of light they do to the scene using programmable pipeline. The problem is, that matrix computation with fixed and programmable is not exactly the same. So I got z-fighting, when directly rendering with the same depth-buffer. Is there any good method to fix this? Thanks for help
Advertisement
I've run into this problem as well trying to use FF for some passes. Basically, you can't depend on both pipelines giving exactly the same results. Your best bet is to come up with a simple shader for the FF passes.

For my current project I basically do everything with shaders, even the menus (it's slower, but hey, if your menus are too slow, you've got bigger problems :). It makes things simpler (less stuff to keep track of), and I can easily add in cool shader effects. Of course, the downside is that it will only run on fairly new graphics cards.
Yes, the problem is, that when switching all to shaders all is running about 80% of it's current speed. The shaders are a bit slower. That's one of the reason I decided to use both, but I don't know, if it's good idea anymore.

I'm currently using programmable pipeline to generate dynamic shadows using shadow mapping (which is causing me a lot of trouble to get it to work). But only solution I come with is, that I create another render target and depth buffer for shader processing. And then render quad accross all of the screen with BLEND_ONE on both source and destination.

The problem is, that I think, that it can be quite slow and it is using a lot of memory. So I'm searching for better solution.
I tried to add some bias to post-projectionaly, but it doesn't work and have a draw back, that when I add some bias like ProjectionMatrix * BiasMatrix, there is w component and I have no idea, how big it is. So I would prefer to add bias after division by w, but how?

The another problem with bias solution is, that graphic card simply knows, that I'm rendering with different method to same depth buffer and discards all z values different from zero. And this I don't understand.

The solution worked some time on my graphic card, then I changed shader and it's not working anymore. But on another card, it do not work anyway. And I know exactly, that it's something with z-buffer, because when I clear it, all is shown correctly, but of course all pixels including, that should not be seen are blended to scene!

This topic is closed to new replies.

Advertisement