Project Declension 2008 (Yes! Crepuscular rays)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Wow, that first image looks really good. Starting to look like HDR :)
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

I've got a problem understanding the eye adaption formular. Here's the formular from http://msdn2.microsoft.com/en-us/library/bb173484.aspx

Code: Select all

float fNewAdaptation = fAdaptedLum + (fCurrentLum - fAdaptedLum) * ( 1 - pow( 0.98f, 30 * g_fElapsedTime ) );
So if fCurrentLum is my current scene luminance, then where do I get the values for fAdaptedLum? Also, do I use device.timer.time for g_fElapsedTime?

Thanks for help again.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

adaptedLum is probably the "fNewAdaptation" from the previous frame, I think.

I already did a similar thing to the eye adaptation, here is a video: http://www.youtube.com/watch?v=-yR3AYxT3Xc

I recall using something like a "brightness velocity", basically I would continually decrease/increase brightness velocity based on the difference of the current brightness to the brightness of the last frame, whilst at the same time decreasing this velocity by multiplying it by 0.95 or something every frame.

This would lead to the effect of a rapid brightening or darkening depending on where you look, and then it will eventually stabilize after a few seconds if the overall brightness does not change.

Be careful on sampling the scenes brightness though, it wont work in OpenGL because retrieving the RTT from vram isn't currently working there, in DX it does work but either way this kind of thing will heavily impact your framerate, unless you are thinking of doing all the processing on the GPU, but it is kind of impossible because you have no place to store things like that brightness velocity thing, or the "adaptedLum".

Anyway, good luck with this.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Blind, that vid is nice, but one of the reason it looks unnatural is your eyes will close when some light enters them from anywhere. To simplify, divide your screen in 2. You currently get your scene brilliance, let's give it 10. Well, in your code, it seems as if (5/5) will give the same effect as (10/0). With your eyes, (5/5) ~= 7 while (10/0) ~= 10 ^^
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

I would love to start working on shadowing my scene with shadow mapping now, but I don't 100% understand the way to do it. Right now I'm planning on making a spot-light based soft shadow and here's how I guess it's done in Irrlicht, based on this article http://www.gamedev.net/reference/articl ... le2193.asp :

1. Create a 2nd camera at my point light.

For my game I'm probably going to use pointlights most of the time. However, I read that I need a cubemap as the shadowmap, which means doing the shadows 6 times. Anyway, I'll worry about this when I'm done with something simple.

Perhaps I would want a spotlight that shines at a wide angle so that it lights up most of the area. How wide can this angle go? Maybe I should use another mapping technique for such kind?

2. Render the scene with a depth shader.

That's probably the first step of what the article described. Now in step2, I'm confused.

Code: Select all

Next, we need to render the shadowed portions of the scene to an offscreen buffer so that we can blur it and project it back onto the scene. To do that, we first render the shadowed portions of the scene into a screen-sized fixed point texture.
What is this suppose to do? Does it read from the shadowmap + shaders to create the shadows? All this happens from the point of the player's camera?

Sorry for the enormous amount of questions.
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

Here's what I got applying the depth shader on the tables.

Image

Anything I apply this shader on will be white. There isn't any errors in the console and I used the code from the article. Why?
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

rgb values got blown off, maxed out.

check the fragment shader, something is pushing the values too high.

try brute forcing output.rgb to gray and see if they work. then backtrack/debug backwards.
Image
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

Yeah, it's too bright. I divided the output by 700!
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

what the...

that's too bright. it's now irradiating light.

hehe

let us know what's going on in there.
Image
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

Forget my stupid questions over the last few posts. I think I know what I'm suppose to do. :D I had to arrange my code for the new functions and that's probably the hardest thing to do. Anyway I got my depthmap rendered. Now for the screeen buffer...
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

Uhh, I've got a bit of problem. How can I map the depthmap onto my mesh when I've downscaled most of the materials in the mesh?

Thanks.

EDIT: Ignore the n00b question. :oops:
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

Several updates to my lighting shaders to look a little nicer and the HDR. Blurry stuff should gladly be a past. :D I also tried to inplement screen-space ambient occlusion and right now there's some error with the depth comparaison but anyway, the normals are working.

No SSAO
Image

With buggy SSAO which looks more like a noise enhancement
Image

I've got a more vivid update and few more screenshots in my site here: http://www.orandysoftware.com/

I'll keep you updated with my SSAO progress. Cheers.
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

My latest updates at the first post. Check it out.
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

I can't find a link to a demo, or there isn't a one ready ?
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
jingquan
Posts: 222
Joined: Sun Aug 20, 2006 4:10 am
Contact:

Post by jingquan »

I'll post a demo soon when I get some code sparkling. :D Hold on.....
Post Reply