Soft Particles

Everything about development and the OpenMW source code.
Post Reply
User avatar
wazabear
Posts: 96
Joined: 13 May 2020, 19:31
Gitlab profile: https://gitlab.com/glassmancody.info

Soft Particles

Post by wazabear »

I've recently had my hand at implementing soft particles. For those unfamiliar the big idea is to prevent the ugly intersections you have with textured planes. My implementation is pretty standard, and only works with our shader pipeline. I disable depth writes of particles and write to a depth RTT. In the fragment shader I lookup scene depth and compare to particle depth, and use the delta to compute some fade factor.

I also added a "high quality soft particles" setting, which gives much better results at cost of more expensive computation, and is taken from this old but still relevant Nvidia paper. The following videos are using the formulas outlined in that document.

Hard:
https://streamable.com/73jm6n
Soft:
https://streamable.com/90zzf3
Hard:
https://streamable.com/1v2vws
Soft:
https://streamable.com/cksizu

I've found most particles look great, but there are a few cases which breaks the illusion. This is because fade is heavily dependent on some "distance factor" which can't be defined anywhere content side. Ideally, you would have a NIF with a "soft particle" checkbox and some "distance factor". This is the big issue for me right now, as it's looking like soft particles would need to be all or nothing, so I would need a way to compute this magical "distance factor" based on the particle system properties. I've experimented with modeling this distance factor as a function of individual particle size with some success, but some particle systems definitely need carefully selected values. Adding extra NiStringExtraData strings is one solution, but I doubt anyone would ever use it, and it's a clunky approach regardless.

Thoughts on this?

Note: This is meant to be an optional feature which is for people with beefy rigs who want more fancy graphical enhancements.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Soft Particles

Post by CMAugust »

I think it looks superb, and have wanted something like this for a long time. Do you have an example of particles that look blatantly incorrect with this technique? Ones that break the illusion, as you put it. Because if in 90% of cases it looks great, and the remaining 10% have the possibility of some sort of manual tweak, that would already seem worthwhile to me.
User avatar
wazabear
Posts: 96
Joined: 13 May 2020, 19:31
Gitlab profile: https://gitlab.com/glassmancody.info

Re: Soft Particles

Post by wazabear »

By "breaking the illusion" all I meant is that you still get hard edges as if the setting was not enabled at all (assuming I've clamped the distance fade sensibly). Of course, shaders don't know when the result will give a hard intersection so will chug along and do all the computations anyways. Some particle systems you wouldn't want to this to be enabled either. Propylon chambers are one example, there isn't any benefit for enabling soft particles for them and they are already performance hogs.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Soft Particles

Post by CMAugust »

Besides the GPU overhead, if the worst case is that it merely looks the same as it does now without the feature active, that's not too bad at all for an optional feature. A more elegant solution that provides extra data, like the checkbox with distance factor, could be developed in the future.
Wolvman
Posts: 23
Joined: 30 Apr 2012, 15:57

Re: Soft Particles

Post by Wolvman »

Not sure if my vote counts for much but I'd personally really appreciate this as an optional feature. I had not even really thought about the original particles being "hard" but once you pointed it out with those comparison screenshots I cannot unsee how bad they look.
Post Reply