osgFX::Cartoon

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
User avatar
AnyOldName3
Posts: 1559
Joined: 26 Nov 2015, 03:25

Re: osgFX::Cartoon

Post by AnyOldName3 » 01 Jun 2019, 18:51

There's not that much that could be done about particle outlines except either running the post-process before rendering particles (which would probably require a lot of reorganisation, so it's probably something that you'd only ever implement if you knew about it when you started writing the renderer) or disabling depth writes for the particles, which would cause issues when a particle covered somewhere a line would appear, as the line would be drawn over the top of it.

You don't really want to draw outlines if you've got anything at all that's alpha blended, so the 'proper' solution would be to recreate the particle effects so each pixel is either completely opaque or completely transparent, and then acept that they'll have ines drawn. I think this is what Borderlands does, for example.
AnyOldName3, Master of Shadows

Clement
Posts: 5
Joined: 03 Jul 2018, 10:41

Re: osgFX::Cartoon

Post by Clement » 02 Jun 2019, 00:23

MGE (or maybe Morrowind, I don't know the details) does not draw depth for semi transparent textures. I expect they are drawn in a separate pass anyway, since you cannot rely on depth test for those and you have to render them from back to front. Textures with completely opaque/transparent pixels (e.g. leaves) do draw depth properly though.

Lines are drawn on top of effects like fires or storm particles. SSAO has the same issue, but it is less obvious as it draws subtle blurry shadows instead of solid lines.

User avatar
AnyOldName3
Posts: 1559
Joined: 26 Nov 2015, 03:25

Re: osgFX::Cartoon

Post by AnyOldName3 » 02 Jun 2019, 02:32

Usually with alpha blending, you draw your opaque stuff, then (in order of decreasing distance from the camera) you draw your translucent stuff with depth testing on (so you don't accidentally draw things in front of opaque objects which they're actually behind) but depth writes off (as you don't need the depth buffer as you've already manually sorted everything by depth. This would be consistent with what you've just described, and unless Scrawl decided to do something weird, it's probably what OpenMW is doing.

With alpha testing, a pixel is either there or it isn't, but when it is there, it's opaque and you can draw it just like any other opaque pixel, so no special handling is required and depth writes and testing stay on and objects get drawn in whatever order is easiest.
AnyOldName3, Master of Shadows

Post Reply