Skip to content

Supported PovRay SDL Elements

Hj. Malthaner edited this page Aug 12, 2024 · 9 revisions

Supported PovRay SDL Elements

The Raysnail 0.1.3 supports the following PovRay SDL elements in scene files:

Camera

camera {
	location <3.0, 0.9, 1.25>
	look_at <0, -0.6, 0>
	angle 50
}

Lights

In Raysnail 0.1.3 the support for light sources is very limited. Only the point light type is supported and only the location of the light source and the color are supported. The color values can be greater than 1.0 if the light is too dim.

light {
	<200.0, 300.0, 300.0>,
	color rgb <1.2, 1.1, 0.9>
}

Objects

PovRay has a huge set of object types. The rtaysnail 0.1.3 only supports a few of them, but the quadric object can emulate cylinders and cones, see https://github.com/Varkalandar/raysnail/blob/master/sdl/quadric.sdl

Sphere

The first parameter is the location of the sphere, followed by a comma and the radius. Optionally a texture block and object transforms may follow.

sphere {
	<0, 1, 1>, 0.7
}

For more details, please see the PovRay docs: https://www.povray.org/documentation/3.7.0/r3_4.html#r3_4_5_1_12

Box

The first two parameters are vectors which define two opposing corners of the box. They must be separated by a comma. Optionally a texture block and object transforms may follow.

box {
	<-2, -1, -4>,
	<2, -0.75, -3.5>
}

For more details, please see the PovRay docs: https://www.povray.org/documentation/3.7.0/r3_4.html#r3_4_5_1_2

Quadric

The quadric object is defined by the formula A x2 + B y2 + C z2 + D xy + E xz + F yz + G x + H y + I z + J = 0 A quadric can show as sphere, cone, cylinder, paraboloid, hyperbolid and some more shapes. Until the raysnail supports these primitivs fully, the quadric can be used as a replacement.

I.e. this creates a cone along the y axis. To limit the cone to a certain length, put into an intersection with a box.

quadric {
	<1.0, -1.0, 1.0>, <0, 0, 0>, <0, 0, 0>, 0
}

Optional texture blocks and object transformations are supported. For more details, please see the PovRay docs: https://www.povray.org/documentation/3.7.0/r3_4.html#r3_4_5_3_6

CSG

The raysnail 0.1.3 only supports CSG operations with two objects each. Full support of PovRay style CSG operation with any number of participating objects is planned. Support for textures on CSG elements is missing currently, the raysnail will show the textures of the objects themselves instead.

Intersection

An intersection of a quadric cone along the y axis and a unit box. The cone will be limited to -1/+1 and the caps will show the box texture instead of the cone.

intersection {
	quadric {
		<1.0, -1.0, 1.0>, <0, 0, 0>, <0, 0, 0>, 0
		texture { pigment { color rgb <0.7, 0.8, 0.5> } }
	}
	box {
		<-1, -1, -1>,
		<1, 1, 1>
		texture { pigment { color rgb <0.7, 0.4, 0.2> } }
	}
	translate <-1, 0, 2>
}

Difference

A difference of a sphere with a box to create a hemisphere

difference {
	box {
		<-1, -1, -1>,
		<1, 0, 1>

		texture {
			pigment { color rgb <0.01, 0.15, 0.3> }
			finish { reflection 0.2 }
		}
	}

	sphere {
		<0, 0.1, 0>, 0.9

		texture {
			pigment { color rgb <0.8, 0.8, 0.8> }
		}
	}

	rotate <0, 5, 0>
}

Texture

Support for textures is very limited in the raysnail 0.1.3. Plain colored pigments are supported and the checker pattern with two colors. Surface normal modifications are not supported yet. Finishes only may contain phong highlights and a simple reflection statement.

texture { 
        pigment { 
                color rgb <0.7, 0.8, 0.5> 
        } 
        finish {
                phong 0.2
                phong_size 100
                reflection 0.1
        }
}

Pigments

pigment {
	checker
	color rgb <0.3, 0.3, 0.3>,
	color rgb <0.01, 0.01, 0.01>
}

Finish

finish {
        phong 0.2
        phong_size 100
        reflection 0.1
}

Transformations

Scale

scale <2, 3, 1>

Translation

translate <1, 0, 0>

Rotation

Rotation angles are given in degrees.

rotate <0, 90, 0>

Directives

#declare

Since version 0.1.5 the #declare directive is supported for scene objects, float and vector values. It's not yet possible to declare other SDL elements like textures or pigments.

Declaring a float value

#declare n = 0;

Declaring a scene object

#declare LEMON_CYLINDER =
intersection {
	intersection {
		quadric {
			<1.0, 0, 1.0>, <0, 0, 0>, <0, 0, 0>, -1.0
			translate <0, 0, -0.85>
		}
		quadric {
			<1.0, 0, 1.0>, <0, 0, 0>, <0, 0, 0>, -1.0
			translate <0, 0, 0.85>
		}
	}
	box {
		<-0.6, 0, -0.6>
		<0.6, 5.5, 0.6>
	}

	texture {
		pigment { 
			color rgb <0.6, 0.5, 0.4> 
		}
		finish {
			reflection 0.5
		}
	}
}