# Questions tagged [signed-distance-field]

An SDF is a function which takes a position as an input, and outputs the distance from that position to the nearest part of a shape.

25 questions
Filter by
Sorted by
Tagged with
24k views

### Sharp Corners with Signed Distance Fields Fonts

Signed Distance Fields (SDFs) was presented as a fast solution to achieve resolution independent font rendering by Valve in this paper. I already have the Valve solution working but I'd like to ...
• 1,156
1k views

### Is Jump Flood Algorithm Separable?

JFA (the algorithm described here: http://www.comp.nus.edu.sg/~tants/jfa/i3d06.pdf) can be used to get an approximation of a Voronoi diagram, or a distance transform. It does so in logarithmic time ...
• 7,351
304 views

### Choosing width of data for signed distance field texture

A signed distance field texture is a technique where you store the distance from a pixel to the surface of a shape within the color information for that pixel, allowing almost vector graphics quality ...
• 7,351
1k views

### Asset creation for signed distance field rendering?

In traditional computer graphics, most 3D models are rendered by rasterizing or ray tracing against a subdivided mesh of primitives, usually triangles or quads. More recently, some real-time ...
• 1,074
1k views

### Signed distance field font looks odd

I attempted to implement font rendering using signed distance fields. My program first generates a mono bitmap at font size 64 (using FreeType), then generates an SDF from the bitmap. This is then ...
• 163
1k views

### GLSL shapes signed distance field implementation explanation?

I'm trying to understand all primitives In this article.After hard work I just learn Sphere and Cube , I wrote description here. I could draw 2D shapes but I have trouble understanding 3D below codes:...
810 views

### MipMaps for Signed Distance Field

Is there some algorithm that keeps details when creating mipMaps for SDF? For example group of 4 pixels when only one is above threshold will lose this pixel with bilinear and creating mipMaps with '...
• 556
4k views

### How can I get a signed distance (SDF) from a mesh?

I am trying to use constructive solid geometry (CSG) and boolean operators to combine various shapes and get the outer (possibly concave) hull. This seems to work okay when using primitive shapes like ...
• 31
239 views

### Merging/Clipping Signed Distance Fields

I have multiple separate shapes for which I have generated signed distance fields by merging and clipping them against each other. Is there a generic analytical solution for merge and clip operations ...
• 131
158 views

### Having trouble implementing distance transform with jump flood

I'm attempting to use the jump flood algorithm to compute distance transforms of an arbitrary texture derived from a canvas2d context, roughly following the explanations detailed here/here. In the ...
• 23
1 vote
598 views

### How to scale signed distance field fonts properly?

I have a setup where I'm rendering a bunch of characters on a canvas with an SDF font. The users can zoom in to see the details of the smaller texts, but currently the smaller characters are quite ...
• 121
1 vote
469 views

### SDF collision detection

I was wondering if there are any techniques for calculating the intersection point/s between two or more distance fields.
1 vote
22 views

### Distance to arbitrary set of line segments acceleration structure?

Background: I'm trying to render lightning within a volumetrically rendered cloud. I'm currently using a series of line-segments to represent lightning. At first I used a distance field rendered into ...
• 280
1 vote
189 views

### Combine box shadow with a signed distance field

I'm using 2d signed distance fields in my current project for drawing shapes (example: https://www.shadertoy.com/view/4llXD7) and I want to add drop shadows to them. At first I thought I could exploit ...
• 111
163 views

### How to avoid curvature artifact in raytracer?

I have a pretty simple raytracer that is rendering some SDFs, but when my camera is close to the object I see curves: I am not entirely sure where they are coming from, as I am using nothing but ...
• 1,449
59 views

### Closest sphere on segment

I am trying to get a segment closest point on a surface and display a circle (or sphere in this case) at that position. I actually get the correct position but I can't get a uniform sphere based on ...
• 1,169
32 views

### Getting something close to the convex full of SDFs using CSG operations

Inigo Quilez has an explanation of smooth operations to join sdfs. I am trying to get something close to the convex hull of multiple sdfs. For starters let;s consider a simple case of 3 cubes int eh ...
• 1,449
24 views

### Can you estimate the shadow in a plane of an SDF?

I have an SDF and a plane. I want to generate either a square or a circle on the plane such that the orthogonal projection of the sdf on the plane (i.e. its orthogonal shadow) is guaranteed to be ...
• 1,449
29 views

### Explanation for the brute force ray marching method

Hellos, I am new to raymarching and 3D and I use python for my coding. I am trying to make a engine for raymarching and was finding the signed distance function for a mesh. How can I get a signed ...
31 views

### Improving dual contouring convergence

I have my own implementation of dual contouring. Right now I am getting the following output: This is decent, but I am trying to get a better result (i.e. try to reduce the low level voxel noise as ...
• 1,449
57 views

### Mathematical foundations of Signed Distance Fields in computer graphics

I have come across Signed Distance Field usage in Computer Graphics in construction of vector shapes, glyphs and 3D surfaces. However I can not find much of the background mathematical theory as to ...
25 views

### obj to grd sdf generators?

I am trying to generate sdfs from objs but when I try to use the only tool I find online it segfaults on even the simplest inputs, such as the blender cube. Does anyone know of a tool to generate grid ...
• 1,449
363 views

### Ray-Marching: Rendering a Voxel Grid with Proper Normals

Dear Computer Graphics SE, I have a RAYMARCHING renderer, that looks up voxel data from a 3D texture. Each cell in the texture can be 0 or 1. I have a very simple algorithm for calculating the signed ...
36 views

### Good rectangular covering of an SDF

Perhaps this is more computational geometry, but here goes: I have a 2D SDF describing my shape, but it's fine to think of it as a black/white image (black="inside" white="outside")...
• 133