Signed Distance Field Experiment

Hi :wave:

Another experiment from my archive I want to share here. One day, I was looking into efficient methods of creating distance fields - basically 2D arrays which store (or show, if color coded) the distance to geometric primitives like dots, lines etc. Aplplications include e.g. font rendering.

By using simple 3D geomatric shapes (45° cones & ridges), these can be drawn efficiently in Blender using node materials and z-Buffer sorting. The idea is not mine, I found it in a paper, but couldn’t find the exact one again when I was searching today.

Check out the *.blend (built in 2.79b BGE)

BGE_Material_Distance_Field.blend (569.0 KB)

Details:

  1. It includes some dot and line primitives with a simple shader

  2. A plane which can be moved up and down as depth limit

  3. Press SPACE to move dot

  4. Press PgUP/PgDWN to move plane.

Maybe this is useful for somebody. If you derive something from it, I’d be happy if you could dump it here.

Enjoy!

1 Like

Well, i at least learned a good approach to how to render fonts. Not what i expected opening the thread, so thanks :wink:

Glad to hear. In terms of font rendering, there is a paper from VALVE (2007) describing their font rendering back then. Unfortunately, the BGE never got that far as you may probably know. See 1, 2 or 3 for BGE text issues/options.

But fonts are just one way of using distance fields, that’s why I wanted to keep the thread generic. If you e.g. ask google for “distance field robotics” you’ll find more examples based on different motivation.

That’s pretty fucking awesome looking, I betcha it could be used to make some gnarly microscope graphics : D

  1. we can lock down where 0,0,0 is in a shader to follow a object origin

vector math (geometry:position - object info:location)

2.we take the output of this and use vector transform - world -> local
and the object can rotate and keep the vector relative to the objects transforms

  1. we can use lamp data node to do some cool stuff

  2. we can use abs(x), abs(y), abs(z) in cycles nodes noise to get symertical noise

  3. we can use cycles gradient texture sphere in 3d

@John_tgh: Thx! If you come up with a little prototype of your gnarly microscope graphics, please leave it here :slight_smile:

@BluePrintRandom: Thx for the feedback. Can you explain a bit more? You just posted two Videos with overall length of approx. 10 Minutes, without sound (?) or further explanation. I see what you are doing, but please don’t expect everyone to dig through your devlogs to get the point.

I edited the post above.