Tuesday, April 26, 2011

Final Post

I'm just doing my final post with all of the links to everything now:

Saturday, April 23, 2011

Final Fluid Color Composite

I fix the final color composite this morning to add in all of the necessary pieces to get some decent looking water!

I also adjusted the blur function in order to shrink the artifacting happening around the screen-space fluid boundary, so that is a lot smaller. Although the blur isn't perfect its looking a lot better so if I have time next week I will decompose the blur function to make it a little better.

Next step will be to add in curvature flow to the normals calculation instead of just a basic blur, but I will see if I have time to do this as I really need to get finished with my senior design...

Friday, April 22, 2011

Seperate Rendering Passes

So today I completed all of the seperate rendering passes which I will need for my fluid simulation, this includes the addition of fresnel cube map reflections and a refraction approximation using the background texture, as well as a thickness map which I use to create color attenuation through the fluid volume. The video below illustrates all of the seperate passes:

My next and final steps for this project will be to come up with a final rendering equation using all of these different attributes blended together in different ways to get a realistic water surface, and to go back and fix some of the things which are not working perfectly: these are mainly the bilateral filter for blurring the depth field, which doesn't look perfect yet and has a lot of artifacts, and adjusting the normal distribution of the per-particle additive blending that I do to get thickness (even though the distributions look pretty good you can still tell they are discs so the gaussian distribution of color isn't perfect).

Thursday, April 21, 2011

Specular and Diffuse

After fixing both the normal depth computation and the way I retrieve the viewer positions (in order to get accurate reflections from fresnel, specular, environment maps, etc.) I am able to get some pretty good looking diffuse/specular lighting! In the following video I have also adjusted the light source such that the light is direction and the direction does not change with the view (the direction changes in eye space but remains stationary in world space) which leads to a more realistic lighting effect now that we have real lighting.

My next step (within the next day hopefully) will be to use this stuff to get accurate fresnel approximation reflections, and add a thickness pass with additive blending to get light attenuation through the fluid volume.

Wednesday, April 20, 2011

Moving Forward...

After getting the multiple textures to work, I worked on getting all of the rendering passes I would need to compute the final rendering image. This included a background "skybox" render texture, a blurred depth map, and a normal map computed using the depth map. Here are some videos of the results. Currently my bilateral filter which I used to blur the depth map is having a lot of artifact problems, and coming up with good functions to relate depth to blur radius is a bit of a problem.

I will definitely come back to that issue after I have set up all of the other render passes and gotten some sweet looking water.

Here are some videos of the current results.

Basic render-to-texture with normal map computation stuff + skyboxes.

Render to texture + blurred depth map resulting in normals which would define water which looks a bit more watery.

Psychadelic acid-trip normal map super bug. This happened because I was accidentally discarding the depth values for non-fluid pixels, which led to the texture never being cleared so that the normal map texture was only written on current fluid pixels. Whoops.

Tuesday, April 12, 2011

Point Sprite Rendering

The past week I managed to integrate my fluid simulation from CIS565 into a custom renderer which I am writing for this project. This custom renderer will house all of the required OpenGL calls and functions to render the fluid simulation.

So far I have completed being able to render point sprites and various pieces of information which I need, to a depth texture (also a color texture and a normal texture). The next step is to take the depth texture, perform a Gaussian blur pass (or multiple passes) and compute a normal texture based on the Gaussian blurred pass.

Wednesday, March 23, 2011

Proposal and References

Real time fluid rendering and liquid surface reconstruction is a problem which still has yet to been truly solved perfectly for a range of different fluid dynamics problems. Even offline renders which are based on particle-fluid methods  such as marching cubes to extract a mesh from a grid function have not produced 100% accurate results. In addition, the more accurate methods of surface extraction require a lot of memory and execution time, which do not make them very amenable to real time computation.
For my CIS565 final project I plan on implementing a NVIDIA developed approach for rendering the surface of of a particle-based fluid (in this case, SPH). This approach is a method which according to NVIDIA is simple to implement and can achieve real time performance with over 10,000k particles. In addition it does not use polygonization, voxelization (which means it does not deal with grid artifacts inherent to marching cube renders), and has parameters so that the user can control both surface level detail and smoothing.

The method is basically a way to use SPH particles themselves instead of trying to extract a polygonization, by transforming them insto perspective space. At the highest level, we start from each fluid particle positions and extract surface depth, thickness and positions. Then smooth the surface depth using a gaussian filter, then create a dynamic (adjustable) noise texture on the fluid surface, and then finally we have a compositing pass which will combine the surface depth, the noise texture, and the background image scene into a final rendering of the fluid. 

In addition to this method I want to add a metric for rendering, so I may either integrate a real time marching cubes library (or write one using CUDA myself) and a point splatting shader for each particle to show some alternative fluid rendering methods, and perhaps to show why NVIDIA's is superior for large scale simulations with a lot of particles.
The paper I plan on implementing is this one:
Screen Space Fluid Rendering with Curvature Flow
With references to:
Screen Space Meshes
Screen Space Fluid Rendering Presentation