[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]
I snapped, I finally bought a video card that supports shader model 3.0 :) That means i could work on my HDR shader again !
Two new things to write about then, HDR and Rain.
HDR:
To achieve the HDR effect, the rendering goes through 6 steps. All of these steps are rendered to textures that are re-used in the next step.
1 – Render to small texture
To make a better rendition of the blur effect, a render to a small texture is used. The texture size I chose is 128x128.
2 – Perform luminance / brightness filter
The goal of this step is to transform the image to black and white, and to reduce or increase the brightness of the whole image.
3 – Perform a Horizontal Gaussian Blur
With a technique I found in NVIDIA and DirectX SDK, a horizontal blur is applied on the rendering.
4 – Perform a Vertical Gaussian Blur
Same as above, but vertical.
5 – Render the original image on the back buffer
6 – Render the texture of Step3 with blending, on the back buffer
This last step renders the blurred texture over the original image. The result is what is on the images below.
![[HDR] Night flight under light rain ...](/blogs//images/labtech_epitech_net/matt/52/t_Screenshot-1076.jpg)
Rain ... Dark skies ... - Night flight
Left : Light gloom effect - Right : HDR
![[HDR] God's Airplane ;-)](/blogs//images/labtech_epitech_net/matt/52/t_Screenshot-1067.jpg)
God's Airplane in heaven hehe :-)
![[HDR] Overbright ;-)](/blogs//images/labtech_epitech_net/matt/52/t_Screenshot-1072.jpg)
Left : Overbright tests - Right : Blurry :)
I like what this effect does to the flight simulator, it makes it look less crispy and more movie like.
I know you have comments on the overbrightness of some of the images, but these were only tests, and all the parameters in the shaders are completely customisable. I think i'll leave it up to the users to configure them to whatever value they prefer :-)
One last comparison for a light effect :
![[Gloom] Gloom ON](/blogs//images/labtech_epitech_net/matt/52/t_Screenshot-998_Gloom.jpg)
Left : No Gloom - Right : Gloom
Rain:
To create a rain effect in the simulator, I had two options in mind.
The first one was to create some sort of particle system, with rain drop textures on every particle, and make them move down, just like real rain.
The second one was to render a couple of blended cylinders with rain texture (vertical lines) on them, center them around the camera and perform UV animation on the texture to make the rain drops slide down.
I chose the second option since I think it takes less processing time to do a simple UV animation than it takes to render hundreds of rain drops.
To reduce the CPU effort on the UV Animation and to avoid uploading the vertex buffer to the video card each time I modify the cylinders, I moved the UV Animation logic to a vertex shader.
Here are some pictures of what it looks like. It might look crappy on still images, but when moving, it looks really nice.
All these images were rendered with gloom shader on.
![[HDR - Rain] Taking off in the rain ...](/blogs//images/labtech_epitech_net/matt/52/t_Screenshot-1102.jpg)
Nasty weather
![[HDR - Rain] HDR and Light rain ...](/blogs//images/labtech_epitech_net/matt/52/t_Screenshot-1093.jpg)
Cessna 210 Light rain
![[Rain] Raining ...](/blogs//images/labtech_epitech_net/matt/52/t_Screenshot-1025.jpg)
Rain ...
Happy Landings!