Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / not really realtime light/shadow theory test

Author
Message
thebulk71
18
Years of Service
User Offline
Joined: 2nd Jan 2006
Location: takin a poop
Posted: 26th Mar 2008 01:04
Hi all. I've been looking at all these different shadow methods. and I thought I'd take a leap into it too. I came up with a theory that could well work. however, I only have a DBP coded simulation to test the theory. Now if I can get this working in a shader then maybe we'll finally have doom3 style shadows. Anyways. Here's a small demo.

move around like in any old FPS. Click with the mouse to place the light source at the cameras position. hold E to render the small shadow/light simulation.

Attachments

Login to view attachments
thebulk71
18
Years of Service
User Offline
Joined: 2nd Jan 2006
Location: takin a poop
Posted: 26th Mar 2008 01:08
Here is a screeny before I get locked

Attachments

Login to view attachments
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 26th Mar 2008 01:27
You don't need a shader to just overlay the scene with an illumination map, but you could. You'd be best off just placing a plane in-front of the camera with this texture but instead of writing black/white to the texture you'd be best off writing alpha, then you can just alpha map this plane and the dark bits will become black.

Also raycasting for shadows isn't anything new, by default many offline renderers use this, but it's not really fast enough for real-time, shadow mapping is far faster, plus you can generally get a higher res depending on the methods used.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Mar 2008 04:49
A for Effort! Keep thnking up stuff bro - Shadows are always a pain - keep seeking solutions! We'd love to be shown a trick or two! Seriously! Keep at this kind of problem solving! We need more of it...ALWAYS!

thebulk71
18
Years of Service
User Offline
Joined: 2nd Jan 2006
Location: takin a poop
Posted: 26th Mar 2008 12:05
Dark coder:
I am totally aware of how to overlay without using a shader. I just didn't bother adding it because I felt the results showed enough. When I mentioned a shader, I was merely stating that the actual shadow calculations could be done with it. This method is merely a heavy distance check for every pixel (or two) of the screen, I'll clean it up and add light radius/falloff and multiple lights. It is actually an alpha map by nature, I just added the white pixels to make it more visible.

I'm suspecting that this "method" is what Doom3 and Fear (etc...) use. Now that I have understood it, I can go about trying to write a shader that will carry out these calculations on a dedicated GPU processor, freeing up the main processor of this hefty algorithm.

I'm guessing that even a low(-ish) res alpha image can yield alright results, relying on mip-mapping or other tricks to blur it a bit. I'm just sick of the Z-clashing and speed loss of the DBP built in vertex shader, and decided to go about the issue of shadows differently. I strongly believe that this method can work well in real-time, and on a personal level, it would keep DBP game making alive for me. People make too many comparisons with DBP and next-gen titles so I thought cool shadows could re-vamp tho old DBP.

here is a quick screenie of what the shadows could end up looking like with the alpha overlayed on top.

Attachments

Login to view attachments
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 26th Mar 2008 23:14
That's very cool!

If it's in real time, meaning it creates a new shadow map and applies it to the alpha every frame, I'd love to see a video and know what frame rate you're getting. This is rather interesting.

3.11 We do not tolerate posts made for the purpose of putting down another forum member, group of members, religion, our company, our staff or any of our moderators, past or present.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 27th Mar 2008 01:39
I'm assuming you wish to quickly find the position of all pixels in the view(then raycast to the light source), which can be done in a shader quite simply. First you must create a render target, but instead of the standard Set Camera To Image you need to set an undocumented 5th parameter to 1(I believe) to make it render to a floating point texture. Once done, in your pixel shader, the colour you return should be the position that gets passed to it, it would look something like, return IN.Position;, however it's very likely such values get saturated(clamped to 0.0-1.0) using a floating point texture, so you may need to first scale the values to get the desired simulation size.

The next issue is reading from the texture, because render to texture images are locked in DBP, i.e. you cannot simply convert it to a memblock to grab these positions. Even if you could it wouldn't be very fast due to the GPU's limited bus read speed. And you can't do the raycasting check yourself in a shader as I assume you're currently either using Sparky's DLL or the native raycasting to calculate this, such a raycast cannot be done in a shader(or at least with no way near the flexibility). But you can try to read from it, I'm sure in GDK it'd be far easier to read from the render target, not to mention it'd be far faster.

wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 31st Mar 2008 23:18
interesting really!


PS: Real programmers aren't afraid of math!.
bergice
17
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 20th Jun 2008 11:36
Wow, nice!


Programming Recorder: 3,0 months of dark basic
tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 20th Jun 2008 15:58
I don't think you'll get locked Looks nice.


A mod has been erased by your signature because it was larger than 600x120
Deathead
18
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 21st Jun 2008 22:09
Looks nice.


Mr Snixx
16
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 30th Aug 2008 11:15
Doom 3 and Fear both use stencil shadows.

Mr Snixx

Login to post a reply

Server time is: 2024-11-24 05:33:49
Your offset time is: 2024-11-24 05:33:49