Styrofoam IFS - .scene files

Parameters in this file mainly control the raytracing of the fractal, like camera position, lights and background.
The exceptions are iterations, base_sphere_radius, sphere_packing and bounding_sphere_factor which are used during point-cloud generation.
If the same parameter is found more than once, the last one will override the previous ones, with the exception of lightsource (and lighting related parameters), one light will be created for each lightsource row.

Words in italics can either be numerical values or mathematical functions.
Anywhere where you can write a value, a mathematical formula will work as well.
See the Supported mathematical functions section in the .ifs description for a list. The predefined variables can also be found there.
Example: camera_position sin(anim*2*pi/180),0,cos(anim*2*pi/180)
Any time '//' is found on a row the rest of the row will be discarded as a comment.

Parameters

iterations i

Number of iterations in the chaos game.
Default value is 1000.
Note that this parameter is only used during the point-cload generation.

Example: iterations 2000000

init_iterations i

Number of iterations done before starting to draw.
These iterations is done in addition to the normal iterations
Default value is 1000
Note that this parameter is only used during the point-cload generation.

Example: init_iterations 0

base_sphere_radius r

The default radius of a point in the point-cloud (points are represented by spheres).
Default value is 0.01
Note that this parameter is only used during the point-cload generation.

Example: base_sphere_radius 0.01

sphere_packing p

The number of points that can be fit in [0,1) on one axis.
The point-cloud is aligned to a grid. This parameter sets how dense that grid is. A bigger value will put the points denser.
Default value is 200
Note that this parameter is only used during the point-cload generation.

sphere_packing
Image shows a sphere_packing value of 6.

Example: sphere_packing 200

bounding_sphere_factor f

The point-cloud is divided into bounding spheres. This parameter tells how big these bounding spheres are compared to the point density.
Changing this parameter will only effect the rendering time.
Default value is 0.077
Note that this parameter is only used during the point-cload generation.

Example: bounding_sphere_factor 0.077

sphere_distortion d

Each point in the point cloud will be moved in a random direction by at most d.
Use this value to remove banding, it will add a roughness-effect on flat surfaces.
Note that this parameter is only used during the point-cload generation.

Example: sphere_distortion 0.0003

camera_position x,y,z

Position in space of the camera.
Default value is (0,0,-1)

Example: camera_position 0,-0.3,-3

camera_up x,y,z

The up direction in space for the camera.
Default value is (0,1,0)

Example: camera_up 0,1,0

camera_direction x,y,z

The direction in space that the camera points.
This parameter is optional, by default the camera will be aimed at (0,0,0).

Example: camera_direction 0,0,1

camera_aim_position x,y,z

Makes the camera point towards this position in space.
This parameter is optional, by default the camera will be aimed at (0,0,0).

Example: camera_aim_position 0,0.5,0

field_of_view v

The field of view of the camera.

Example: field_of_view 1

focus_distance d

The distance from the camera in the direction it is pointing where the focus will be.
Use with focus_blur to create unfocused images.
Focus is calculated over the different antialias-renders, this means you will need a reasonably high antialias to get a good result.

Example: focus_distance 2.5

focus_blur d

The average distance that the camera will be moved in a random direction each render.
Use with focus_distance to create unfocused images.
Focus is calculated over the different antialias renders, this means you will need a reasonably high antialias to get a good result.

Example: focus_blur 0.1

lightsource x,y,z,brightness,falloff

The position and brightness of a lightsource.
A new lightsource will be created each time this parameter is present in the .scene file.
Brightness will default to 1 if left out
Falloff (attenuation?) of light, default is 0 (no falloff), setting this to anytheng other than 0 will create a point-light.

Example: lightsource 2,-2,-4,1,0

light_diffusion d

The average distance that the corresponding lightsource will be moved in a random direction each render.
The first light_diffusion row will correspond to the first lightsource row, the second light_diffusion row will correspond to the second lightsource row and so on.
Light diffusion is calculated over the different antialias renders, this means you will need a reasonably high antialias to get a good result.

Example: light_diffusion 0.1

light_color r,g,b

The color of the corresponding lightsource.
The first light_color row will correspond to the first lightsource row, the second light_color row will correspond to the second lightsource row and so on.
The color will default to 1,1,1 if left out.

Example: light_color 1,0.5,0.8

material_ambience a

The ambience of the material of the points in the point-cloud.
Default value is 0.2

Example: material_ambience 0.2

material_diffusion d

The diffusion of the material of the points in the point-cloud.
Default value is 1

Example: material_diffusion 1

material_specular s

The specularity of the material of the points in the point-cloud.
Default value is 0.5

Example: material_specular 0.5

material_shininess s

The shininess of the material of the points in the point-cloud.
Default value is 20

Example: material_shininess 20

gamma g

The gamma applied to the final image.
Default value is 1

Example: gamma 0.8

max_recursion i

The maximum number of times a ray can be reflected by a reflective surface.
Set this to 1 if there are no reflective surfaces or the rendering time will suffer.
Default value is 1

Example: max_recursion 1

antialias aa

This is the number of times the point-cloud will be raytraced, the final image consists of the average of each render.
Increase this to get a smoother result.
Default value is 1

Example: antialias 4

aa_sharpness s

This allows the rays shot by the raytracer to bleed over to neighboring pixels.
Set to 1 for no bleeding. A higher value will result in a less sharp image.

Example: aa_sharpness 1.2

background_type solid|skydome|opencl

Tells the raytracer what to do when a ray doesn't hit any point in the point-cloud.
See background_solid_color, background_skydome and background_opencl.

Example: background_type solid

background_solid_color red,green,blue,alpha

Only used when background_type is set to solid
The background color.

Example: background_solid_color 0.5,0.5,0.5,1

background_skydome filepath

Only used when background_type is set to skydome
Uses a skydome as background. No skydomes are included in the installation!
Examples can be downloaded here http://www.tutorialsforblender3d.com/Textures/Skys/Sky_Dome_1.html
The center of the sky is pointing at 0,0,1 and at 0,0,-1

Example: background_skydome D:\StyrofoamIFS\background\SkyDome-Cloud-Few-MidMorning.png

background_opencl filepath

Only used when background_type is set to opencl
The file pointed to should include an opencl function kernel void background(global float4* dir, global RaytraceInfo* work, int recursion)
The raytracer will call this function with the direction of the ray to get a background color.
dir.xyz is the current direction of the ray.
recursion is the number of reflections that the ray has gone through before coming here
RaytraceInfo is defined in raytrace_half.cl in the bin folder
struct RaytraceInfo
{
 int state;
 float x,y;
 unsigned int shadow;
 float4 sphere_hit;
 float4 sphere_color;
}

The function will be called for all rays that was cast, regardless of them needing to be calculated or not, if work.state is 0 the caller expects to get a background color returned in work.sphere_color.

There are two examples included, both of them converts the given direction to a point in space for effect.
simple.cl calculates the distance between the converted direction to a given point in space and colors the background based on that distance.

The other example, mbulb.cl, is much more advanced, it creates a distance estimated mandelbulb as background. By changing the commented out rows in the background method it can be changed to a mandelbox or a sierpinsky instead.
See Khronos Group for a reference on OpenCL.

Example: background_opencl D:\StyrofoamIFS\background\simple.cl

outputformat xyz|xyzw|xyzrgb|xyzwrgb

Exports complimentary textfiles in the cache folder with .xyz ending.
One sphere per line of output.
The parameter tells what they will contain:

xyz x, y and z coordinates of the sphere.
xyzw x, y and z coordinates of the sphere, and the size of the sphere.
xyzrgb x, y and z coordinates of the sphere and the red, green and blue color-values of the sphere.
xyzwrgb x, y and z coordinates of the sphere, the size of the sphere and the red, green and blue color-values of the sphere.

Example: outputformat xyzw

huesource x,y,z,rotation,falloff

Similar to lightsource but changes the hue instead
A new huesource will be created each time this parameter is present in the .scene file.
Falloff (attenuation?) of hue, default is 0 and no falloff
Calculated after lightsources and before huesources and valuesources

Example: huesource 0,2,1,2,1

hue_diffusion d

The average distance that the corresponding huesource will be moved in a random direction each render.
The first hue_diffusion row will correspond to the first huesource row, the second hue_diffusion row will correspond to the second huesource row and so on.
Hue diffusion is calculated over the different antialias renders, this means you will need a reasonably high antialias to get a good result.

Example: hue_diffusion 0.1

saturationsource x,y,z,scale,falloff

Same as huesource but changes saturation instead of hue.
Calculated after lightsources, huesources and before valuesources

Example: saturationsource 0,2,1,0,0.5

saturation_diffusion d

Same as hue_diffusion but refers to the corresponding saturationsource instead.

Example: saturation_diffusion 0.1

valuesource x,y,z,scale,falloff

Same as huesource but changes value instead of hue.
Calculated after lightsources, huesources and saturationsources

Example: valuesource 0,2,1,2,1

value_diffusion d

Same as hue_diffusion but refers to the corresponding valuesource instead.

Example: value_diffusion 0.1