SDK Materials
From Kraytracing Wiki
Materials
In Kray material is a data structure that describes what object is made of. Materials in Kray are always converted to surfaces before rendering. surface is "compiled" version of material, ready to render. You can build surface directly, but its more complicated then just setting material properties.
To define material use command like this:
material kray_material,color,(.9,.2,.2);
kray_material is name of newly created material, color is material attribute name and (.9,.2,.2) is attribute value.
| Attribute | Meaning | Example | Default value |
|---|---|---|---|
| diffuse | diffuse reflection | diffuse,0.9 | 1 |
| color | color of diffuse reflection | color,(0.5,0.2,0.2); | (200/255,200/255,200/255) |
| light | light emitting | light,20 | 0 |
| light_group | light emitting material (LEM) group. Polygons with the same LEM group create a LEM light | light_group,2 | 1 |
| translucency | translucency (like diffuse, but on opposite side on poly, then light source) | translucency,0.5 | 0 |
| transparency | transparency | transparency,0.5 | 0 |
| ior | index of refraction | ior,1.4 | 1 |
| fresnel | fresnel reflection | fresnel,1 | 0 |
| reflection | reflection | reflection,0.5 | 0 |
| reflection_blur | reflection blur strength | reflection_blur,0.5 | 0 |
| refraction_blur | refraction blur strength | refraction_blur,0.5 | 0 |
| blur_rays | controls quality of reflection/refraction blurring, 3 parameters required: min_rays,max_rays,noise_tolerance | blur_rays,10,100,0.01 | 0,0,0 |
| bumpdepth | strength of bump mapping | bumpdepth,1 | 0 (off) |
| edgedetectslot | antialias edge detection slot index (settings index) used by a surface | edgedetectslot,1 | 0 (default edge detector) |
| specularity | |||
| glossiness | size of specular spot | glossiness,0.1 | 0.4 |
| diffuse_mode | defines how diffuse component of material is computed (allows to choose GI method). | diffuse_mode,21100 (photon mapping+irrdiance cache) | default value if this parameter is controlled by default_diffuse_mode command |
| flags | various bit flags for a surface | flags,4+8; // inner reflection and diffuse enabled | default value is 0 |
| passivelem | sets LEM (Light Emitting Material) mode to passive (sends photons, but direct light computed with final gathering, not light raytracing) | passivelem,1; // turns LEM passive mode | 0 (active LEM) |
| texture | sets a texture for given channel. Available channels:
color diffuse translucency transparency light reflection specularity bump | texture,bump,bump_texture_name; | |
| addsurface | adds surface to material | addsurface,surface_name; | |
| reflection_blur_lights | sets reflection blur lights computation mode (0 - passive/indirect , 1 - active/direct) | reflection_blur_lights,1; // turns active mode on | 0 |
| noshadow | disables shadow casting from the material | nocastshadow,1; | 0 |
