Kray User Manual

From Kray
Revision as of 14:36, 13 May 2008 by Admin (Talk | contribs) (New page: CHAPTER 1 = Introduction = [[Image:|thumb|Figure 1: Image by xxx]]Kray is a state of the art Global Illumination renderer that allows very fast and accurate rendering of scenes where indi...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CHAPTER 1

Contents

Introduction

[[Image:|thumb|Figure 1: Image by xxx]]Kray is a state of the art Global Illumination renderer that allows very fast and accurate rendering of scenes where indirect light plays important role. It includes most advanced modern algorithms and optimizations that allow it to render not only stills but also animations with full global illumination very fast on standard computers.

Kray is not limited to LightWave architecture and provides you powerful features not to be found in LightWave.

Another important feature of Kray is that it integrates tightly into LightWave. It already supports most of LightWave features and it's being constantly updated with new ones.

[little history?,,,]


Chapter 2

Features

2.1 – What's new in 1.7

  • bla bla
  • bla bla

[what's new from 1.6,,,]

2.2 – Complete feature list

Global illumination:

  • full global illumination, includes many ways of light transport
  • photon mapping: a number of ray bounces has small influence on rendering speed (good for scenes with many ray bounces)
  • light mapping: similar to photon mapping, but with many advantages
  • irradiance caching
  • irradiance gradients: interpolates irradiance to save rendering time, works correctly with reflection and refraction (where shading noise reduction fails)
  • path tracing: fast when the number of ray bounces is small
  • reusable GI data to speed up rendering animations
  • Importance sampling: gives a huge speed up when rendering scenes with a large number of rays recursion

Image sampling

  • Several antialiasing modes

Effects

  • Caustics: fast caustics using photon maps
  • Fast blurry reflections
  • luminous polygons: any object can be a light source that illuminates other objects even if GI is disabled
  • Instances
  • Motion blur
  • DOF
  • Several tone mapping modes (gamma, linear,exponential, HSV)

Misc

  • progressive preview display
  • multi threading, takes advantage of multi core, multi CPU, hyper threading systems (up to 128 threads)
  • GUI with predefined presets
  • dual platform license (Mac, PC)

2.2 – Not yet supported features

Although Kray supports many of LightWave features there certain are limitations in LightWave SDK that prevents Kray to access some features. This include:

  • surface editor shaders
  • image/pixel filters
  • APS and per pixel displacement
  • Volumetrics

There are also some less important LightWave features that have not yet been implemented but are probably going to be in future:

Objects:

  • Geometry: Kray captures whatever LightWave displays in OpenGL therefore most settings work except those that happen during LightWave render.
  • Object properties>render tab: alpha, dissolve, matte object, self shadow, receive shadow
  • Object properties>edges
  • Object properties>lights

Lights:

  • Light flags
  • Volumetric lights
  • Lens flare
  • Shadow color
  • Shadow maps (Kray always uses ray traced shadows)
  • exclude object from Light

Surfaces:

  • Alpha channel
  • LightWave 9 nodes
  • Surface editor: Reflection options
  • Effects: Compositing
  • Effects: Processing tab
  • object/lights: exclude

CHAPTER 3

Installation

3.1 – Windows

Download .zip file with and unpack it to directory you want have Kray installed. Make sure you are not running LightWave and click Install icon. Install utility will copy all necessary files to LightWave’s plug-ins dir and inform LightWave that there is a new plug-in. Now you can run Layout and start Kray. Go to Master Plug-ins (Scene tab) and select Add Layout or Scene Master. There should be Kray on the list.

You can add new button to Layout’s GUI that runs Kray. To do so go to Edit Menu Layout (Alt+F10) find Kray render (it is in Plug-ins submenu) and add it to your interface.

3.2 – Mac

Download .zip file with and unpack it to directory you want have Kray installed. Make sure you are not running LightWave and click Install icon. Install utility will copy all necessary files to LightWave’s plug-ins dir and inform LightWave that there is a new plug-in. Now you can run Layout and start Kray. Go to Master Plug-ins (Scene tab) and select Add Layout or Scene Master. There should be Kray on the list.

You can add new button to Layout’s GUI that runs Kray. To do so go to Edit Menu Layout (Alt+F10) find Kray render (it is in Plug-ins submenu) and add it to your interface.


CHAPTER 4

Basics of global illumination

Global illumination is a process of illuminating the scene that takes into account not only the light which comes directly from a light source (direct illumination), but also indirect light that is being reflected (bounced) by other surfaces in the scene (indirect illumination).

Images rendered using global illumination algorithms therefore appear more realistic than images rendered using only direct illumination. However, they are also much slower to generate and more computationally expensive. A common approach is to compute the global illumination of a scene and store that information with the geometry. That stored data can then be used to generate images from different viewpoints for generating walkthroughs of a scene without having to go through expensive lighting calculations repeatedly.

Radiosity, ray tracing, beam tracing, cone tracing, path tracing, metropolis light transport, ambient occlusion, and photon mapping are all examples of algorithms used in global illumination, some of which may be used together to yield results that are fast, but accurate.

(source: http://en.wikipedia.org/wiki/Global_illumination)

4.1 – Global illumination techniques in Kray

In Kray you can choose between several of this techniques – Raytracing, Photon mapping and Path tracing. Raytracing computes only direct illumination while Photon mapping, Light mapping and Path tracing compute full global illumination in a scene.

Photon mapping is one of the techniques which help speed up calculation of GI dramatically. It basically consists of two steps: shooting photon and final gathering. In the first step a specified number of light packets called photons are fired from a light source and bounced around the scene. Whenever a photon intersects with a surface, the intersection point, incoming direction, and energy of the photon are stored in a cache called the photon map.

You can see photons in kray by using Photon estimate mode > Global unfiltered.


(sample render here)


Photon mapping is only a rough approximation of a light at any given point. Therefore we need another step to get more accurate result.

The final step in rendering that Kray does is called Final Gathering (or FG).

This technique computes a lot more accurate illumination at a sampled point. It uses photon map that was computed in previous step to help speed up the process. But to compute irradiance for every point in space may still be very slow therefore it uses another technique called irradiance caching to speed up the process. What irradiance caching does is, it only computes irradiance at points where light is most likely to change - for example in corners, in place of shadows, where two surfaces are near each other, etc.). Where surface is large and flat it uses a lot less points to save a lot of time. Kray finds this points by doing pre pass before final render called prerender.

You can see where Kray is computing FG by selecting Photon mapping mode with cache irradiance and turn on show samples in FG tab.


(sample render here)


You can also turn irradiance caching off in the main tab by unchecking cache irradiance button. This might be usefull in difficult light conditions where cached irradiance gives alot of errors (splotches appear) which don't go away even by increasing number of FG rays.

The nice thing about photon mapping and irradiance caching is that it can be saved to a file and reused for another frame. So in an animation you only have to compute FG for those points that have not yet been computed (that have not been seen by camera in previous frames).


Links for more in depth knowledge:

http://en.wikipedia.org/wiki/Photon_mappinghttp://web.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/photon_mapping/PhotonMapping.html

CHAPTER 5

Setting up LightWave

5.1 – Environment

Since Kray is relying on real world physics to compute global illumination in a scene it is important to set up scene properly.

First thing you need to do is to turn on all raytracing flags in LightWave render options.

[[Image:|thumb|<center>Figure 2: Render Globals LightWave settings
]]</center>

Ray recursion limit tells Kray how many times the light should bounce. This is very different from LightWave since in Kray increasing number of bounces doesn't increase render time very much.

You can also override number of bounces by adding the following command to tailer line in Kray GUI: recurse 100; This will tell Kray to use 100 bounces of light.

5.2 – Lights

The next thing you should do prior to any Kray render is to turn ambient light to 0%. Ambient light will make your renders look washed out and unnatural.

It is also important that your lights in the scene are physically correct. In reality intensity of light fades with distance from light source. Therefore your lights should have some kind of falloff. The most accurate falloff is Inverse square.

If you do not set-up your LightWave this way Kray will give you a warning saying Physically incorrect light model in a scene with global illumination. But this doesn't mean your scene won't render. It will render just fine but your render will not be “physically correct”.

Background also acts as a light source in global illumination scene. Note that photons tracing does not support background lighting since there is no point from where photons can be emitted (use light maps instead).

Sometimes that's ok since CG is not an exact science - it is all good as long as it looks good. For example sometimes you will want your lights to have linear falloff, to lighten up certain parts more and avoid over burned areas.

You can use Spotlights to light your scene also. There is a switch in Kray GUI which converts Spotlights into area lights. This is especially handy when you want soft sun shadows. Using LightWave's “soft edge angle” you control how soft the shadows are.

Tip: For a nice realistic Sun light use Spotlight with soft edge angle to 0.55. Put sun 1km away (that's easiest done with Sun spot motion modifier) and set Light to have Inverse distance^2 falloff of 1km.

5.3 – Models

Since Kray does many different computations to avoid long render times it is necessary to obey some rules when building 3d models.

Here are some guidelines to follow:

  • Try to model clean and if possible „watertight“. This means that you should check that your points are merged together and polygons share edges. For example: if polygons don't share edges in room corner in a room, you may get light leaks, because Kray will sample points from both sides of polygon instead only from inner side.
  • UV's can sometimes cause problems. So be take care when unwrapping your models.

For more help take a look into troubleshooting section of this manual.

5.4 – Surfaces

Since Kray uses physically accurate computation to render the scene there are some guidelines that you should try to follow when setting up your surfaces.

Light and material models used in 3d packages (such as LightWave) are not always physically correct. For example in LightWave you can create material that has diffuse 100% and reflection 100%. Diffuse + reflection = 200% and that means material reflects (in sense of total light reflection, not specular reflection only) more light that receives. Physically incorrectness in non-GI scene helps to hide lack of global illumination and often looks better than correct models, but in GI scene such models can look very unnatural.

Kray does not force user to use physically correct models. They are sometimes useful to make rendered images look more dramatic, it is important to know when the scene matches the laws of physics and what will happened if we break them.

5.5 – Luminosity

Object with surface material Luminosity>0 material really emits light and with GI enabled can illuminate your scene (this can even work without GI enabled, if you choose "Compute as direct" Luminosity model). If you use luminosity to get better shading only your object will glow (similar to glow caused by ambient light). You are not limited to 100% luminosity. You can use values over 100% as well (same way as light intensity). What is nice in luminosity light sources is that unlike regular lights they can have a texture.

5.6 – Balance

As I mentioned on the beginning in LightWave you can create surface that reflects more light than receives. That gives more freedom to artist and does not make problems in local illumination scenes.

Problem can appear when we use surface that reflects more then it receives in global illumination scene. This can cause unlimited light bounce, glowing objects, strong artefacts.

Balance rule

  • General rule: Diffuse+Reflection+Translucency<100%.

Notice that it is "less then" not "less or equal then". In reality no material reflects all the light that hits its surface. The same rule is valid if we use gradients or textures for every gradient angle and texture pixel. Also notice that if we have texture color RGB (128,128,128) and Diffuse 100% material still fits Diffuse<100% rule. In fact it is 50% diffuse because it is the same as RGB (255,255,255) and Diffuse 50%. Pure 100% diffuse reflection is when color is RGB (255,255,255) and Diffuse amount is 100%.

Balance rule does not affect Luminosity. Feel free to use 300% Luminosity and 95% Diffuse for example.

Transparency (the one from Basic tab in surface editor) fades Diffuse channel (so 90% Diffuse + 40% Transparency is ok) because:

90% diffuse * (100%-40% transparency fade) + 40% transparency = 54% diffuse + 40% transparency

Transparency does not fade Reflection (so 90% Reflection + 50% Transparency is too much).

Additive transparency does not affect Diffuse amount (so 90% Diffuse + 50% Addtive transparency is 140% and is not ok).

5.7 – Specularity

Specularity is used to fake light reflections. It simulates how light would be reflected on a rough surface. This is used because rendering blurry reflections was often very slow. It has important limitation though: it doesnt render light reflected from other surfaces as specular.

In Kray however you should avoid using any specularity because blurry reflections work very fast and look much better. So instead of using specularity and glossiness you just have to add reflection and some blurring to get nice glossy surface.

5.8 – Mipmap

Mipmaping is used in Lightwave to anti-alias textures to prevent “crawling” textures in animations. This produces quite blurry textures since Kray renders quite strong mipmapping. So make sure mipmapping is OFF for your textures. This is especially important for Bump channel where mipmapping may diminish effect of bump map completely.

Kevin Phillips created a nice script that will turn mipmapping off for all selected objects. You can download it on his homepage:

http://www.kevman3d.com/lightwave.asp?section=plugins&sub=layout

CHAPTER 6

Kray Interface

The following section explains each and every setting in Kray interface (GUI).

6.1 – General tab

[[Image:|thumb|
Figure 3: General tab screenshot
]]

6.1.1 Render preset

This selection list lets you choose predefined presets. What it does is it sets all the presets on all the tabs to coresponding values. For example: if you select Medium it will set “medium” preset for photons, FG, Quality and all the other “sub-presets”.

You can select between various presets we have defined to make work easier. Presets are not the fastest possible render settings but rather a safe solution that should work in most scenes.

6.1.2 Save/Load

Save buttons lets you save Kray settings into a file which can than be recalled in any scene by using Load button.

6.1.3 Diffuse model

This is the main render mode selection button. It lets you choose between various render methods which are explained below.

Raytrace

This mode will do render the scene with only raytracing. This means that no global illumination will be computed. This mode is usefull mainly for testing purposes since it doesn't do anything realy special. Make sure your raytrace flags are ON in LightWave render globals to make it work properly.

Photon estimate

Photon estimate lets you choose between several modes that render out a quick representation of global illumination in the scene. In this modes no final gathering is used so rendering is very fast.

Global filtered - mode renders photons that are fired into the scene and filters them.

(render sample)

Global unfiltered - mode renders representation of photons in the scene. You will sometimes want to see photon density in your scene and this mode is best for showing that.

(render sample)

Precomputed - will render out representation of irradiance cells. It mimicks global illumination in a scene quite well. It's often used to see how big the cells in scene are and if irradiance is smooth enough or not.

(render sample)

Precomputed filtered – is very similar to precomputed. The only difference is that filtered mode filters (blurs) cells together. It renders very close representation of global illumination in the scene very fast and is therefore recommended mode to use when tweaking light or surfaces. This mode also offers option to ray trace shadows and render causitcs which makes it even better representation of final render.

Photon mapping

This is the the main render mode in Kray render engine. It uses photon mapping with cached irradiance to render out full global illumination images fast.

Cache irradiance

When this check box is turned on Kray will use irradiance cache to speedup rendering. Read mode about irradiance caching in section 4.1. When this check box is turned off Kray will not use any irradiance caching and will evaluate each pixel separately. This gives best quality shadows at the expense of render time. Uncached mode only uses Fg threshold, rays min and max settings on the FG tab. All the other settings will not have any effect.

Path tracing

**

6.1.4 Caustics

Custics checkbox will enable rendering of caustics in the scene. So whenever you wan't caustics to show up, don't forget to turn this on.

6.1.5 GI mode

To speed up rendering of image sequences Kray offers 3 different modes.

Independent

This mode will turn off GI sharing. It's used for testing or when you're rendering a single still.

Time interpolation

This mode can be used whenever there are moving objects and/or light sources in a scene.

Frames *

Extinction *

Precached map *

Irradiance cache *

Shared for all frames

If only camera is moving in your scene you should select this mode. You should specify a filename that Kray will use to save GI data into.

There are 3 different modes available:

Load: will load up the Gi data in the specified file. If the GI file doesn't contain enough data to accurately render global illumination it will compute new samples. This mode is often used when testing FG settings since it will only load save data and not save any new one into the file.

Save: will save computed GI data into the specified file when render frame is done.

Both: will load any existing GI data from file and on render end save new GI data into the same file. This mode speeds up rendering of animations dramatically. First frame will take some time to render, but all the consequtive frames will render much faster since they will compute GI only for the part of the scene that hasn't been calculated allready. You should be carefull with this mode when stoping and restarting rendering of animations. You should always use the same GI file to render complete animation. If you fail to do so you risk having sudden jump of light because every GI computation is a little different. So for example you rendered animation from frame 1-30 with one GI file and then frames 31-60 with another you will see a sudden jump of light in frame 31.

6.1.6 Camera

You can choose between using LightWave camera or any of the built in cameras.

LightWave: Will use currently selected LightWave camera for rendering.

Spherical: Will render panoramic render mode, also called longitude/altitude. This is good for rendering out 360° panoramas.

Fisheye: panoramic render mode, also called light probe.

Texture baker: this mode allows to bake lighting on textures. Two options are available when this mode is selected. Object and UVname allows you to bake textures on object you want.

6.1.7 Pixel order

Pixel order allows user to select order of pixels appearing on screen. This option have influence on quality and rendering time if combined with Irradiance caching.

Scan line: will render pixels line by line starting at top

Scan row: will render each row of pixels starting from left.

Random: will render pixels randomly.

Progressive: will progressively render the frame, updating image with better detail in each pass. This mode is nice because it allows quick preview of light in the scene.

6.1.8 Iris Shape

When DOF is enabled you can use any image to represent Lens aperture shape. This can be a simple black and white image of even color image so R, G and B rays all can have difference iris shape.

6.1.9 DOF target

will let you choose object which Kray will use as a focus point. This option overrides LightWave camera Focal distance.

6.1.10 Override surfaces

This is very helpful setting aimed mostly for testing or troubleshooting. It will let you override all surfaces with a specified color. You can also exclude certain surface parameters from overriding:*

6.1.11 Output files

lets you specify name of an output file wher Kray will writte the image to.

Format: You can choose between several standard file formats. HDR let's you render into high dynamic range image.

6.1.12 Tone map

Tone mapping is used to apply color transformations on the final image colors. Sometimes an image can contain a higher range of colors that can be displayed on a computer screen. Color mapping has the task of re-mapping the image values to be suitable for display purposes.

Linear: will not apply and correction to the image. This may produce too dark images since iamges need some gamma correction to be displayed correctly on monitors.

Gamma: this is standard correction that is used on all monitors. The amount of Gama correction is defined by Parameter field. Most monitors use gamma correction of 2.2 but this may produce wash out images. Generally speaking values between 1.4 and 1.8 work best.

Exponential: mode will reduce the brightness of overexposed areas to pure white.

Parameter:

Exposure: defines exposure of image. It works similar to exposing photos. Higher number means longer exposure thus brighter image, lower shorter – darker image. It is usually good idea to keep this value at 1.0 since larger values may produce bad antialiasing.

HSV mode: when using tone mapping colors may loose their saturation. When this option is turned on kray will try to keep saturation of colors instead of washing them out.

**Dark/bright multiplier (needs to be connected to GUI.)

6.1.13 Header cmds / Tailer cmds

This are additional kray “core” commands that do not have direct connection to buttons in GUI, but can instead be run by entering appropriate command.

You can find the list of all available commands in section 8.1

6.2 - Photon tab

This section controls the first stage of rendering. The stage consists of two stages: Computing global PM (Photon or Light maps)

and Precomputing irradiances. In the first stage photons are shot into the scene and evaluated. In the second stage the photons are filtered into irradiance map. For more information refer to section 4.1.

[[Image:|thumb|<center>Figure 4: Photons tab screenshot
]]</center>

6.2.1 GI resolution

GI resolution field is common for Photons and FG tabs. This allows user to easily rescale all GI parameters by changing GI resolution. For example if precache distance is set to 50% and GI resolution is 150mm that means that precache distance will be 50% of 150mm = 75mm.

Auto: when this option is turned on Kray will compute size of GI resolution automatically. You can see what size Kray chose by looking at render log where it says:

[[Image:|thumb|<center>Figure 5: Render log screenshot with GI resolution highlight
]]</center>

r=0.162 means GI resolution is 0.162 m.

6.2.2 Photon settings

Photon preset

This selection list lets you choose predefined photon presets. When you choose Custom from the preset list advanced settings are unlocked.

Photon map/Light map

This let's you choose the mode for shooting photons. There is important difference between the two modes. Photon map will shoot photons from light sources while Light map will shoot photons from camera.

You can read more about photon vs. lightmap mode in section 4.1

Global photons

controls the number of photons shot into the scene. The higher the number the longer it will take for Kray to shoot photons but the light estimation of the scene will be better. Usually the values vary between 100.000 and 1.000.000 photons.

Emitted/Received: since the number of photons that are shot into the scene and those that actually hit something may differ a lot Kray let's you choose preferred method. In emitted mode Kray will keep shooting photons until it has shot the number of photons specified by global photons setting. When received mode is selected Kray will only count those photons that actually hit objects in your scene.

Multiplier

This value let's you increase or decrease the brightness of indirect light. Higher values make brigter indirect light while lower values will make it darker.

N

This value defines how many photons will Kray blur together to produce smoother irradiance.

Precache distance

This is the size of irradiance cells in the scene. The bigger the scene, the lower the accuracy of indirect light. Smaller precache distance will produce more cells and thus more accurate indirect light.

Precache blur

has similar effect as N value – it blurs irradiance, thus removing the irradiance splotches. It works faster than N but it may not produce as accurate irradiance because N depends on photon density, while precache blur depends on size of GI resolution. It is usually a good idea to keep a good balance between both values.

Use Autophotons

(Note: this is advanced setting which probably never needs to be changed)

Usually photons density is not even across the scene. It is high in some parts of a scene and low in the others. In such situation the constant size of a photon filter does not work well. Therefore it is better solution to adapt filter size to photons density.

When Autophotons setting is off you can manualy control the filter size. Kray will use appropriate radius size between min and max values to find the number of photons specified by the N setting.

When Steps is bigger then 1 Kray tries to find the size of a filter radius that contains N photons. It will start with Min radius and increase filter radius Steps times unless it reaches Max radius.

When Autophotons is turned on, Kray will analyze photon maps before actual render and set all rendering critical parameters automatically.

Low and High percentages are equivalents of Min and Max radius, but they are expressed relatively to real photons density in the scene. If Low value is to big, regions in scene with high photons density (low radius) may contain to few (less then N) photons. If High value is to small, areas with low photons density (big radius) will contain much more photons then N.

Dynamic is equivalent of Steps, but it is automatically adapted to real distance between regions of high and low photons density. That means if for example Dynamic is set to 10 and density of photons is even on the scene, autophoton system will set Step to 1. But in the case when photons density vary in different parts of the scene, Steps value may be higher, but not bigger then 10. Too low Dynamic value may appear as noise on caustics. Too high value on the other hand may slow down rendering process.

6.2.3 Caustics settings

Caustics preset

This selection list lets you choose predefined caustics presets. When you choose Custom from the preset list advanced settings are unlocked.

Add to lightmap

**

Caustics photons

controls the number of caustics photons shot into the scene. The higher the number the longer it will take for Kray to shoot photons but the light estimation of the scene will be better.

Emitted/Received: since the number of photons that are shot into the scene and those that actually hit something may differ a lot Kray let's you choose preferred method. In emitted mode Kray will keep shooting photons until it has shot the number of photons specified by global photons setting. When received mode is selected Kray will only count those photons that actually hit objects in your scene.

Multiplier

This value let's you increase or decrease the brightness of caustics. Higher values make brighter caustics while lower values will makes them darker.

N

This value defines how many photons will Kray blur together to produce smoother irradiance.

Use Autophotons (Note: this is advanced setting which probably never needs to be changed) See section 6.2.2 for more information.

6.3 - FG tab

Here is where you will spend most of the time in Kray GUI. This tab controls the most important stage of rendering – final gathering (FG). For more information about Final gathering refer to section 4.1

[[Image:|thumb|<center>Figure 6: FG tab screenshot
]]</center>

6.3.1 GI resolution

See section 6.2.1 for more information.

6.3.2 FG preset

This selection list lets you choose predefined FG preset. When you choose Custom from the preset list advanced settings are unlocked.

6.3.3 FG threshold, min rays, max rays

Whenever you see threshold in Kray interface it always means the same.

Kray starts sampling point by shooting min number of rays into the scene. Threshold defines the how much difference between two pixels is "allowed". If difference is greater than that defined by threshold, Kray will increase rays, until the difference gets smaller than the threshold. It will also stop adding rays if it reaches max rays before reaching the threshold value.

The FG threshold should be usually left at default 0.0001. Increasing this number may cause splotches in the scene but may reduce render time.

Min rays define the least amount of rays each sampled point will fire. This value is usually kept low – around 100-300, but may be increased if there are artifacts in the scene that do not dissapear when increasing max rays value.

Max is the maxiumum rays Kray will use for any sampled point. If this value is too low you splotches will appear. Increasing this value means longer render time. By increasing this number render time increases approximately linear. For example if you increase max rays from 500 to 1000 render time will double.

6.3.4 Prerender

Prerender is the first step of FG which helps in defining which parts of the scene should be evaluated more thoroughly. When prerender value is 50% it means that it will render use 50% of the final resolution. You should also note that increasing prerender will cause longer prerender pass but shorter final render pass.

This value is best kept between 50%-100%.

6.3.5 Samples locations

It is important to understand how Kray chooses location of samples. To optimize rendering as much as possible samples are placed at “strategical” places. This are usually places where surfaces are close to each other or places of sudden light change. On large flat areas there is no need to compute samples for every pixel so Kray will only place only very few samples there. This way speed of rendering can be greatly improved. More samples means longer render time. Therefore it's important to find the right balance between sample density and render quality. There are several settings which control placement of samples in a scene:

Spatial tolerance

This is one of the settings that has the most effect on indirect shadow quality. Spatial tolerance defines the distance between sampled points. If spatial tolerance is large sampled points will be placed far appart and thus will not be able to sample global illumination accurately. This will cause faster render times at the expense of render quality. Very low spatial tolerance will cause a lot of sampled points and therefore very accurate GI but also longer render times.

Spatial tolerance size is relative to GI resolution.

Angle tolerance

Angle tolerance defines the placement of sample points on curved surfaces. The value defines how much can surface angle change before new sample is added.

Distance min / distance max

This is an important setting for control of sample density in a scene. What determines weather a new sample will be computed on a certain point is the distance to other surfaces. Kray does that by firing rays from the sample point and measuring how far the ray can travel. Where rays travel long way, Kray knows threre are no surfaces near it and thus the next sample can be computed further away. If ray hits something very near, this tells Kray that a new sample should be computed near the previous one so that the light shift can be computed accurately.

In simple terms distance min and distance max define how close/far apart the samples are placed. If distance min is small samples will be placed closer together and vice vers.

Distance min and max are both relative to spatial tolerance size. So increasing spatial tolerance will also increase distance between samples.

In more technical terms distance min defines the minimum distance that the ray shot from a sampled point can represent. All samples that travel less than min distance will be treated just as if the are min distance long. Distance max is the opposite and defines the maximum length the ray can travel from any sampled point. All samples that travel further are treated to be the same length as distance max.

B/D

Brightness/Density will add more samples in places of high light contrast.

6.3.6 Blur

Will blur neighbouring samples and thus reduce artefacts such as splotches. The drawback is that it may also blur some very fine indirect shadows.

6.3.7 Show samples

This option lets you visualize placement of FG samples. This is primarily used for testing and troubleshooting.

Off

Will not show any samples.

Corners

Will show only samples in corners.

All

Will show all samples in scene.

6.3.8 FG reflections

Will turn on or off tracing of FG rays on reflective surfaces. Turning this option off may speed up render times but it may also cause inaccurate reflections.

6.3.9 FG transparency/refractions

Will turn on or off tracing of FG rays on refractive or transparent surfaces. Turning this option off may speed up render times but it may also cause inaccurate calculation of GI through transparent/refractive surfaces.

6.3.10 Corner distance/Paths

When Paths is set to > 0 Kray will turn to path tracing when rendering corners. This may reduce splotches or light leaks. Distance specify how far from a corner paths rendering will be used.

6.4 – Sampling tab

[[Image:|thumb|<center>Figure 7: Sampling tab screenshot
]]</center>

6.4.1 AA preset

This selection list lets you choose predefined Anti-aliasing preset. When you choose Custom from the preset list advanced settings are unlocked.

6.4.2 Antialiasing

Antialiasing is used to smooth out jagged edges. You can choose among several antialiasing methods from this drop down list.

Grid

Grid size

Controls the subdivision of anti aliasing grid. Kray will subdivide each pixel into a grid of the specified subdivision. So Grid 3 for example means each pixel will be subdivided into 3x3=9 sub pixels. This helps to smooth out edges but it will render longer.

Rotate Grid

This method helps with occasions when near horizontal or vertical lines don't get smoothed enough by using ordinary grid anti-aliasing.

FSAA

Kray has two methods of choosing which pixel to anti-alias and which not. One is adaptive (see section 6.4.2.6) and will only anti alias pixels that it considers to have bad AA. The other method is Full screen anti-aliasing or FSAA. When this option is turned on Kray will anti-alias every pixel in a render (instead of only those that suffer from bad AA). This will significantly extend render times but it's worth it if your scene contains lot's of small, fine details.

Quasi-random

Is another method of anti aliasing that will fire specified number of rays from each pixel marked for anti aliasing. Rays are not shot in completely random way. More rays are shot in the direction where Kray thinks it contributes more to brightness of the pixel – hence Quasi-random. This is why this is very fast anti-aliasing method.

Kray starts sampling point by shooting min number of rays into the scene. Threshold defines the how much difference between two pixels is "allowed". If difference is greater than that defined by threshold, Kray will increase rays, until the difference gets smaller than the threshold. It will also stop adding rays if it reaches max rays before reaching the threshold value.

Random

Is another method of anti-aliasing pixels in a scene. It will use completely random method of fireing rays and is therefore quite slow compared to the other methods.

Rays will specify number of rays to be used.

Pixel filter

You can choose between several different methods for filtering of pixels. Each pixel filter will look a little bit different. Some produce sharper and some softer images. Some are better when dealing with moiree patterns.

Filter radius specifies the amount of “blur”. When radius is large image will look more blurry. With low filter radius images will look sharper.

Adaptive anti-aliasing settings

The following options control which pixels will Kray choose for anti aliasing when FSAA is turned off.

Edge absolute is a difference between two pixels. if it is higher that than value both pixels are on the edge and will not be marked for AA.

Relative is a relation between brightness of two pixels (brightness of 1st pixel / brightness of 2nd pixel). Where edge absolute often misses edges in dark areas (not enough brightness difference) relative does not.

Normal and Z is normal angle and distance to camera edge detection so even if you have black square on black background it will be marked as edge if z is > zero. Z and normal can be detected to upsampled image. For example: if you have 640x400 rendering and some details are sub pixel size, they can be skipped in edge detection. Kray can detect normal and Z edges on twice as large image and don't miss those details this is what upsample is for.

Thickness is a edge thickness in around antialiased pixel that will also be marked for antialiasing.

Overburn is used to control weather Kray should anti-alias edges on overexposed areas.

Undersample and threshold

Under sampling is a technique that can save some CPU time needed to perform rendering. This works as follows: In the first pass the image is sampled with lower resolution (Undersample factor defines how low), and if difference between neighbouring pixel values exceeds threshold image is locally sampled with higher resolution.

6.5 – Quality tab

[[Image:|thumb|<center>Figure 8: Quality tab screenshot
]]</center>

6.5.1 Quality preset

This selection list lets you choose predefined Quality preset. When you choose Custom from the preset list advanced settings are unlocked.

6.5.2 Luminosity model

Luminosity model tells Kray how Luminosity should be computed. In LightWave luminosity is just a colour. A surface like that does not illuminate anything if the radiosity is disabled. In Kray you have a choice. Your luminosity surface can really illuminate other objects even if GI is disabled (Luminosity model: Compute as direct) or you can make it a coloured surface (Luminosity model: Compute as indirect) which will illuminate other objects only if GI is on.

When you are using GI these setting is also important. If your luminosity light is large and not very bright (cloudy sky dome for example) you will achieve faster rendering using Indirect computation method. If, however, your luminosity light source is small and very bright you should use Direct computation method to avoid strong noise on the image. Kray can automatically switch between Direct & Indirect light model. Select Luminosity model: Automatic, the Level field will appear. Now surfaces that have luminosity lower then a level value will be computed indirectly. Surfaces with luminosity value higher then a level will be computed directly.

6.5.3 Area lights

Area lights can be computed in two ways. Either by the use of the optimized algorithm for rectangular lights, in which case every light is computed separately (Compute separately) or computing them with luminosity lights (Compute with luminosity). The former is best for scenes with not so many area lights. If there are numerous area lights in a scene it can be more effective to compute the area lights with luminosity.

Double sided check box allows you to make area light single or double sided. If your area lights illuminate the scene from one side only, make them single sided (uncheck this option) and in so doing save many precious photons in you GI simulation.

6.5.4 Area lights visibility

Area lights visibility allows you to see a light. In LightWave area lights illuminates surfaces, but you cannot see them directly. This option enables you to make lights visible directly.

6.5.5 Spotlight to area

This option lets you convert all spotlights in the scene to area lights. Spotlight's soft edge angle will be used to define how soft the shadow edge should be.

6.5.6 Area lights

Area lights sets quality for area lights. It has an effect only when Area lights is set to Compute separately. Threshold defines quality of sampling (the lower the better). Recurse min and Recurse max sets minimum and maximum number of recursions of adaptation. Higher values give better quality (less noise) but longer rendering time.

6.5.7 Linear lights

Linear lights sets quality of linear lights. Meaning of fields is similar to Area lights above.

6.5.8 Luminosity lights

Luminosity lights sets quality of sampling illumination of objects which surface has non-zero Luminosity. If Area lights on general tab is set to Compute with luminosity these values also sets quality of area lights. Note that to enable luminosity lights at all, you need to select Luminosity model Compute as direct or Automatic.

Sampling starts with Rays min and continues unless noise level is lower then Luminosity lights threshold or Rays max is reached.

6.5.9 Blurring

Reflection/Refraction blurring samples defines number of samples and thus quality of reflection and refraction blurring. Higher values give better quality (less noise). Sampling starts with Rays min and continues unless noise level is lower then Luminosity lights threshold or Rays max is reached.

Blurring accuracy limit

Blurring accuracy limit speeds up rendering of blurry reflections/refractions. Kray will use photon estimate solution instead of FG to render surfaces that have blurring higher than the value specified by blurring accuracy limit.

6.5.10 Max Octree depth

Max octree depth defines maximum depth for octal tree used for ray intersection optimization.

Important note: This parameter can have strong influence on rendering time especially if your scene contains lots of polygons. If your scene has many polygons increasing this value can reduce rendering time (but making longer rendering initialization time).


CHAPTER 7

Basic tutorials

**


CHAPTER 8

Advanced features

The following section explains each and every setting in Kray interface (GUI).

8.1 – Header commands

**

8.2 – Tailer commands

**


CHAPTER 9

Troubleshooting & FAQ

8.1 – Tips for avoiding problems

8.1.1 Modeler

  • be sure to merge points otherwise you may get „light leaks“
  • use Unify Polygon command to eliminate double geometry. This may produce artefacts when rendering.
  • check for floating points, 2 point polygons, non-planar polys, corrupted or messed up polys, intersecting polys. If you have LWCAD a FixPolygon pass is useful too. Generally speaking, most problems in Kray are caused by messed up models or wrong geometry. Kray is good in "filtering" these but better stay the most clean as possible.
  • Check for UVs: remove all not used UVs, remove imported obj/3ds uvs or rebuild them.
  • In each UV, select all polygons and cut them. If some points remain in UV view, select these and use "remove Vmap from vertices", then paste polygons you cut before. UVs should be only on desired geometry.
=== 8.1.2 Surfacing ===


  • delete each empty layer (i.e. image layers without a map)
  • delete non-used layers (deactivated and 0% ones)
  • In surfaces it's better to use few layers; Kray is higly compatible with LightWave surfacing but too many layers can give problems
  • remove any shaders
=== 8.1.3 Layout ===


  • Delete unused geometry, nulls and so on. The cleaner the scene is, the better.
  • Be sure all lights you use have inverse square faloff and lower ambient to zero. In render global, activate all four raytrace tags.
== 8.2 – FAQ ==


**

8.3 - Troubleshooting scenes

Although we do everything we can to track down all the bugs there is simply no way to find them all during development cycle. This is why users feedback is very important to make application more stable.

Whenever you encounter an error during Kray rendering it can be because of several different reasons.

Unexpected exception is often caused because Kray runs out of memory (if the scene is heavy). This can be resolved by lowering Octree depth from the default 20 down to 15 or even 10.

It can also be caused by bad geometry so be sure to check „tips for avoiding problems“ section in this manual.

Artefacts like black dots on surfaces are usually caused by a specific surface setting. This can be for example gradient on a channel that Kray interprets wrong. If you get this kind of errors it's best to reset surface to default one by one until you find the surface that is causing the problem.

The same goes for sudden crashes. Try to identify surface/object that is causing it.

If problem is reappearing it's probably a bug so please report it to bugs@kraytracing.com