pouët.net

buffered shape sdf idea. extruded 2d-sdf-buffers

category: general [glöplog]
 
Proposal for fast lowres dynamic signed distance function definitions. That can be scaled up nicely...

The source engine uses signed distance functions that are buffered on a 2d image.
The pixel on the image vary in brightness and that brightness is a lowres 2d signed distance field , usually of an alphabet in a font, but any 2d shape will do.

For text, a blurred font bitmap of each letter is equal to such a 2d signed distance field for each letter.

It is used to scale and rotate text while preserving sharp smooth round and diagonal text borders. The concept is that computation is exponential with increasing resolution and you go for the scaling that you can do in real time.

Now don't think text glyphs. Think of any 2d or 3d shape.
Or think about a T-shaped skyscraper.
Extrude any 2d shape endlessly along a 3rd axis.
Or use a3d buffer. It's already done by unnreal engine 4.

Limit the endless extruded 2d fielsdwith a union with a plane that has the cylinder axis as its normal.

You buffer an array of a local signed distance shape as 2d or 3d greyscale. 64x64px are often defining enough.

To get a scaled more accurate distance you gaussian or otherwise average any points neighborhood.

----

With this method you can have more distant more repeating smaller shapes, like leaves and grass. And you can still scale it up nicely.

Instead of many different sdf with different performance , this method uses the same fun too for all shapes and scale linearily increases computational complexity or lowers accuracy.

The advantage here is to buffer any array of shapes as image of precalculated 2d sdf of any 2d shape. Many very small and editable images.

The signed distance function of an endless cylinder is defined by an axis vector and a radius.
Replace the radius by a 2d buffered signed distance field.
We don't scale. That's a point transformation.
The cylinder has no offset, that's the same point transformation.
The cylinder axis has no rotation, that's the same point transformation.

Optionally combine 2 sdf-extruded cylinders via union or difference.

It's easy to union an endless texture- shaped cylinder with a plane to make it not endless.

It may be able to render many distant small dynamic volumetric shapes really efficiently.
You then seed these small shapes along the surface of larger invisible shapes. They can have lower detail and use the same method.
added on the 2016-04-06 19:38:00 by ollj ollj
People do experiment with various SDF representations for 3d shapes, both real-time evaluated or precalculated (or as you call it buffered).
I don't want to be _this guy_ again, but here how it works: proposals and ideas, especially vaguely defined, are cheap. So, IMHO it is really better to evaluate your idea first and do some "proof of concept" implementation, before sharing with others :-)

In short: screenshot of a working prototype or it didn't happen ;-)
added on the 2016-04-06 20:07:59 by tomkh tomkh
What tomkh said. Distance fields stored in 2d/3d textures are commonplace. If you've come up with something more interesting, code it up, don't expect other people to do that for you (and maybe find out why it's a bad idea and hasn't been done already ;)
added on the 2016-04-06 21:36:07 by psonice psonice
Yep, that's exactly the method we used in epsilon, both for the extruded texts and the revision logos.
Also, the revision-logo on revision-logo scene is exactly that orthogonal combination of extruded 2D SDFs that you describe.

It's a good idea! It's just not very new. :)
added on the 2016-04-07 08:28:52 by urs urs

login