[GSoC 2011] Off-Screen Particles

Threads related to Google Summer of Code
Post Reply
luluathena
Gnoblar
Posts: 6
Joined: Sun Mar 20, 2011 7:16 am

[GSoC 2011] Off-Screen Particles

Post by luluathena »

Hello all,
My name is Liu Lu. This my second year as a graduate student. I'm in the State Key Laboratory of CAD & CG in Zhejiang University of China.

C++ is my most commonly used programming language. I participated in a project about computer animation before. In this project my job is to do physics and collision simulation of cloth animation in CPU. After that I used CUDA to implement the simulation in GPU. I also wrote some other programs such as Ray Tracing and Rigid Body Collision.

I'm really interested with graphics engine and I've heard so much things about OGRE. I want to program for OGRE. I read the help requested page and found "Off-Screen Particles" interesting. I have some experience about GPU programming so I think I can do it. :)

So ... whom should I talk to about this task? I didn't find the mentors list..... :?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Re: [GSoC 2011] Off-Screen Particles

Post by tuan kuranes »

Here is the good place to expose, discuss and get help shaping your gsoc proposal.
Try to shape your proposal here, discussing your choice with Ogre users, listing goals, deliverables, planning before submitting it to the gsoc website/interface.
luluathena
Gnoblar
Posts: 6
Joined: Sun Mar 20, 2011 7:16 am

Re: [GSoC 2011] Off-Screen Particles

Post by luluathena »

tuan kuranes wrote:Here is the good place to expose, discuss and get help shaping your gsoc proposal.
Try to shape your proposal here, discussing your choice with Ogre users, listing goals, deliverables, planning before submitting it to the gsoc website/interface.
Thank you for your answer. I will upload my proposal as quickly as possible. :)
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [GSoC 2011] Off-Screen Particles

Post by Noman »

Writing a full proposal is a bit much for a first step towards a project. Writing a small summary (sometimes referred to as an abstract) is a better place to start.

Try reading enough to write two or three paragraphs about what you want to achieve in this project, and then try to estimate how much time these things will take.
That is (in my opinion, of course) the best starting point for a project discussion. You'll see that everything flows naturally from there.
luluathena
Gnoblar
Posts: 6
Joined: Sun Mar 20, 2011 7:16 am

Re: [GSoC 2011] Off-Screen Particles

Post by luluathena »

Personal Details
Name: Liu Lu
Email: luluathena@gmail.com
OGRE Forum username: luluathena
GTalk: luluathena@gmail.com

Project Proposal
There are two reasons for me to implement Off-screen Particles for OGRE. Large particle systems are common for smoke, fog and so on. Those effects can easily fill the screen then the FPS decrease quickly. Secondly, particle sprites are widely used in games. But when they intersect with the objects in the scene, artifacts usually come out. Like Fig 1 from the ParticleFX demo. These problems can be solved by off-screen particles. Efficiency and visual effects can both be improved.
Image
Fig 1

Here I just suppose each particle has been expanded into polygon and parallel to screen in Geometry Shader. The algorithm is progressed in pixel shader. Off-screen particles can greatly improve the performance when particles are nearly filling the screen. If user choose to use off-screen particles, they should also specify sample scales like 2*2, 4*4. The sampling function in step 2, soft particles levels in step 3 and whether to use mixed-resolution rendering in step 3-4 will all influence the FPS and effect. These options are a bit complex for user to compose. To simplify the implementation I want to organize them like "low_effect | medium_effect | high_effect" or something.

1. Render all solid objects in the scene and get the depth buffer.
I searched the forums to see how to get the depth buffer in OGRE. Seems like RenderSystem didn't have this function. And I found that most common method is to use a floating point render target and render the depth in pixel shader. In [1] there is a similar method. They use MRT to store the depth values into a FP32 render target while rendering the scene in the first pass. But it's hard to integrate. Another method is direct access to the values in the depth buffer, supported by DirectX10 and OPENGL. So it's not cross-platform....I'm still looking for a method to get depth buffer from the shader while user doesn't need to do anything.

2. Down-sample the resulting depth buffer.
Which sampling functions to choose has to be application defined. To solve halo problem then choose the maximum depth of the a*a pixels as sample pixel. But the particles will encroach into the object. Or simply point sampling is used. Even both methods have inherent drawbacks, introduction of linear blending in step 4 will hide a large part of the artifacts.

3. Depth test with off-screen target and edge detection.
To avoid artifacts between particles and scene objects, use a “contrast” function to get zFade [1]. Fig 2 is the contrast figure. However the function can be time consuming since it's complicated and even got a pow() in it. In GPU Gems3 Chapter 23 they choose an easier approach in [1] - zFade = saturate(scale * (myDepth - sceneDepth)). In most situations this function is fairly enough.
Image
Fig 2
Alpha blending states should be specified then particles are accumulated in the off-screen target. For mixed resolution rendering, we should use Sobel algorithm to detect the edges of render target and store in another off-screen render target. It's not necessarily to use mixed resolution rendering if the blocky artifacts are acceptable.

4. Composite the particle render target back onto the main frame buffer, upsampling.
At the first time render low resolution particles to pixels that are not marked as edges. Then render particles at full frame-buffer resolution to pixels that are marked as edges. Just like the figures in Chapter 23 of GPU Gems 3.
Image
Fig 3

The demos will show the results under different options. And just like Chapter 23 of GPU Gems 3, there will be some tables to show the FPS differences.

Schedule

April 20-May 20
Discuss with mentor, learn shader language, read source code of OGRE and study on the interfaces.

May 21-May 30
Finish the detailed-design document.

May 31-July 16
Implement the algorithm, test the code.
  • May 31 – June 5 Step 1.
    June 6 - June 15 Step 2.
    June 16 -June 30 Step 3.
    July 1- July 10 Step 4.
    July 11 - July 16 Test the code.
July 17-August 1
Scrub the code, write tests

August 2-August15
Make demos and improve documents.

Why You’re The Person For This Project
I’m a graduate student in the State Key Laboratory of CAD & CG, which belongs to Zhejiang University in China. My major is Computer Graphics. So far I have worked on a project about physics and collision simulation of clothes animation in CPU, implemented with C++ and OPENGL. Then I used CUDA to rewrite the simulation program into GPU. I also wrote some other programs such as ray tracing and rigid body collision. Recently I’m doing something about stereo correspondence. It’s nearly completed. I’ve heard a lot of things about OGRE, but I haven’t used it before.

Why OGRE
I’m really interested in 3D graphics engine and games. So I checked the organizations’ list with those keywords and I found OGRE. I have been long wishing to study on OGRE and I think this is a good opportunity. Luckily I found “Off-screen Particles” in ideas list. There are some similar points between the algorithm and cloth collision simulation I did before. Particle systems seems fun to me. That’s why I decide to apply to OGRE.

[1] Lorach, Tristan. 2007. "Soft Particles." In the NVIDIA DirectX 10 SDK. Available online at http://developer.download.nvidia.com/SD ... les_hi.pdf
-----------------------------------------------------

I'm going to read the APIs and figure out which language should I choose to implement according to the compatibility. Will anyone give me some advices?
Thank you for your time.
Attachments
23fig07.jpg
23fig07.jpg (35.55 KiB) Viewed 10954 times
SoftParticles_hi.png
SoftParticles_hi.png (45.82 KiB) Viewed 10954 times
Untitled2.png
Untitled2.png (49.72 KiB) Viewed 10954 times
Last edited by luluathena on Fri Mar 25, 2011 12:00 pm, edited 2 times in total.
luluathena
Gnoblar
Posts: 6
Joined: Sun Mar 20, 2011 7:16 am

Re: [GSoC 2011] Off-Screen Particles

Post by luluathena »

Noman wrote:Writing a full proposal is a bit much for a first step towards a project. Writing a small summary (sometimes referred to as an abstract) is a better place to start.

Try reading enough to write two or three paragraphs about what you want to achieve in this project, and then try to estimate how much time these things will take.
That is (in my opinion, of course) the best starting point for a project discussion. You'll see that everything flows naturally from there.
Thanks for your advices. I have read chapter 23 High-Speed, Off-Screen Particles in GPU Gems3. Now I will go on read the documents and code of OGRE :) And I plan to draw a flow chart and add some pictures to my proposal.
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 2011] Off-Screen Particles

Post by Assaf Raman »

Note: Part of the work will be a demo that include playing with different parameters like off screen texture size, an option to see different stages of the process (like Figure 23-6 and Figure 23-7 in GPU gems) and a real time diff image that compares the scene as rendered with and without.
Watch out for my OGRE related tweets here.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: [GSoC 2011] Off-Screen Particles

Post by jacmoe »

Smoke and fog in Ogre would be really, really awesome. :D
This project will really help make that happen.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [GSoC 2011] Off-Screen Particles

Post by Noman »

Its a nice start for an application. Of course you currently have a lot of stuff open, but you know that, so I'm not worried.

A few questions that you should think about :
1 - How do you plan to integrate this into OGRE? Ideally, a user shouldn't need to know about the implementation of the technique to use it. Is it enough to raise a 'render off-screen particles' flag or do you need additional input from the user?
2 - How do you plan to test/showcase your progress? Do you need additional art assets (particle textures, for example)? How do you plan to get them? It might be a good idea to check out what assets the papers & demos use, and check to see if the Ogre samples include media that is sufficient to make a cool demo. If not, don't forget to factor this into your time planning.
3 - Remember that the technique needs to work on all capable render systems (you won't make glReadPixels calls from your code, but rather use the RenderSystem API). Does the current Ogre API give you access to all the data you need? If not, is it truly cross-platform (for example, does the DirectX9 API allow you to read the depth texture)? You might have to add some functions to the RenderSystem (API and implementations). Make sure to find that out as early as possible, and plan accordingly.

@Assaf
I agree that those features could be cool, but some of them will be time consuming (the image diff one is probably the biggest one). I think we should let luluathena think it over (and estimate how much time the different demo options will take) and continue from there.
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 2011] Off-Screen Particles

Post by Assaf Raman »

Agreed.
Watch out for my OGRE related tweets here.
luluathena
Gnoblar
Posts: 6
Joined: Sun Mar 20, 2011 7:16 am

Re: [GSoC 2011] Off-Screen Particles

Post by luluathena »

I will give a lot of thought to your questions and rewrite my application. Thank you all for your prompt responses :D
luluathena
Gnoblar
Posts: 6
Joined: Sun Mar 20, 2011 7:16 am

Re: [GSoC 2011] Off-Screen Particles

Post by luluathena »

I have read Chapter 23 and NVIDIA paper again. I also read the user manuals and some related web pages. Look forward to your feedbacks about my updated proposal. :D
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Re: [GSoC 2011] Off-Screen Particles

Post by tuan kuranes »

Nice proposal update.
Miss a fast "current state of the art" of the topic : on soft particle (like http://www.ogre3d.org/forums/viewtopic.php?t=41345 but also http://directtovideo.wordpress.com/2009 ... le-system/ etc...
So that you can make sure the framework you'll add is generic enough and allow further enhancements (which you could list)
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: [GSoC 2011] Off-Screen Particles

Post by Noman »

The updated application is good.

Two things about the timeline & plan :

A) It feels a bit like "putting all your eggs in one basket" - if you don't get to the finish line, the Ogre project doesn't get anything from your work. Is there a way to replan your stages in a way that will allow the Ogre users to use your work as building blocks in case you don't do everything you planned?

B) Tests/demos after coding : You currently plan to write the demo after you finish the entire implementation. How will you test the different steps without a demo? Perhaps some mini-demos for some of the stages could help you do that?

These two notes are connected to each other, but I believe they need to be addressed.

Good luck!
User avatar
conkienlua
Deactivated User
Posts: 5
Joined: Tue Sep 20, 2011 6:57 pm

Re: [GSoC 2011] Off-Screen Particles

Post by conkienlua »

This actually reminded me of the first thought that came into my mind when i first learned about 3D in one of my first computers:
That the most real possible way to model stuff in a computer would come down to particles glued together.
Of course that we don’t have the computer power to do that just yet, but i think experiments such as yours do get us in the right direction.
Thanks for sharing
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 2011] Off-Screen Particles

Post by Assaf Raman »

FYI: This project was never implemented.
Watch out for my OGRE related tweets here.
Post Reply