Tuesday, February 27, 2007

GPU Geometry Clipmaps WIP

I finished writing frustum culling and cleaned some c++ & shader code. Next step, generate normals on the fly, better terrain texturing, optimize a bit frustum culling and draw the outer degenerate triangles.



Grid Size 255, 8 Levels on a 6200 !

Sunday, February 25, 2007

GPU Geometry Clipmaps WIP

I made some progress, now the average of coarser works. I need to rewrite my update function because coordinates system is all messed up.



Edit : i finally finished coding GPU Geometry Clipmaps and it works !!! pfiouh ... Now it's polishing time.

Friday, February 23, 2007

GPU Geometry Clipmaps

I received a new 6200 with SM 3.0 and i just restarted working on my implementation of GPU geometry clipmaps "Terrain Rendering Using GPU-Based GeometryClipmaps". As you can see in the screenshot, i have problems during the update with the coordinates system and the average of the coarser elevation map. There is a lack of information in the paper, the shader code on the GPU gems II and the demo doesn't give explanations of how it works.


Edit : After a few tries, i almost fix it but i still get errors when uv coordinates cross the boundary of the texture.

Monday, February 5, 2007

Aerial perspective

Today, i coded the Aerial perspective given in the ONeil GPU Gems II chapter. It looks quite nice but need some GPU power. That's why i want to use another technique but seems that it's hard to mix different techniques, one for skycolors and another for Aerial perspective.


Sunday, February 4, 2007

Realtime rendering of atmosphere scattering

I am going to talk about what i tryed to code in the past few days, SkyColors for a SkyDome. There is some papers about it, seems that there is not as much research on it as terrain rendering.

I started with A. J. Preetham's publications : "A Practical Analytic Model for Daylight" and "Rendering Outdoor Light Scattering in Real Time". I tryed to code the equations given at the end of the second paper but didn't get what i expected. Those equations give a luminance and chromaticity color sample in Yxy Space and need to be converted into RGB space, this is something that is not described in the paper and that the reader must find out.

After a few searches, you can understand this by reading "A Practical Analytic Model for Daylight" and finding "Day light sky color" that explain how to get RGB colors from Yxy Space. So, in the PS you must convert "Lin" and "Fex" values before using them. With that i finally got a blue sky and i played a bit with parameters but didn't got good results.

I gave up Preetham papers and looked for something else... and i found "Real Time Rendering of Atmospheric Scattering Effects for Flight Simulators". At the end of the paper, the autor give the code so i tryed it and got better results for skycolors. The code also has some features like and automatic Henyey Greensein's G value computed with the camera 's Y and the theta angle between sun and it's zenith. I also got some problems : during night the skydome is white and the sun is too big during day, even for a little ESun value. There is also some blanks in the code that i didn't fill : some variables a set in the C++ code that don't exist in the FX effect file, etc ... i didn't found how to contact the author and my post about his paper on gamedev didn't got feedback ( i guess nobody tryed to get it working ). Since i couldn't make it work properly i searched for others technique.

And came up with ONeil optimisations article about "Display of The Earth Taking into Account Atmospheric Scattering" on gamedev. I discovered that ONeil had written a article on Atmospheric Scattering for Gpu Gems II book, so i download the source of the chapter 16 on NVIDIA website. I convert his CG SkyFromAtmosphere shader and tryed it, but like many others people only the top of the dome had skycolors. After a few looks in his code i found that he used a special ModelMatrix that set the camera at origin, with the Y value equal to the InnerRadius and subtract camera's position from translation values of others objects ModelMatrix. At last, i finally got something realist and nice to watch.

Even if his method give pretty good results i didn't stop searching and also found "Real-Time Atmospheric Effects in Games" that decribe how they have done the atmopshere scattering and haze effect in the CryEngine2 that seems quite easy to implement and costless but that need SM 3.0 graphic card because it uses FP32 textures.