Edge smoothing

Started by
4 comments, last by eppo 7 years, 7 months ago
Hello.
I'm looking to smooth out lighting discontinuities around hard edges when drawing low resolution geometry:

bevel_0.png


I considered blurring normals in screen space (or somehow mark hard edges), but as that seemed both expensive (large kernel sizes etc.) and prone to rendering artifacts, I opted for an edge bevel algorithm that operates on the actual geometry. Essentially, it lays out an additional strip of detail around a hard edge to secure its unwelded normal orientation, then smooths the normals of vertices on the original edge:

bevel_1.png

This properly softens the edges, but it does result in an almost x2 increment of vertices needed. (It's actually more, as lights that render shadow maps can still use the unbeveled geometry since I don't displace any vertices on the bevel).
I think it's a fair tradeoff, but I still wonder if this can somehow be done without creating any additional geometry. It seems to boil down to knowing the distance to the nearest hard edge from any point (pixel) on a mesh and blend normals based on that. Though I fear that would either require a lot of connectivity information tied to the mesh, or a search in screen space.
Advertisement

Ideally, you'd soften the vertex normals at corners in the modeling package. Alternately, you could essentially paint softening into normal maps if you have them. Another approach would be to soften the actual equation for the diffuse response to wrap around corners. One example of this approach is seen in Valve's "half-lambert" lighting but you can use any number of functions that effectively let the N.L term roll around corners a bit by remapping negative values into positive space.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

K. thanks.

I should mention that many of these meshes are auto-generated in large quantities, so whatever I do has to work as a post-processor without having to manually touch up the geometry. The beveler can smooth anything you throw at it, so I'll use that method for now.

It also seems that your solution ended up showing some artifacts on some edges (see your bottom left cube, the one with the yellow ball).

Or is it due to something else (slight motion in the camera, difference in lighting maybe) ?

Also, I really love your images. Some people have very nice imagination, and it's needless to say (but I'll tell it anyway) that it helps a lot when wanting to show what you do. Congrats.

PS: sorry for the out of topic...

Then there's also: http://www.google.ch/patents/US8049753

I haven't seen this implemented in real time graphics though.. and it's patentent anyway. But maybe it gives you some ideas.

It also seems that your solution ended up showing some artifacts on some edges (see your bottom left cube, the one with the yellow ball).

I noticed that too. Most of those irregularities are because of specular aliasing/undersampling. (More rounded corners won't actually help in that regard.)

Interesting. It's a bit hard to read, but it deals exactly with what I'm trying to do. Thanks.

They create a normal vector that's a blend between two weighted smoothed/unsmoothed normals based on the distance to the nearest (hard) edge.

This topic is closed to new replies.

Advertisement