Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Z-Feathering( aka soft particles )  (Read 4935 times)
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« on: January 14, 2009, 12:42:25 AM »

I started working on this yesterday after I released Meadow. It is by no means perfect yet but I am already getting some pretty cool results.

For those of you that don't know what this is. It is a method of fading out pixel to stop things like billboard intersections( where the particles clip the floor for example and you get that ugly line ).

Here it is explained in Microspiel:

Quote from: Microsoft
Particle systems are a common method for creating volumetric effects in games. They can be used to simulate such things as fire, cloudes, smoke, dust, glowing projectiles, magic spells, and so on. A common technique is to use 2D camera-aligned quads centered at each particle to represent the volume that the particle represents. Because the quads follow the camera, they give the illusion of a substance filling a 3D volume. However, this illusion often breaks down when the 2D sprites used to visualize the particles intersect with the world geometry. The intersection of the 2D quad with the 3D world geometry creates a hard, straight line — on one side of the line is particle, and on the other is world geometry.

In order to lessen this, we can take a simple 4-step approach.

1: Render the world geometry, without the particles, to a floating buffer as depth.
2: Inside a vertex program, calculate the depth of each particle.
3: Compare the two depth values for discontinuities inside a fragment program.
4: Modify the alpha of the resulting pixel according and dump it to the screen.

Microsoft explain this with a diagram.

Quote from: Microsoft
In the basic flat particle system, the line where the particle quad intersects the geometry is a giveaway that the particles are not actually 3D. To avoid this, the sample can read back the depth buffer as a texture. In the shader, this depth value is sampled and tested against the depth value being rendered for the current pixel in the particle. The alpha value increases as the difference between the depth value in the buffer, and then depth being written out from the pixel shader decreases. Therefore, the particle becomes more transparent as it approaches intersection with the scene geometry.



We can see this at work in TV3D. The following images are always a mirror. The one on the left is TV's standard hard billboard particles and the one on the right is the exact same particles with a soft shader on them. Notice the intersects on the left side are not present on the right.

[click for 1920x1080]


Now, as I said, I haven't finished this yet. I am still getting artifacts along certain things, particularly that back wall. As can be seen here:

[click for 1920x1080]


I intend to get rid of those before I release source. Now, if I fill the floor of the room with particles, you can see that the standard hard-edged particles just don't stand a chance. Whereas the soft particles look quite nice, minus that current bug of course.

[click for 1920x1080]
Logged

-...-

Mietze
Community Member
*
Posts: 415

Pleeease, don't let it crash!


WWW
« Reply #1 on: January 14, 2009, 01:34:10 AM »

Hey arius, this is good stuff again Smiley The way I solved this some time ago was by adding a small depth bias, as you know this from shadow mapping. Maybe its worth a try? Looking forward to see the animated result Cheesy
Logged

Check out my blog at www.e-studioz.de - The finest in gross trash Wink
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #2 on: January 14, 2009, 01:43:45 AM »

Hey arius, this is good stuff again Smiley The way I solved this some time ago was by adding a small depth bias, as you know this from shadow mapping. Maybe its worth a try? Looking forward to see the animated result Cheesy

Oooh, that's a good idea. I didn't think of doing that. Thanks for the tip.  Wink
Logged

-...-

Mietze
Community Member
*
Posts: 415

Pleeease, don't let it crash!


WWW
« Reply #3 on: January 14, 2009, 01:59:15 AM »

Hehe... you guy never go to sleep, do ya? Wink
Logged

Check out my blog at www.e-studioz.de - The finest in gross trash Wink
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #4 on: January 14, 2009, 02:06:01 AM »

Hehe... you guy never go to sleep, do ya? Wink

Nevar!

I almost went to sleep. Then I had an idea and it started working. Cheesy. If I had slept, it wouldn't be working as it is now. Grin
Logged

-...-

Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #5 on: January 14, 2009, 12:01:55 PM »

Oh man, this is so beautiful. Congrats!
Does it work with FSAA?
Logged

AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #6 on: January 14, 2009, 01:09:19 PM »

Oh man, this is so beautiful. Congrats!
Does it work with FSAA?

I haven't tried it but I don't see why not. The particles can be rendered out in the main buffer. Wink
Logged

-...-

Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #7 on: January 14, 2009, 01:52:53 PM »

I know, but...
Quote
1: Render the world geometry, without the particles, to a floating buffer as depth.

This is not FSAA-capable. I think you'll get artifacts because of that.
Logged

AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #8 on: January 14, 2009, 02:01:58 PM »

Oh I see. Hmm, you're right. Sad
Logged

-...-

AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #9 on: January 14, 2009, 11:03:18 PM »

Working on some volumetric particles, here is what I have so far.

http://esoteric-float.co.uk/screenshots/zfeather/volume.avi
Logged

-...-

Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #10 on: January 15, 2009, 09:17:47 AM »

Holy crap, my mind is blown. You're good at this, Arius. Shocked
Logged

Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #11 on: January 15, 2009, 12:10:00 PM »

What the hell?
But how!  Shocked
..awesome.....
Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
Aurora
Community Member
*
Posts: 36


WWW
« Reply #12 on: January 15, 2009, 12:33:03 PM »

Well it looks good, but do a showfps on that please Smiley  Tongue
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #13 on: January 15, 2009, 01:22:04 PM »

I capped a HD vid, how slow do you think it's gonna be? lol

Without the volume I get about 150fps.

With: http://i44.tinypic.com/xelyle.jpg

That is with 20 slices, way more than you actually need, and per-pixel lighting.

I did this last night also, it's weird: http://uk.youtube.com/watch?v=3qjMvHWN8BI

Edit: Crappy 8500GT also.
« Last Edit: January 15, 2009, 01:34:19 PM by AriusEso » Logged

-...-

Aurora
Community Member
*
Posts: 36


WWW
« Reply #14 on: January 15, 2009, 02:37:39 PM »

hehe yeah, you can get alot of fun from playing with shaders Smiley

was thinking of FPS on the last image in first post, you are doing alot of particles Smiley

but still, not bad at all Smiley

im still working on my world editor (making maps in Grome editor, world editor is just for map settings and objects ect), and im SOOOOO looking forward to start playing with shaders Smiley  Tongue
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #15 on: January 15, 2009, 04:46:08 PM »

Ack, nay!

Quote
[10:52:46] <arius> 01-15-2009 10:52:07 | PARTICLE SYSTEM : Can't use custom shaders on Point sprites or minimesh particles ! Use a billboard emitter !

Looks like I am going to have to write my own particle engine.  Cheesy
Logged

-...-

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks