"Raytraced primitives in unity3d (part 5): distance fields"
Posted on 2016-11-08 in shaders • Tagged with unity3d, shaders, raytracing, distance-fields
After a long pause, I decided to give distance fields a try. Here's result:
This is a CSG-based shape. Sphere minus torus minus cube. Positions of the primitives are hardcoded.
Here's the code:
DistanceFields.shader
:
Shader "Unlit/RaycastDistanceFields"{
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1, 1, 1 …
Continue reading