77
votes
Sharp Corners with Signed Distance Fields Fonts
EDIT: Please see my other answer with a concrete solution.
I have actually solved this exact problem over a year ago for my master's thesis. In the Valve paper, they show that you can AND two ...
49
votes
Sharp Corners with Signed Distance Fields Fonts
Sorry about the long wait, but it has become obvious that although the article I have promised is basically complete, the publishing process will take some time. Therefore, I have instead prepared an ...
10
votes
Accepted
Is Jump Flood Algorithm Separable?
Quick answers to your individual questions
What do you do if your image is not the same size on each axis though?
The paper uses square images with side lengths that are a power of 2. This is for ...
8
votes
Accepted
Signed distance field font looks odd
Hmm, that SDF doesn't look right. It should be much smoother, like this image for instance:
(image from this blog).
One possible issue I noticed in your description:
My program first generates a ...
8
votes
Accepted
Asset creation for signed distance field rendering?
Signed distance fields are popular in minimal graphics applications, such as the demo scene, where interesting objects can be synthesized from few simple analytic primitives such as spheres or cubes. ...
7
votes
Accepted
Sharp Corners with Signed Distance Fields Fonts
Adam Simmons has done some interesting work in this area. I don't know specifically how he's achieving it, but his SDF-based vector rendering is the sharpest I've seen in practice outside of Valve. ...
7
votes
Sharp Corners with Signed Distance Fields Fonts
Quite interesting! I'm the author of the valve signed distance paper. Sorry that it's a little sparse on implementation details.
I only included the two channel example as future work - I didn't have ...
6
votes
Accepted
GLSL shapes signed distance field implementation explanation?
Torus
A torus is defined by two parameters: the major radius, and the minor radius. The major radius (t.x) is the radius of the big ring (in red in the diagram), ...
3
votes
Accepted
MipMaps for Signed Distance Field
When you are making an SDF, you commonly have infinitely detailed data (like, bezier curves making up a letter) that you are making into an SDF image of a specific size.
If you make one that is 64x64,...
2
votes
MipMaps for Signed Distance Field
From what I've found, signed distance fields are not suited for minification (drawing the text on fewer pixels on screen than it covers in the texture), no matter how you mip-map them. Their main use ...
2
votes
Closest sphere on segment
Your actual result is correct in terms of what you can achieve in a single-pass with a fragment shader. It calculates the distance of the fragment's world position to the line segment. That distance ...
2
votes
How can I get a signed distance (SDF) from a mesh?
EDIT
I was able to get a simple algorithm working for this purpose, though it's not highly optimized.
In my implementation, I use sheer brute force, accelerated by GPU. By this, I mean that I get the ...
2
votes
Accepted
Having trouble implementing distance transform with jump flood
I took a few minutes and hacked this to life for you. The bugs were all pretty basic things like using floating point math where it should have been using interger math. All those little fractions add ...
2
votes
Accepted
How to avoid curvature artifact in raytracer?
In raymarching, it's typical to change the direction of the ray according to the fragment coordinates, but leave the origin at vec3(0,0,0). In you code you add r, ...
2
votes
3D triangle rasterization to voxels
A brute force method which works well and we use in production code:
Calculate AABB of triangle to create a sublist of voxels that may or may not be intersected by the triangle, also calculate the ...
1
vote
3D triangle rasterization to voxels
A solution could be on the lines of:
Consider the side that has the largest extent along some coordinate and draw the Bresenham line along it. Also draw the other two sides and for every voxel of the ...
1
vote
How to avoid curvature artifact in raytracer?
Some curvature artifacts are normal when doing raymarching or ray-tracing. And if you are careful, you can even find curvature artifacts in some rastered scenes if the triangles are small enough.
It ...
1
vote
How can I get a signed distance (SDF) from a mesh?
What you want is a Distance Transform algorithm which can be computed very fast using JFA, the steps are basically:
Define where you want your seeds (I guess points that make up your mesh.
At each ...
1
vote
How can I get a signed distance (SDF) from a mesh?
Foolproof Accurate Way:
Find the nearest element (vertex, edge, or face). Compute distance to it. Check the angle-weighted psuedonormal to tell if inside or out.
Brute Force:
...
1
vote
How to scale signed distance field fonts properly?
After some trials I've realized my problem was a programming error and not an actual issue with SDF fonts.
Originally I was rendering the numbers on the texture of the canvas, which had a fixed scale. ...
1
vote
SDF collision detection
Ive been thinking about the same problem. I suppose rather than finding the level sets, it might be more useful to think of it as finding the local maxima of the sum of the squares of the positive/...
1
vote
Choosing width of data for signed distance field texture
Here are some thoughts:
Absolute SDF value clamping, large absolute values of the SDF will not improve the quality of the rendered text. So clamping the values will ensure that you can get higher ...
1
vote
Sharp Corners with Signed Distance Fields Fonts
I am by no means an expert on the subject, but you might be able to, at least in theory, preserve sharp corners in a monochromatic pseudo-SDF if you used either a Bilateral filter a Directional ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
signed-distance-field × 23glsl × 6
mathematics × 5
font-rendering × 4
opengl × 3
raytracing × 3
shader × 3
texture × 3
algorithm × 2
computational-geometry × 2
2d × 2
voxelization × 2
raymarching × 2
3d × 1
lighting × 1
mesh × 1
gpu × 1
hlsl × 1
fragment-shader × 1
line-drawing × 1
vectors × 1
unity × 1
triangulation × 1
volumetric × 1
artifacts × 1