[GSoC 2012] Implement Real-time Caustics

Threads related to Google Summer of Code
Post Reply
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

[GSoC 2012] Implement Real-time Caustics

Post by Naman Gupta »

Project Proposal

I would like to implement Real-time Caustics as my project for 2012 Google Summer of Code. More about the project can be found here http://graphics.cs.ucf.edu/caustics/

Motivation
Presently ogre has a water system. That responds perfectly with the meshes. But it has no effect of refraction when a light is introduced to it. Same is the case with other translucent bodies.
Implementing it, ogre would not only be able to render real-time caustics but a basic ray tracing system would also be implemented.

What are caustics?
Caustics are complex patterns of shimmering light that can be seen on surfaces in presence of reflective or refractive objects, for example those formed on the floor of a swimming pool in sunlight.
Whenever a ray of light enters or exits a translucent object it undergoes refraction which is given by the formula for this image.

Image
Image


The change in angle is the cause of caustics.

Also the shape of object describes the caustics. Like swimming pool water would generate different caustics then a glass of water. As the ray of light advances through the medium it’s intensity gradually decreases.

Implementation:-
Here are the projects whose reference I’d use
http://developer.nvidia.com/node/109
http://www.divms.uiowa.edu/~cwyman/pubs.html

The caustics mapping algorithm runs entirely on the GPU, therefore freeing up the CPU to perform the numerous other tasks required in games such as the AI. Conversely, that also implies the reader should have some knowledge of vertex and pixel shader programming which ogre3d does in order to fully understand this algorithm. The graphics API and shader language used in this implementation are Microsoft DirectX 9.0 and HLSL; however it is equally convenient to implement the algorithm using OpenGL and GLSL or CG. Lastly, a graphics card with support for shader model 3.0 is required since the algorithm performs texture lookups in the vertex shader.
I’d be using caustics map to do this. The algorithm is conceptually quite simple and intuitive. It starts with tracing light through the refractive object. The footprints of the refracted light are then collected onto an image plane facing the light source to create a caustics map. Caustics are then rendered onto surfaces by looking up the caustics map. Following Figure shows it’s working.

Image
Image


caustics mapping from an implementation oriented perspective. Following are the main steps of the algorithm:
Step 1: Setup refractive vertex grid.
Step 2: Create caustics map.
Step 3: Render caustics on receiver geometry using the caustics map.

A “refractive vertex grid” has to be created. it is simply a set of vertices that will be “splatted” wherever rays of light hit the receiver geometry. Think of it as a paint ball being thrown at a wall, and thus creating a splat on it. In our case, the paint ball is a vertex which represents a photon (or a number of photons), and the wall is the receiver geometry, i.e., surfaces on which the caustics can be formed. The idea is that if multiple vertices, traveling along the light rays, end up getting splatted at the same point, that region will become brighter. Recall that this is exactly what we wanted to simulate for rendering caustics. The results of the splatting are stored in a texture called the caustics map. Then in the final rendering stage, each point on the receiver geometry is projected into the caustics map texture to determine the amount of caustics it receives, if any.

Schedule

 April 23 – May 21:- Get to know mentor. More deeply understand the implementation and discuss with mentor how to approach it.Learn shader programmer, and more deeply understand ogre’s infrastructure.
 21 – 31 May:-. Setting up things to code like software and tool. Setting up repo and version control. Making everything ready to start coding. I might have practical exams for 3 days straight on unknown dates.

June:
 1 - 10 June:- develop the environment. Put a light source and add as a transparent sphere
 11 – 20 June :- implement basic ray tracing algorithm
 21 – 30 June:- :- begin coding on caustic mapping algorithm. Write Cg shaders for basic implementation of algorithm. That would support few light source

July:
 1 – 13 July:- add all light source and test it for other objects like cubes, triangle
 14 – 31July :- get it to work for more complex objects like water and meshes.

August:
My college would start but won’t be an issue
 1 - 20 August:- Documentation, fixing bugs, glitches and optimization.

Final implementation would allow ogre to do something like this.

Image
Image
Why I’m The Person For This Project

The project I have proposed coincides with the my major area of interest that is computer graphics.
I’m currently Pursuing B.Tech( Bachelor of technology) in Computer Science and Engineering from Meerut Institute of Engineering and Technology, Meerut, UP, India. I'm presently in 2nd year(4th semester). Subject I have undertaken:- Automata, DBMS, Microcontroller(8086), Industrial sociology, Soft Computing and Computer Organization. Computer graphics is in next semester but i have learned self-taught it myself.

I have been coding since I was in 5th grade. I have been intern for 2 gaming companies.
My game for iOS is available on App store that I made with a group of 4 members for Version2Games, Hyderabad.
I have also worked with MechMocha(earlier called Hungry games), Gwalior as an intern. Where I made a base engine for an iOS game with group of 3 members using cocos2d. Game is yet to release.

(PS:- if needed reference can be provided)

Some of my casual games and projects can be found here
http://namanguptagameprogrammer.in/Projects.htm

More about me can be found here
http://namanguptagameprogrammer.in/AboutMe.htm

Why OGRE?

I’ve great interest in graphics. I have learned a lot by looking at the codes of ogre engine. So I’d be happy to contribute to the organization I learned from.

Anything Else

I know the project I’ve proposed it quite difficult but I’m sure with little help from mentors and web I’ll be able to handle it and deliver it on right time. I wanted to be associated with ogre even after GSoC. I’d also like to be mentor for next year’s GSoC. Reason why I’m doing this under GSoC is just so that I could pay my college fee and buy book to continue my education.
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2012] Implement Real-time Caustics

Post by Naman Gupta »

Any suggestions
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: [GSoC 2012] Implement Real-time Caustics

Post by Assaf Raman »

Interesting topic, nice presentation, I am not sure how useful will the end result will be to the OGRE community, we prefer core projects that has the most use for the community, perhaps you can suggest a more useful project - as I am very impressed by you and your application and want to give you a better chance to be selected. Think about the Google summer of code from our perspective - we want students to experience our open source coding, most of what we add to OGRE are common ground features, infrastructure - so infrastructure has priority over "nice demo of 3d".
Watch out for my OGRE related tweets here.
User avatar
Naman Gupta
Gnoblar
Posts: 14
Joined: Wed Feb 22, 2012 6:15 pm
Location: Meerut, India
x 2
Contact:

Re: [GSoC 2012] Implement Real-time Caustics

Post by Naman Gupta »

i respect your opinion.
But i firmly think that this project of mine would not only demonstrate the power of OGRE but would also help the community.
people can use this code in their games to add amazing caustics effects like in game crysis or in any other AAA.

i can modify my proposal to "add this feature" so that people can use it by libraries,code and headers into ogre instead of just implementing it.
what say?
-naman-
Post Reply