Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: Swifty on August 05, 2011, 06:07:38 am

Title: Soft Particles
Post by: Swifty on August 05, 2011, 06:07:38 am
Let's try this again. This time I'm lucid enough to include a patch. The last soft particles build didn't work so well because the unified shaders kept overriding my soft particle shaders. Hopefully this fixes things.

UPDATED: http://www.mediafire.com/?gcd7nfhb85n1htt

Soft sphere quad rendering has been extended to most effects. The only things left that this shader can be applied to are beam muzzle glows and glow points.

Example screenshots here: http://imgur.com/a/zv3ox

Title: Re: Soft Particles
Post by: Spoon on August 05, 2011, 08:21:59 am
I'm definitely seeing the soft particles now. Looks pretty nice 'cept for all the artifacts I'm getting:
(http://img846.imageshack.us/img846/5972/screen0070.png)
White squares around the borders on some effects and a few (really hard to screencap those) green and yellow circles around a few explosions that just flash by during the first few frames

And when beam piercing start happening...
(http://img233.imageshack.us/img233/6076/screen0071.png)
Title: Re: Soft Particles
Post by: Kolgena on August 05, 2011, 08:57:14 am
Omg, those fireball artifacts fit right in with WoD!

I'll be sure to test this when it's more complete (with fireballs support, which may/may not be this weekend)
Title: Re: Soft Particles
Post by: sigtau on August 05, 2011, 09:13:37 am
Dunno if this applies to FSO in the way it applied to the game engine I'm accustomed to working with, but when you get white borders around billboards and so forth, it's fixable by clamping the textures to the edge of the billboard (rather than have them use the same repeat mode as the other shaders).

Does that help at all?
Title: Re: Soft Particles
Post by: Zacam on August 06, 2011, 04:44:13 am

So far, this has been working out really well. (I'm using the suggested modifications as proposed by Valathil via IRC)

Code: (soft-f.sdr) [Select]
float depthOffset = radius - sqrt(
pow( radius * ( abs(0.5 - gl_TexCoord[0].x) * 2 ), 2 ) +
pow( radius * ( abs(0.5 - gl_TexCoord[0].y) * 2 ), 2 )
);

Sadly, the nVidia Cg Compiler loves being phenomenally stupid and thinks the instance of "2" in the shader are being declared as INT causing stupid warnings about implicit casting.
We know that it's not, obviously, but it would probably be bad for it to assume it's treating it like an INT rather than a float, so I turned the 7 occurrences of "2"  into "2.0" to make it shut up.
Title: Re: Soft Particles
Post by: Valathil on August 06, 2011, 01:41:25 pm
Sadly i found a problem yesterday but couldnt get swifty to respond. This radius based approach is really a great idea no doubt. BUT the geometry batcher in use for particles only saves the radius per particle texture. So what you get is everytime a new particle is drawn you overwrite the radius and use it for all other particles with the same texture. Its almost like a random number generator for the radius ergo you get horribly flickering particles which is kinda sad cause there is no way to fix it without forgetting the geometry batcher alltogether and porting it over to a geometry instancing framework or vertex attributes which i heard he is working on.
Title: Re: Soft Particles
Post by: Sushi on August 06, 2011, 09:19:03 pm
Yet another reason why using particles for explosions is a bad idea...
Title: Re: Soft Particles
Post by: Swifty on August 06, 2011, 09:49:31 pm
Yet another reason why using particles for explosions is a bad idea...
Err, what? What Valathil brought up is being fixed right now.
Title: Re: Soft Particles
Post by: Sushi on August 06, 2011, 10:36:08 pm
Yet another reason why using particles for explosions is a bad idea...
Err, what? What Valathil brought up is being fixed right now.

The fact that we use particles for a lot of explosions (such as missile and flak explosions) has a number of annoying consequences. Ship explosions cast light, for example, but missile explosions do not (no particles cast light). Particles are orientation-less: if you are rolling while viewing them, the explosion rolls with you. I think particles also don't render if they are just barely off the edge of the screen, so they can sort of "pop" into existence in an odd-appearing way.

That said, last time I looked at particles was about a year ago, so perhaps some of those annoyances have already been fixed (or will be soon).  :yes:
Title: Re: Soft Particles
Post by: Bobboau on August 06, 2011, 11:38:09 pm
you have implemented this on thrusters, right?
Title: Re: Soft Particles
Post by: Swifty on August 07, 2011, 04:40:51 am
The fact that we use particles for a lot of explosions (such as missile and flak explosions) has a number of annoying consequences. Ship explosions cast light, for example, but missile explosions do not (no particles cast light). Particles are orientation-less: if you are rolling while viewing them, the explosion rolls with you. I think particles also don't render if they are just barely off the edge of the screen, so they can sort of "pop" into existence in an odd-appearing way.

That said, last time I looked at particles was about a year ago, so perhaps some of those annoyances have already been fixed (or will be soon).  :yes:

Funny, while looking through the fireballs rendering code right before I read your response, I noticed that explosions and shockwaves were intended to rotate independently of the player's orientation. That has definitely not been happening. A simple one line change seems to have fixed it. But it involves adding the negative value of the Physics_view_bank angle value to the rotation of the bitmap. Which is weird because nebula bitmaps are oriented just fine when adding the positive value of Physics_viewer_bank. They're definitely calculating their orientations differently...

But yes, particles don't have their own orientation or up vector. The geometry batcher that the particle system uses has support for rotated billboards but I don't think anything is using it. We could possibly code in weapon hit explosions to exclusively have orientations while leaving the less noticeable smoke/fire/spark particles to share their up vector with the player.

you have implemented this on thrusters, right?

Not yet but I can do that real quick.
Title: Re: Soft Particles
Post by: BlasterNT on August 07, 2011, 11:20:42 am
Ooh, particle thrusters and Valathil's refraction shader allows for http://www.youtube.com/watch?v=PC4y2T0-skM&feature=player_embedded#at=33

*Edited link for better timing
Title: Re: Soft Particles
Post by: Dragon on August 07, 2011, 11:37:35 am
You mean the distortion at the start? That would indeed be great.
Title: Re: Soft Particles
Post by: BlasterNT on August 07, 2011, 11:54:35 am
I do mean that.  And all other sorts of haze effects*.  Ahh, the possibilities! 



*haze in vacuum, lol
Title: Re: Soft Particles
Post by: Dragon on August 07, 2011, 11:58:16 am
It could be a great addition to atmospheric mods, as well as to normal FS (if you're willing to stomach the lack of realism).
Title: Re: Soft Particles
Post by: MatthTheGeek on August 07, 2011, 12:08:56 pm
REALISM ?

IN MAH FREESPACE ?
Title: Re: Soft Particles
Post by: Jeff Vader on August 07, 2011, 12:31:34 pm
(http://koti.mbnet.fi/reiler/what.png)
Title: Re: Soft Particles
Post by: Valathil on August 07, 2011, 12:41:30 pm
You do know that thrusters exhaust gas as a means to generate thrust dont you. So having thrusters with heat distortion in vacuum is perfectly realistic btw

REALISM ?

IN MAH FREESPACE ?

It's more likely than you think!
Title: Re: Soft Particles
Post by: MatthTheGeek on August 07, 2011, 01:09:59 pm
Aww come on. It was cooler when it wasn't realistic.
Title: Re: Soft Particles
Post by: Valathil on August 07, 2011, 01:11:51 pm
You still have perfectly contained cylindrical beams and non newtonian physics dont cry.
Title: Re: Soft Particles
Post by: Dragon on August 07, 2011, 01:27:54 pm
Actually, it is unrealistic. Any gas would have dissipated way too quickly for that effect to appear, especially on such magnitude as in Nexus.
It still looks really good though.
Title: Re: Soft Particles
Post by: Rodo on August 07, 2011, 01:41:56 pm
yeah, rule of cool people.
Title: Re: Soft Particles
Post by: Commander Zane on August 07, 2011, 01:43:18 pm
Rool of Cule! :nervous:
Hur hur Ninja'd what's new. :doubt:
Title: Re: Soft Particles
Post by: Bobboau on August 07, 2011, 01:48:30 pm
Not yet but I can do that real quick.

good because that is the one effect that needs this more than anything else.
followed closely by nebula poofs.
Title: Re: Soft Particles
Post by: Valathil on August 07, 2011, 01:54:38 pm
we have Wave Motion Gun's (http://tvtropes.org/pmwiki/pmwiki.php/Main/WaveMotionGun), Sucking in Lines (http://tvtropes.org/pmwiki/pmwiki.php/Main/SuckingInLines) and Space is noisy (http://tvtropes.org/pmwiki/pmwiki.php/Main/SpaceIsNoisy), A little Rule of Cool (http://tvtropes.org/pmwiki/pmwiki.php/Main/RuleOfCool) doesn't hurt
Title: Re: Soft Particles
Post by: MatthTheGeek on August 07, 2011, 04:01:12 pm
Oh god, he linked to TVTropes.

We're all doomed.
Title: Re: Soft Particles
Post by: Spoon on August 07, 2011, 04:53:59 pm
Oh god, he linked to TVTropes.

We're all doomed.
I already read these trope pages in the past, and thus dont need to click!
Title: Re: Soft Particles
Post by: Valathil on August 07, 2011, 05:01:03 pm
Maybe they were updated. You should have a look.
Title: Re: Soft Particles
Post by: pecenipicek on August 07, 2011, 05:26:13 pm
goddammit valathil!



lookit what you've done :p
Title: Re: Soft Particles
Post by: Valathil on August 08, 2011, 04:06:27 am
HAHAHA all according to my plan
Title: Re: Soft Particles
Post by: Zacam on August 08, 2011, 08:09:32 am

So, does the following screenshot represent the current known problem that is being worked on?

(http://img221.imageshack.us/img221/2791/softparticlestestw.png)
Title: Re: Soft Particles
Post by: Commander Zane on August 08, 2011, 09:10:59 am
Hourglass poofs!
Title: Re: Soft Particles
Post by: esarai on August 08, 2011, 10:39:34 am
First off, that looks *****in, and second off this is gonna make a HUUUUGE difference, regardless of how 'tiny' FSO weapon impacts are.  You still end up with noticeable clipping, and this is going to make it look a ton better.  Keep it up!
Title: Re: Soft Particles
Post by: Valathil on August 08, 2011, 10:43:11 am
Hourglass Poofs? clearly theres something wrong with the texcoords
Title: Re: Soft Particles
Post by: Trivial Psychic on August 08, 2011, 12:07:07 pm
Hourglass poofs!
They look more like the Prophets' Orbs from DS9.
Title: Re: Soft Particles
Post by: esarai on August 08, 2011, 10:08:23 pm
Also suddenly thinking this would be an epic thing to apply to beams.  Beams can hit at such an angle that their end is blatantly noticeable (if the explosion animation is not the appropriate radius).  So fuzzing it up would be bamf.
Title: Re: Soft Particles
Post by: Swifty on August 09, 2011, 05:09:27 am
Updated the builds in the main post.

- Extended the soft sphere rendering to engine thrusters, fireballs (death explosions), and shockwaves.
- Revised the shader.

A known issue with this build is that engine thrusters won't render in the Tech Room.
Title: Re: Soft Particles
Post by: MatthTheGeek on August 09, 2011, 05:26:26 am
Works well on my end. Bug found : ships exiting subspace are drawn even before they exit the vortex.
Title: Re: Soft Particles
Post by: The E on August 09, 2011, 06:29:58 am
Ditto on the ships not clipping correctly issue.

In addition, afterburners seem to be missing some orientation data:
(http://blueplanet.fsmods.net/E/pics/screen0178.png)
Title: Re: Soft Particles
Post by: Swifty on August 09, 2011, 12:18:17 pm
I uploaded new builds fixing this problem.
Title: Re: Soft Particles
Post by: Spoon on August 09, 2011, 01:16:35 pm
Hooray! With the latest build it seems to be working! Party happy fun times for all!

(http://img405.imageshack.us/img405/3755/31931807.png)
so soft

(http://img845.imageshack.us/img845/6809/76972599.png)
old and busted clipping.


Thrusters are still not working A-okay though
(http://img7.imageshack.us/img7/9572/41425273.png)
This is as it should be.

(http://img836.imageshack.us/img836/7909/25828725.png)
but primary thruster glows are missing with soft particles enabled.


Edit: This actually only seems to occure in the F3 ship lab, the primary glows appear fine ingame.
Title: Re: Soft Particles
Post by: BlasterNT on August 09, 2011, 05:08:12 pm
Oooh, pretty.  How exactly does it calculate the "softness"?
Title: Re: Soft Particles
Post by: The E on August 09, 2011, 05:16:46 pm
By taking the scene's depth buffer into account. If the bitmap to be rendered is inside another object, it gets progressively more transparent.
Title: Re: Soft Particles
Post by: Sushi on August 09, 2011, 07:32:42 pm
By taking the scene's depth buffer into account. If the bitmap to be rendered is inside another object, it gets progressively more transparent.

What about very thin objects? Could you get ghostly explosions appearing THROUGH a thin wall?
Title: Re: Soft Particles
Post by: Swifty on August 09, 2011, 07:39:52 pm
For any rendered polygon has been rasterized to the depth buffer, particles will soften against it. It doesn't matter what thickness the geometry is so long as the particle fragment's distance to the viewer is closer than that of the scene's polygon.
Title: Re: Soft Particles
Post by: Dragon on August 10, 2011, 09:29:59 am
Looks great. It looks amazing to see explosion particles engulfing a girder structure or hitting the edge of ship's armor.
Title: Re: Soft Particles
Post by: Deadly in a Shadow on August 11, 2011, 09:48:31 am
Does this only work on SSE2 builds?
Title: Re: Soft Particles
Post by: Kolgena on August 11, 2011, 10:23:51 am
So uh... capital ship explosions look waaaaaaaaay better now. A lot of other effects probably do too, but aren't as immediately noticeable.

A negative side effect is that cap ship explosions are significantly more blown out to white than they were before. I think this is because particles are now transparently additive, so exploding ships will usually produce a uniformly white blob with soft particles on. I'd blame this more on the particle sprites themselves than the code though.
Title: Re: Soft Particles
Post by: mjn.mixael on August 11, 2011, 10:56:12 am
  :nervous:

What's your bloom setting?
Title: Re: Soft Particles
Post by: Kolgena on August 11, 2011, 11:00:52 am
intensity is at 80. Contrast is at 1.06 though, which exaggerates bloom (but not by that much). I didn't change my flags between builds, so I think the extra white is due to soft particles.

Ships/thruster glows (can't tell if it's the entire ship or not due to dark lighting) still draws after the warp. I'm not sure if the issue was fixed in a newer version when it was first identified, but the problem's still there with the currently available download.
Title: Re: Soft Particles
Post by: Swifty on August 11, 2011, 12:44:20 pm
I highly doubt the problem is soft particles. The blending function hasn't been changed and if anything, particles are slightly less intense due to the shader tapering down the original fragment colors in order to soften them against scene geometry.

I can't really take your word for this one so you're gonna have to post a comparison screenshot.
Title: Re: Soft Particles
Post by: Kolgena on August 11, 2011, 12:57:12 pm
K, I'll try, though tbh, I don't think a real comparison screenshot is possible. It seems more than likely that I'm simply wrong :P
Title: Re: Soft Particles
Post by: Nighteyes on August 14, 2011, 04:42:04 am
2 small questions:
is it now possible to control just how addetive the particles blending is?
is it possible to adjust the intensity of specific effects though a table file?
Title: Re: Soft Particles
Post by: Deadly in a Shadow on August 14, 2011, 04:27:23 pm

Let's ask again ;7

Spoiler:
Does this only work with SSE2 builds?

Or is there/will be there an SSE build?
Title: Re: Soft Particles
Post by: The E on August 14, 2011, 04:30:49 pm
This works on all builds. However, considering how few people there are who are unable to use SSE2 builds, I fail to see the relevance.
Title: Re: Soft Particles
Post by: rscaper1070 on August 21, 2011, 04:31:00 pm
I'm having some problems. When I enable soft particles in the launcher I get this. I also get zero explosion effects. I've been using the latest nightly and the latest Antipodes builds.

(http://thumbnails36.imagebam.com/14610/1492f9146097675.jpg) (http://www.imagebam.com/image/1492f9146097675)

(http://thumbnails57.imagebam.com/14610/7a2a24146097679.jpg) (http://www.imagebam.com/image/7a2a24146097679)

Nevermind, I figured it out. I had some soft.sdr files that shouldn't have been there.
Title: Re: Soft Particles
Post by: Bobboau on August 21, 2011, 10:15:01 pm
so, fun fact, I cant seem to find the soft-f.sdr/soft-v.sdr, and also latest builds disable all shaders if these files are not present because they bypass the normal error control.
Title: Re: Soft Particles
Post by: Valathil on August 21, 2011, 10:35:46 pm
so, fun fact, I cant seem to find the soft-f.sdr/soft-v.sdr, and also latest builds disable all shaders if these files are not present because they bypass the normal error control.

When you dont have the files externally they should load the defualt internal ones. So i dont get how this happens Bobboau.
Title: Re: Soft Particles
Post by: Bobboau on August 21, 2011, 10:52:12 pm
hmmm... you are right, it looks like it is failing to compile the fragment shader.
ATI Radeon 5770
cat: 11.7
Title: Re: Soft Particles
Post by: Valathil on August 21, 2011, 11:03:02 pm
log?
Title: Re: Soft Particles
Post by: Bobboau on August 21, 2011, 11:14:46 pm
looks like the importaint part is:
ERROR: 0:68: error(#160) Cannot convert from '4-component vector of float' to 'highp 2-component vector of float'


[attachment deleted by ninja]
Title: Re: Soft Particles
Post by: Valathil on August 21, 2011, 11:17:01 pm
but thats from my code that got reverted. you clearly screwed up your working copy you should revert all files to the current revision then it should be fixed
Title: Re: Soft Particles
Post by: Bobboau on August 21, 2011, 11:19:49 pm
:/ maybe I checked it out at just the wrong moment? updating...
Title: Re: Soft Particles
Post by: Bobboau on August 21, 2011, 11:24:31 pm
yup, that was it, I'm an idiot, ignore me....  :o
Title: Re: Soft Particles
Post by: Kolgena on August 22, 2011, 01:10:02 am
Thrusters still draw after ships warp-out. At least, they do in the latest nightly.
Title: Re: Soft Particles
Post by: Valathil on August 22, 2011, 02:51:24 am
Known issue
Title: Re: Soft Particles
Post by: Swifty on August 22, 2011, 03:59:29 am
Thrusters appearing past the warp clip point will eventually be fixed.
Title: Re: Soft Particles
Post by: Swifty on August 30, 2011, 07:52:15 pm
Engine glows appearing past the warp plane has been fixed and committed to trunk.
Title: Re: Soft Particles
Post by: pecenipicek on August 31, 2011, 12:40:40 am
Engine glows appearing past the warp plane has been fixed and committed to trunk.
Nope.

http://img839.imageshack.us/img839/6417/screen0000k.jpg
http://img5.imageshack.us/img5/1969/screen0001eu.jpg
http://img534.imageshack.us/img534/7828/screen0002a.jpg
http://img641.imageshack.us/img641/8516/screen0003m.jpg


also, running a debug build yields out this: http://pastebin.com/DP1EmjQZ

In short you fixed half the ships warping in :p

(homeworld warpin type)
Title: Re: Soft Particles
Post by: Swifty on August 31, 2011, 02:48:16 am
What do you mean I fixed half the ships warping in? What are those screenshots supposed to show me? Does it not work for the Homeworld warp type? Does it not work for all warp types? Does this happen when ships are warping in? Warping out?

Don't just say "nope" and give me a bunch of screenshots to decipher.

EDIT: What build did you run anyway? Something beyond Revision 7590?
Title: Re: Soft Particles
Post by: Zacam on August 31, 2011, 03:21:45 am

Or 7595 if you experience any crashes with 7590 (doesn't always happen, but it can)
Title: Re: Soft Particles
Post by: pecenipicek on August 31, 2011, 06:46:56 am
What do you mean I fixed half the ships warping in? What are those screenshots supposed to show me? Does it not work for the Homeworld warp type? Does it not work for all warp types? Does this happen when ships are warping in? Warping out?
The ships on the left work properly, when warping in. the ships on the right dont. I have only tested with the Homeworld warp type.

Quote
Don't just say "nope" and give me a bunch of screenshots to decipher.
in short, ships on the left work properly, the ships on the right dont.
The ships on the left have negative X-axis coordinates in FRED, the ships on the right have positive X-axis coordinates. The moment they jump in, debug log (http://pastebin.com/DP1EmjQZ) starts filling with "WARNING: "Null vec3d in vec3d normalize. Trace out of vecmat.cpp and find offending code." at vecmat.cpp:449"" errors.
Quote
EDIT: What build did you run anyway? Something beyond Revision 7590?
self-compiled inferno sse2 antipodes based off of revision 7596.


If need be i'll get a non-antipodes build and assemble a nice clean mod folder to confirm this further with retail assets.
Title: Re: Soft Particles
Post by: BlasterNT on September 02, 2011, 09:30:48 am
It just occured to me, can soft particles be used to have a "subspace haze" effect, like what we see in the cut scenes?
Title: Re: Soft Particles
Post by: Bobboau on September 02, 2011, 03:37:43 pm
probably.