Project Declension 2008 (Yes! Crepuscular rays)
I've got a problem understanding the eye adaption formular. Here's the formular from http://msdn2.microsoft.com/en-us/library/bb173484.aspx
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.
Code: Select all
float fNewAdaptation = fAdaptedLum + (fCurrentLum - fAdaptedLum) * ( 1 - pow( 0.98f, 30 * g_fElapsedTime ) );
Thanks for help again.
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.
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
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
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 ^^
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.
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.
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.
Sorry for the enormous amount of questions.
Several updates to my lighting shaders to look a little nicer and the HDR. Blurry stuff should gladly be a past. 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
With buggy SSAO which looks more like a noise enhancement
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.
No SSAO
With buggy SSAO which looks more like a noise enhancement
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.