PDA

View Full Version : minimizing blended billboard popping



zed
05-10-2005, 01:30 AM
to correctly display blended polygons u need to sort them from furtherest to closest (with most blending modes)
the problem i have with this is with the ugly popping that occurs eg
take a particle system consists of 100 polygons clustered in a sphere
now rotate the camera around this particle system
the order the polygons are drawn in is constanly changing, resulting in ugly popping
HOW TO MINIMIZE IT!
A/ more polygons (but smaller), kills fillrate
B/ a better blending method than src_alpha, 1-src_alpha, any ideas?
C/ something else?

ta zed

ZbuffeR
05-10-2005, 02:02 AM
B/ if can use additive blending, just disable depth test and sorting, and it will be ok. GL_ONE GL_ONE

knackered
05-10-2005, 02:21 AM
motion blur just on the particles.

SeskaPeel
05-10-2005, 09:10 AM
And what about that depth sprite thing ?

zed
05-10-2005, 10:58 AM
* true with (one one) blending theres no popping + also u dont need to sort in the first place. but it has to be a blending method close to src_alpha 1-src_alpha

* yeah thatll help, unfortunatly most of the effects which use this material dont want motion blur (smoke/steam). i already motion blur most of the additive blended stuff (fire etc), also enabling motion blur takes about a 25% performance hit (should improve with FBO though), ill give it a try though with minimal motionblur

SeskaPeel - what depth sprite thing?

i tried #A last night it helps (and also looks better, more polygons generally == better 3d realism) unfortunatly it tends to kill framerate when the camera is close to the effect. ill look into better polygon distribution methods, instead of the quasirandom placements/velocities that i use at present (hmmm perhaps i can add a repel force (from its neighbours) to the particles)

zed
05-10-2005, 05:51 PM
on the subject of smoke, has anyone implemented some excellant looking smoke.
mine whilst it looks pretty good, appears more like steam than smoke, ive been playing around with textures/colors/blending methods but cant get a nice looking effect

MickeyMouse
05-11-2005, 01:56 AM
Originally posted by zed:
* true with (one one) blending theres no popping + also u dont need to sort in the first place. but it has to be a blending method close to src_alpha 1-src_alphaMaybe try this:

1. Render color of all billboards to additional render target A with blending set to one-one.

2. Render depth of all billboards to additional render target B.

3. Scale color of your render target A by 1/x, where x corresponds with maximal number of billboards one on another. Actually you should test it yourself, x might depend on specific kind of particles.

4. Blend content of render target A (using depth from render target B to depth-test with main frame's depth buffer) with your scene. Now blend using src_alpha 1-src_alpha.

It won't help popping against other scene's elements, but it helps popping between billboards. The disadvantage is the cost of using additional render targets.

Btw. you might like JavaCoolDude's fire demos being both currently displayed on main opengl web-page.

[Edit: no need for sorting polys in 1st step]

V-man
05-11-2005, 02:11 AM
Originally posted by zed:
ill look into better polygon distribution methods, instead of the quasirandom placements/velocities that i use at present (hmmm perhaps i can add a repel force (from its neighbours) to the particles)That would be the problem. The billboards must be penetrating each other. Try dividing a volume into small cubes or spheres and non of them penetrate each other, and at the center you put a billboard.
The cubes or spheres should be positioned randomly.

Anybody tried smoke effect using 1 pixel GL_POINTS? It would be possible to apply some physics on the GL_POINTS.

zed
05-11-2005, 10:50 AM
It won't help popping against other scene's elements, but it helps popping between billboards. The disadvantage is the cost of using additional render targets.it sounds quite expensive, ill keep it in mind if my new idea doesnt pan out

Btw. you might like JavaCoolDude's fire demos being both currently displayed on main opengl web-pagenone of the 3/4 apps of his that ive tried have worked, so im a bit wary of downloading it (bandwidth nazi)

Anybody tried smoke effect using 1 pixel GL_POINTS? It would be possible to apply some physics on the GL_POINTSsee the 2d fluid simulations, expand that to and extra dimenion :)

i had another idea (dont know why i didnt think of it before) just draw the smoke particles as normal, but use a 3d or 4d noise shader, from a cursory think through i think itll solve all the issues and look better to boot (esp 4d noise)
ta zed

Java Cool Dude
05-11-2005, 02:23 PM
:p

zed
05-11-2005, 08:42 PM
Originally posted by Java Cool Dude:
:/i see your :p and raise u a :\
i meant cause of my conection i cant download so much (though i did download this demo(not so large)+ it worked hurrah!)
though btw mickeymouse u cant compare fire+smoke eg fire u dont need to sort (then again additative blending personally aint the best, eg in javacooldudes's demo check out how when the fire is over the skull it tends to go white)

this is the smoke i had first
http://uk.geocities.com/sloppyturds/nelson/2005_05_11A.jpg
http://uk.geocities.com/sloppyturds/nelson/2005_05_11B.jpg
http://uk.geocities.com/sloppyturds/nelson/2005_05_11C.jpg
http://uk.geocities.com/sloppyturds/nelson/2005_05_11D.jpg
http://uk.geocities.com/sloppyturds/nelson/2005_05_11E.jpg

heres a screenshot of the smoke i want (though i cant see how u can do it without popping)
http://images.ea.com/eagames/official/cc_generals_redesign/screenshots/pc/set2/scrn_3.jpg

btw this is what i have now a bit better but still not as good as that CC screenshot (then again that might look crap in the flesh)
http://uk.geocities.com/sloppyturds/nelson/2005_05_12A.jpg
http://uk.geocities.com/sloppyturds/nelson/2005_05_12B.jpg
http://uk.geocities.com/sloppyturds/nelson/2005_05_12C.jpg

btw tried the noise as well, no go, u need to combine it eg with the above + it absolutly killed the framerate ~1fps

Java Cool Dude
05-11-2005, 09:51 PM
I'm sorry but HOLLY GOD those screens look awesome :eek:
Pardon if I ask this offtopic question but where'd you get the models/textures from?

zed
05-11-2005, 11:16 PM
thanks (its due mainly to the unified lighting, theres no ambient)
i made the models myself and most of the textures from photo (some textures i got from the internet though) but ill replace those after i find some industrial area of which i can take a few photos

knackered
05-12-2005, 12:01 AM
just did a test, and rendering all my textured particles with a very low alpha and (srcalpha,one) blending, into a texture, then compositing the texture onto the scene using alpha blending looks pretty good...there's some banding but it looks very volumetric.

SeskaPeel
05-13-2005, 03:48 AM
Depth sprites:
"A depth sprite can be defined as a 2D image where each pixel has an associated depth value. A depth sprite can be rendered on the screen like a planar textured polygon, but instead of filling the depth buffer with the z-values from the polygon, it is filled with the corresponding values from the depth sprite."
http://www.ati.com/developer/samples/DepthExplosion.html
http://developer.nvidia.com/object/cg_effects_explained.html#Depth Sprites (can't find back the real link on the non Cg demo, but this was the one I thought of first)
http://www.justadventure.com/articles/3D/3DGraphicsTrens.shtm
http://www9.informatik.uni-erlangen.de/Projects/lgf3/Devel/online/annotated.html (look for DepthSprites3D classes)

Better smoke rendering:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=013067

You could have a look at Mark Harris cloud algorithm, that gives very good looking results, and somehow avoids a bit of the popping problem
http://www.markmark.net/clouds/

Let me know how it ends up performance wise, I haven't tested depth sprites yet.

SeskaPeel.

tamlin
05-13-2005, 06:39 AM
Just wanted to pitch in a little something, since one of the screenshots were from C&C Generals.

Have you played through the game, you would have seen one particular intro scene to a mission rendered with the engine displaying their smoke is only "smoke and mirrors". :)

They simply use a bunch of pre-rendered textures (very likely hand-made, or at least hand-tweaked) with different smoke "puff"/cloud effects, and impostors (I think that's the name for it). It was very visible in the scene I'm thinking of, where the "camera" was rotating around basically the smoke center in what I believe in the movie industry is now called "bullet time".

I'd suspect they still use the very same technique since it works so well with almost no extra GPU budget wasted, and just a little server memory used.

knackered
05-13-2005, 10:42 AM
Are you saying it is:
1/ pre-rendered from many fixed viewing angles at startup time?
or
2/ using the 'imposter' technique of re-rendering the billboard when the actual viewing angle differs dramatically from its value when the imposter was last rendered?

If you're saying it uses method 2 then I still don't see how the popping zed describes could be eliminated because they still have to be alpha blended so the same sort has to happen even if its going to be rendered into a texture...

zed
05-13-2005, 10:55 AM
thanks for the info guys thats definitly helpful, i should be able to come up with something sweet looking now
but first im gonna haveta first dig out my old particle system tester program + update it(add shader support etc), allowing me to tweak the parameters 'inprogram', testing the particle system ingame is a hassle

edit - now i think about it, i have also the added issue of shadowmapping, ie composing a single 2d texture and drawing that in the scene (with depth info) wont work well
actually, or will it? it might even be better, the only way i suppose is do a test

tamlin
05-13-2005, 12:11 PM
knackered,

The smoke I saw was just head-on rendered impostors with a bunch of them put in partially overlapping quads (all the time facing the viewer) blended. I'd think those textures and the animations for them were all or mostly manually rendered.

While the smoke was animating in the number of quads, the implementation was non-obvious. Once time was "frozen" and texture animation stopped, but scene rotation kept going, it was obvious. They might as well have outlined the quads. :)

Having the smoke animated (fast enough?) I suspect that motion might fool the viewer enough to make even rotating e.g. a column of smoke plausible.

I see no reason a particle system couldn't be used to render such textures at application startup, but not without some tweaking. If you look at the EA screenshot, the outer parts of the textures look somewhat cartoonish in their "puffyness". Almost like superheated ash from a volcano erupting (the non lava kind).

tamlin
05-15-2005, 07:41 AM
I just wanted to point out I used "impostor" to describe the wrong "fake".

What I referred to was likely nothing more than a number of hand-drawn smoke 2D sprites, animated, and rendered as a cluster of blended billboards.

While the same effect obviously can be accomplished using impostors, I'm almost certain that's not what C&C Generals uses why my previous attempt at explaining the effect was at best misleading.

Sorry about the confusion.

fathom
05-18-2005, 02:53 PM
Originally posted by zed:
on the subject of smoke, has anyone implemented some excellant looking smoke.
mine whilst it looks pretty good, appears more like steam than smoke, ive been playing around with textures/colors/blending methods but cant get a nice looking effecti use 1, 1-alpha for my blending. make sure your alpha and color channels of your texture aren't modulating in lock-step (you need high alpha and low color intensity to make dark areas and the impression of self shadowing).

zed
05-19-2005, 11:31 PM
played a bit more redid an old particle simulation application
http://uk.geocities.com/sloppyturds/nelson/richmond/2005_05_17.jpg
tested depth particles but no go, it improves the looks when the particle is intersecting another polygon in the scene but if u turn on depthwrites and use it within the cloud/smoke it looks crap u see
the abrupt depth changes ( think doing sprites with alphatest vs blending, with blending the edges look better)

ZbuffeR
05-20-2005, 12:31 AM
picture link does not work.

zed
05-20-2005, 11:03 AM
sorry (its not much chop anyways)
http://uk.geocities.com/sloppyturds/nelson/2005_05_17.jpg

zed
05-21-2005, 10:44 AM
ive found some brilliant looking smoke here
http://www.the-magicbox.com/0505/game050519k.shtml
now it looks nice in the screenshot, BUT how does it look when the cameras moving, i dont think its possible

perhaps the smoke is treated not as 2d sprites but as a 3dmesh? how would this go, a lot more difficult to implement, would it work, hmm

btw i found a good demo that illustrates the popping effect http://www.vrac.iastate.edu/~areinot/clouds/clouds.html

ZbuffeR
05-22-2005, 01:00 PM
Originally posted by zed:
ive found some brilliant looking smoke here
http://www.the-magicbox.com/0505/game050519k.shtml
now it looks nice in the screenshot, BUT how does it look when the cameras moving, i dont think its possibleThose shots looks a lot like offline rendered CG sequence... look at that pretty motion blur on second screenshot...

Maybe OT : I recently saw a small game/demo with very pretty lit smoke :
http://www.renderpaz.com/software.html (first section, "Next Gen ...Platformer").
Quite nice, even if the camera does not really rotate around the smoke.

knackered
05-23-2005, 03:39 AM
They look like depth sprites to me.

SeskaPeel
05-23-2005, 09:08 AM
ZBuffer, I pointed out this demo in a previous thread. You can find the link to this if you read my previous post in this current thread.
You'll find a real time demo and videos.

SeskaPeel.

zed
05-23-2005, 09:35 AM
that app crashes within the first second (7mb:() but based on the screenshots its similar to what i have at present the problem is my camera is often rotating whereas in that game it views the scene from the same direction.
i think ill stick smoke on the TODO list for a while (i often come up with solutions if im not actively thinking about them)

SeskaPeel
05-23-2005, 01:10 PM
Zed, grab the video, his camera has some rotations and it works perfectly.

SeskaPeel.

SeskaPeel
05-25-2005, 03:02 AM
Just another thought : you can store the sort order of each sprite, and crossfade when it changes to minimize the popping effect.
But depth sprites would be the best.

SeskaPeel.

zed
05-25-2005, 11:19 AM
do u mean something like check sort order if two numbers have swapped then decrease the blend amount of those 2 polygons, i can see that not working 100%.

also in the video i downloaded the camera doesnt really rotate more than say 10degrees (i want the whole 360 degrees) thus u cant really tell if its popping or not.
ive made a reasonable fascimially of the technique in the video, though mine doesnt look as good. i believe this is due to the textures used

SeskaPeel
05-27-2005, 01:52 AM
My second thought would not work perfectly when moving fast, or when billboard are animated with a heavy speed in such a way that even when the camera doesn't move the sort order varies.
Anyway, it will attenuate a lot the popping effect. You can even tweak the lerping speed depending on the camera and/or billboard speed.

This is obviously not 100%, but it should reduce the unwanted effect mostly.

SeskaPeel.

zed
05-27-2005, 11:12 AM
thanks for the input SeskaPeel, youre driving me onto fixing this.
at the moment the smoke doesnt look to bad at all, part of the secret is using correct textures.
ild beeen making the mistake of taking photos of clouds and creating a texture from those, this works with all other things eg grass,metal,wood etc. but with clouds/smoke i found just drawing a simplistic texture myself in a paint program eg a few circles (quasi cartoonish bilowing clouds)gives the best results

i had an anohter idea this morning in bed (not yet tested) it will get rid of the popping from the camera movement but might have the side effect of looking crap.
*when the camera rotates then rotate the particlesystem in the opposite direction, thus what is closest to the camera at the start will always be closest no matter how u rotate the camera.
then again like i said it might look crap, ill trial it soon

SeskaPeel
05-28-2005, 09:24 AM
No problem for the input, this is something that helps me a lot too, and a topic of interest.

For your in-bed idea, I fear this will look 2D !

Have a look too at Niniane Wong's paper (FS 2004 clouds) : http://www.ofb.net/~eggplant/clouds/
I will be implementing her method this week I think, and after reading quickly through, it might NOT solve the popping problem (she was the one suggesting lerping when sort order changes), but it might enhance your shading algorithm (perf and quality).

SeskaPeel.

zed
05-28-2005, 12:14 PM
For your in-bed idea, I fear this will look 2D !your right nothing good ever happened to me lying on my back.
anyways ive managed to minimize the popping by using a lower initial alpha value for the drawing, though of course the smoke looks a bit more wishywashy but being the politician i am i can live with the compromise.
ill post a screenshot today anyways in case youre interested.
i believe though youre goals (with this and the fog) are higher than mine, i just want something that looks good, ie bollux to the physical accuracy

SeskaPeel
05-29-2005, 09:44 AM
I actually wanted something that looked good, and the best looking method I found were the physically accurates one ...
I never aimed at ultra realsim, though it is a bonus. First goal has always been to have something that is pleasing to the eye.

Remember http://ffiw.succubus.fr/ ?

SeskaPeel.

zed
05-29-2005, 11:25 AM
i like the look of the watercolor shaders and also the non-heightmap landscape (im just using a heightmap, the landscaoe used to be a mesh, i forget why i changed to a heightmap anyways)
a couple of important differences between yours and mine
*i have a lot of explosions/lights, thus bright polygons with depthwrites off which is causing a lot of grief for me, also the same with shadows,fog
*since mines a oldschool shootemup set in a galaxy far far away, realizm takes a back seat to gameplay. not saying mine has any good gameplay mind