Shadow Mapping Transparency (Making Shadows Not As Black)

Started by
21 comments, last by Neutrinohunter 16 years, 1 month ago
I'm in the process of sending you an email, if that doesn't send (the src is nearly 5MB, class which is of interest is JShadowMappingAlgorithm.cpp though)

I've made the executable available from my website at www.jmecoding.com/Release.zip, should be uploaded in about 5 minutes.

Thanks very much Vilem, I just hope to god its not a driver issue otherwise I will go crazy!

Neutrinohunter
Advertisement
Maybe this'll sound crazy, but your app running ok (with shadow mapping) - it's not black (it's "blended" into colors of sorrounding enviroment). I haven't got property linear filter, cause I've got ATi card (and it's not giving bilinear PCF by hardware).

Image:

Free Image Hosting at www.ImageShack.us

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

Looks like its an NVIDIA bug then :(

Doesn't ARB mean it should be supported across all GCs?

How could I achieve the same effect? Another render pass?

Neutrinohunter
Well, that should be possible in several ways, i'm gonna to look at that today later (afternoon) ;) - I need some sleep and it's around 1 AM - oh almost morning again :D - here in Czech Republic (GMT+1)

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

I think its possible with another render pass, because thats how the tutorial at paulsproject.net works because he doesn't use GL_ARB_shadow_ambient.

I actually think I've got some code somewhere just in case it didn't work commented out (doh!). I'll have a try when I get back in, it was an all nighter at work, so will have a think while I'm travelling.

You said ATI cards don't have billinear filtering, is there an alternative than GL_NEAREST for targeting those cards? Your pictures of your shadows look beautiful, so I can't assume your using that filter. Again, correct me if I'm wrong.

Thank you very much for testing out the application, you have been very generous with your time and knowledge :) For now, I'll see if theres a driver fix or its a bug with my GC.

Just a quick question (isn't there always :)), how did the application run, did it crash/use up too much time/figure it out easily?

Maybe this'll sound crazy, but your app running ok (with shadow mapping)

Yeah its crazy it works on everybody elses machine and not mine! And thats not just the shadows :P

Thanks
Neutrinohunter
Well, I found a way how to solve shadow mapping and ambient lighting WITHOUT extension :). It's multi pass algorythm (who'd expected that?) - 2 pass.

1. Pass - render scene into texture WITHOUT shadow mapping and without lighting (so everything would be in full colored texture or full color).

2. Pass - render scene normally (this means with lighting and with shadow mapping), then draw one fullscreen quad blended additively into rendered scene. And voilá - shadows and ambient lighting running without extensions :)

There's alternative for ATi cards, it's hand-coded linear filter in X and Y direction of texture (so it's bilinear filter), but i don't know if it's possible without shaders (I'm doing it using shaders). I'm using PCML shadow mapping filter, which uses bilinearly filtered shadow maps - but there's way to use bilinear filtered shadows using variance shadow maps (they've got several disadvantages, but much more advantages - and the major advantage is speed...). Anyway to your app - it crashed several times, Stencil shadows weren't working (Stencil shadow volumes), but that all can be fixed ;). Don't know why it doesn't running properly on your PC, but I can test that on several other PCs if you want.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

Yeah, the stencil shadows was working till I started messing with it :) Was trying to remove the stipulation that it could only work for closed objects, now it doesn't work :P

Yes, I thought it might. Its quite unstable in its current configuration, thats my job for today.

If you have an NVIDIA card that might be useful to know its specs/drivers so I can make a comparison on them and see if I need a particular driver to make it work. (You never know). If so I'd be very grateful if you could.

Thanks, I'll try adding the multi pass code in and get back to you.

Any idea what the errors were? I'm assuming you got something like "Access Violation 0xC00000005", looks like I've got a rogue pointer somewhere [rolleyes]

Yeah, I've seen people implement bi-linear filters in one of my books on the shelf, so I'll check on that.

Thanks, Neutrinohunter

Thanks, Vilem.

Have managed to get a similar effect like you said using additive blending on a quad, so far I am unable to see why the GL_ARB_shadow_ambient extension doesn't work for NV cards, but thats a minor detail anyhow.

Have got an implementation that I'm happy with I just need to sort out problems with having textured objects in the scene because so far I get my model textured by the shadow map rather than its texture, no matter if I set two texture units up.

Neutrinohunter
i think this is the line that is causing your invalid enumerant

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 0.5f);

but unfortunately i dont know how to correctly use this compare_fail_value. anyone?
I believe that is what I used and it worked fine. The value appeared to scale each fragments colour between the full un-shadowed colour and black.

This topic is closed to new replies.

Advertisement