4#define CAMERA_POSITIONS_LENGTH 1
5#define CAMERA_POSITIONS_ARRAY { (float4)(2, 0, 0, 0) }
6#define CAMERA_FACING_DIRECTIONS_LENGTH 1
7#define CAMERA_FACING_DIRECTIONS_ARRAY { (float4)(normalise((float3)(1, 1, 1)), 0) }
8#define FORCE_FREE_CAMERA true
11#define DO_GEOMETRY_GLOW true
12#define DO_SOFT_SHADOWS true
13#define DO_HARD_SHADOWS false
15#ifndef USE_BOUNDING_VOLUME
16#define USE_BOUNDING_VOLUME true
20#define DO_RENDER_SURFACE_NORMALS false
21#define DO_RENDER_MARCHING_ITERATIONS false
22#define DISPLAY_BOUNDING_VOLUME false
31#define MAXIMUM_MARCH_STEPS 150
32#define MAXIMUM_MARCH_DISTANCE 50.0f
33#define SURFACE_INTERSECTION_EPSILON 0.001f
34#define SCENE_GLOW_COLOUR (float3)(0.8f, 0.8f, 0.8f)
35#define SCENE_MAX_GLOW_DISTANCE 0.05f
36#define SCENE_BACKGROUND_COLOUR (float3)(0.1f, 0.1f, 0.1f)
37#define CAMERA_SPEED 0.5f
38#define SURFACE_SHADOW_EPSILON 0.01f
39#define SURFACE_SHADOW_FALLOFF 10.0f
53 float t = fmod(
time * 0.5f, 2.0f * PI);
56 light.
ambient = (float3)(0.1f, 0.1f, 0.1f);
57 light.
diffuse = (float3)(0.6f, 0.6f, 0.6f);
58 light.
specular = (float3)(1.0f, 1.0f, 1.0f);
59 light.
position = (float3)(5 * cos(t), -5, 5 * sin(t));
69 const float power = 7.75f +
time * 0.01f;
73 float4 colorParams = (float4) (absolute(w), m);
78 dz = 8.0f * pow(sqrt(m), 7.0f) * dz + 1.0f;
82 float b = power * acos(w.y / r);
83 float a = power * atan2(w.x, w.z);
84 w = pow(r, power) * (float3) (sin(b) * sin(a), cos(b), sin(b) * cos(a)) + position;
86 colorParams = min(colorParams, (float4) (absolute(w), m));
89 if (m > 256.0f)
break;
92 material.
ambient = (float3)(colorParams.x, colorParams.y, colorParams.z);
94 material.
specular = (float3)(0.5f, 0.5f, 0.5f);
98 *distance = 0.25f * log(m) * sqrt(m) / dz;
105 return sphereSDF(position, (float3)(0, 0, 0), 1.25f);
const uint const uint const float time
Light getLight(float time)
Material getMaterial(float3 position, float time)
float boundingVolumeDE(float3 position, float time)
float DE(float3 position, float time)
Material mandelbulbSDF(const float3 position, const float time, float *distance)
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.