7#define CAMERA_POSITIONS_LENGTH 1
8#define CAMERA_POSITIONS_ARRAY { (float4)(15, -5, 0, 0) }
9#define CAMERA_FACING_DIRECTIONS_LENGTH 1
10#define CAMERA_FACING_DIRECTIONS_ARRAY { (float4)(normalise((float3)(1, 0, 0)), 0.0f) }
12#define DO_SOFT_SHADOWS true
17#define DO_RENDER_SURFACE_NORMALS true
18#define DO_RENDER_MARCHING_ITERATIONS false
19#define DISPLAY_BOUNDING_VOLUME false
21#define SCENE_BACKGROUND_COLOUR (float3)(0.1f, 0.1f, 0.1f)
23#define SURFACE_INTERSECTION_EPSILON 0.00001f
24#define MAXIMUM_MARCH_STEPS 300
25#define MAXIMUM_MARCH_DISTANCE 100
26#define SURFACE_SHADOW_FALLOFF 5.0f
30 float t = fmod(
time * 0.75f, 2.0f * PI);
33 light.
ambient = (float3)(0.1f, 0.1f, 0.1f);
34 light.
diffuse = (float3)(0.6f, 0.6f, 0.6f);
35 light.
specular = (float3)(1.0f, 1.0f, 1.0f);
36 light.
position = (float3)(25 * cos(t), -25, 25 * sin(t));
43 float offset = -sin(
time * 0.5f) * 1.5f;
44 float dist_sphere = sphereSDF(position, (float3)(0.0f, offset - 5.0f, 0.0f), 1.0f);
45 float dist_plane = f_abs(position.y);
49 if (dist_sphere < dist_plane)
51 *distance = dist_sphere;
53 material.
ambient = (float3)(0.9f, 0.9f, 0.9f);
55 material.
specular = (float3)(0.5f, 0.5f, 0.5f);
60 *distance = dist_plane;
62 material.
ambient = (float3)(0.92f, 0.30f, 0.16f);
64 material.
specular = (float3)(0.0f, 0.0f, 0.0f);
74 return SDF(position,
time, &distance);
const uint const uint const float time
A struct representing a light, for use with the phong illumination model.
A struct representing a geometry material, for use with the Phong reflection model.
Light getLight(float time)
Material getMaterial(float3 position, float time)
Material SDF(float3 position, float time, float *distance)
float DE(float3 position, float time)