Flickering Shadow

Started by
6 comments, last by Ronamitri 18 years, 6 months ago
Hello, Sorry to ask again, but I am still baffled by why my shadow flickers heavily. I have copied the shadow generation code from a variety of sources and it all produces the same results. My shadow appear projected correctly, but flickers violently. There are no other objects being rendered, so no z fighting, even so I have tried disabling z-writing and testing...no difference. I made the program switch to a red texture before drawing the shadowed mesh. The result is the shadow now flickers between red and black. I have checked and there are no other setTexture calls being made, so where is the black coming from! :) I am not presently using any stencil buffer, since I am trying to simplify the problem, is this incorrect? Has anyone else seen such a thing? My format D3DFMTD24_S8, with autodepthstencil thingy enabled Please help if you can, many thanks Simon
Advertisement
I have seen the occasional odd result like this, but it was usually down to running on crappy old hardware [smile]

Three things to look into:

1. Debug runtimes - they use various colour combinations to indicate (lack of) buffer clears and usage of default values and render states. You might be lucky and get a debug message printed out telling you it doesn't like something...

2. Try running through the REFRAST and see if you get the same results. Depending on how recent your hardware is, you could well be seeing some odd results. Before stencil shadowing became "cool" some hardware/drivers tended to have quite flakey support [wink]

3. If possible, try running it on some different hardware. Although #2 above should eliminate the need to do this.


Sorry I can't be any more specific!
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

You haven't got lighting enabled when you render your shadow? That can cause things to appear black when it isn't set up correctly.
Oh poop, I've fixed it and I'm not sure how! :)

Do I try and break it again?!

Si
yes - if you don't know how you fixed it now, you won't know how to fix it when it happens again - all "miraculously vanishing bugs" come back and bite you on the arse eventually
Okay, I think it must be a hardware issue.

WHen I render a shadow in hardware, I can do it with alpha blending off, and lighting off.

If I try to blend the shadow it flickers.

After switching to REF device, blending is great, 2fps isn't so great!

I knew the FX5200 was lame, but thats something else! I've used it successfully for alpha blending before.... very strange.



Si
I have an FX5200, havn't had such problems yet (I thought I had some today, but I fixed it eventually).

I would, however, recommend testing this on another card, this might have something to do with uninitialized textures. They usually flicker, for some reason or another. I seriously doubt this is a hardware issue.

[EDIT] I'm not sure why, but when rendering in the REF rasterizer, it somehow clears out uninitialized textures, so the artifacts disappear. I'd recommend you recheck your code again, before giving up and calling it quits.
Sirob Yes.» - status: Work-O-Rama.
Are you rendering planar stencil shadows? I had the same problem with planar shadows on some nVidia hardware. I solved it with rendering shadows only to stencil and then rendering big alpha-blended quad over the screen (only on areas where stencil test passed). I hope it helps.


Sorry for my english.

This topic is closed to new replies.

Advertisement