https://devfault.wordpress.com/2018/06/13/texture-space-decals/
Finally wrote up my texture-space decal work from earlier.
Steam Stuff Show more
So, turns out: there aren't any fringing artifacts. Not exactly.
The sun light is bright. The decals are highly saturated. When they blend together, there's enough of each channel for the tonemapped color to peak at white. But the colors on either side have one really dominant channel, so they *don't*. Ergo, you get white fringes between two highly saturated colors.
Figured out a much, much simpler method of wrapping splats around edges:
decal_normal = normalize(-ray_direction + surface_normal)
(Previous implementation iterated all faces within a particular radius and averaged their normals.)
Less "clean", causes the decal to stretch along the ray direction, but that seems correct for impact decals? Certainly cheaper (by, like, 0.8ms).
While working on writing up this decal system, realized the problem with UV seams *isn't* texture filtering. It's rasterization.
Which means conservative rasterization should fix the seams without doing the image-space expansion. (Saving an extra draw call and render target per update, as well as the UV mask texture.)
So now I get to figure out how to turn that on. Or if I even can.
UV seams are a problem.
Fixing this is interesting. Blurring causes more damage than good. (Would need to blur on each splat, which means the existing splats get progressively blurrier.)
Could bake a secondary UV set that expands island borders?
Complicated.
Gonna try rendering a mask (1 for every pixel covered by UV, 0 elsewhere) and use that to grow the borders in image space. Would rather not need the extra texture, but...
Spent all day chasing a bug and getting nowhere. Closed-source means I can't even validate my theory about what's broken.
Extremely frustrated. This was supposed to be straightforward. I can't even get to the "hard part" of the problem because I'm now blocked divining the inner magical workings of this black box.