Soft sprite clipping
Moderator: GZDoom Developers
Soft sprite clipping
This feature is sometimes called "soft particles" in other game engines. It softens the billboard's edges when intersecting with other geometry. Very beautiful for special effects like smoke, explosions and fire.
I propose an actor flag, perhaps +SoftClip, to enable this special rendering per-Actor.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Soft sprite clipping
Does GZDoom even have this ability?
Obviously you know GZDoom doesn't have DirectX.
Obviously you know GZDoom doesn't have DirectX.
Re: Soft sprite clipping
No, GZDoom does not have this ability - but the ability does exist in OpenGL.
It seems simple enough to add - but I am finding a stunning lack of documentation on this. Do you have any programming tutorials where this is actually implemented? Unless dpJudas or Graf already know how to do this, we do at least need that much.
We also need to know what feature set is required for it, because obviously not all systems will be able to support it.
(It seems to also be a good solution for some sprite clipping issues in general)
It seems simple enough to add - but I am finding a stunning lack of documentation on this. Do you have any programming tutorials where this is actually implemented? Unless dpJudas or Graf already know how to do this, we do at least need that much.
We also need to know what feature set is required for it, because obviously not all systems will be able to support it.
(It seems to also be a good solution for some sprite clipping issues in general)
Re: Soft sprite clipping
It's not a DirectX-exlusive feature.
I nicked that screenshot from a Google image search (it's from Bioshock, which runs on Unreal Engine and therefore DirectX) but soft edge material techniques is a generic graphics technique, just like SSAO is not exclusive to either DX or GL.
I nicked that screenshot from a Google image search (it's from Bioshock, which runs on Unreal Engine and therefore DirectX) but soft edge material techniques is a generic graphics technique, just like SSAO is not exclusive to either DX or GL.
Re: Soft sprite clipping
Rachael - it's sometimes also called depth fading... I found this, not sure how helpful the tech stuff is in these, perhaps you can take a look?
http://developer.download.nvidia.com/SD ... les_hi.pdf
http://developer.download.nvidia.com/SD ... les_hi.pdf
Re: Soft sprite clipping
The screenshots are from DirectX, but the actual algorithm works with OpenGL too. Essentially it is based on sampling the depth buffer when drawing the sprite and if the fragment is closer than a certain distance it begins to fade to transparent. In plain GLSL, something along these lines:
Now the catch is that this requires a depth texture. We already have one, as the SSAO pass uses it, but that means half the dinosaur cards won't be able to do this feature without a general frame rate loss.
Code: Select all
float linearDepth = texelFetch(DepthTexture, gl_ScreenPos.xy).r * DepthLinearScale + DepthLinearOffset;
FragColor.a *= clamp((linearDepth - gl_ScreenPos.z) * fadeStartDistance, 0.0, 1.0);
Re: Soft sprite clipping
The applicability potential for this is HUGE, so you can bet I want to put this in if I can. I am trying to find out how, right now. I'll take a look at it.Nash wrote:Rachael - it's sometimes also called depth fading... I found this, not sure how helpful the tech stuff is in these, perhaps you can take a look?
http://developer.download.nvidia.com/SD ... les_hi.pdf
Which is why it should be enabled with a CVar. (Yeah, I know you hate those things. )dpJudas wrote:Now the catch is that this requires a depth texture. We already have one, as the SSAO pass uses it, but that means half the dinosaur cards won't be able to do this feature without a general frame rate loss.
Re: Soft sprite clipping
Thank you both, dpJudas and Rachael for commenting. Hopefully it can be done without too much trouble. :D
And yeah I realize this won't be too friendly with dinosaur hardware, but GZDoom is already loaded with modern-only graphics enhancements... this would be just another one added to the modern feature-set...
And yeah I realize this won't be too friendly with dinosaur hardware, but GZDoom is already loaded with modern-only graphics enhancements... this would be just another one added to the modern feature-set...
Re: Soft sprite clipping
Surprisingly enough, GZDoom still has its OpenGL 2.0 render path. Obviously, such things will not be supported on it, as there's no way we can backport a feature like this to it.Nash wrote:And yeah I realize this won't be too friendly with dinosaur hardware, but GZDoom is already loaded with modern-only graphics enhancements... this would be just another one added to the modern feature-set...
My big thing is - this has the potential to also allow us to push sprites into the floor to a reasonable depth. Maybe not the rocket explosions, per se, but at least having humanoid actors' feet not being pushed up out of the floor would be nice.
Re: Soft sprite clipping
I didn't think about using it on monsters (when I made the thread, I was purely thinking about smoke and fire and stuff like that) but you raise an interesting thought. I'm definitely curious now. :D
I've found some other links, although to be honest these all look like alien languages to me... perhaps it'd make more sense to you. I'm sure ONE of these might be useful!
https://nickthecoder.wordpress.com/2012 ... particles/
https://stackoverflow.com/questions/439 ... -in-opengl
http://faculty.ycp.edu/~dbabcock/PastCo ... lab14.html
http://www.informatik.uni-oldenburg.de/ ... page7.html
https://www.gamedev.net/topic/529947-co ... particles/
I've found some other links, although to be honest these all look like alien languages to me... perhaps it'd make more sense to you. I'm sure ONE of these might be useful!
https://nickthecoder.wordpress.com/2012 ... particles/
https://stackoverflow.com/questions/439 ... -in-opengl
http://faculty.ycp.edu/~dbabcock/PastCo ... lab14.html
http://www.informatik.uni-oldenburg.de/ ... page7.html
https://www.gamedev.net/topic/529947-co ... particles/
Re: Soft sprite clipping
Well - that's more complicated than I thought it would be. >_> As per usual, with OpenGL stuff. I'll look into it, but I can't make any promises on my part. I still have a long way to go with learning OpenGL programming...
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Soft sprite clipping
I'm glad I was wrong. This would indeed be of great use!
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Soft sprite clipping
This is the stuff which turns deprecation into unsupportedness...
Re: Soft sprite clipping
After thinking a bit about Rachael's idea to sample from the depth buffer to handle sprite clipping I think I've come up with a way that might work:
Hopefully I'm not missing some important detail here.
Hopefully I'm not missing some important detail here.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Soft sprite clipping
I just hope it's born in mind with the fact that it won't look good on everything, so a render flag to (dis)allow such a thing from happening is something I would expect...