Adjusting the light source

adjustinglightsource.png

Setting direction of light

To set up different angle of incidence for the light source you'll have to define the coordinate system of the light source that is necessary for some calculations. First provide the direction of light rays emitted by the new light source

sheetengine.shadows.lightSource = ls;
where ls is vector pointing towards the light source (JSON with x,y,z keys). Next, define a vector that is perpendicular to it. The easiest way is to solve the {x0*x + y0*y + z0*z = 0} equation, since the scalar product of the two vectors should be 0:

sheetengine.shadows.lightSourcep1 = lsp1;
where lsp1 is a vector (JSON with x,y,z keys) perpendicular to ls. The last step is to define the third vector that is perpendicular to both of the above. The easiest is to calculate their vector product:

sheetengine.shadows.lightSourcep2 = lsp2;
where lsp2 is a vector (JSON with x,y,z keys) perpendicular to both ls and lsp1.

Adjusting shadow darkness

To use darker or lighter shadows set the following:

sheetengine.shadows.shadowAlpha = alpha;
where alpha is a value between 0 and 1: 1 means black shadows, 0 means no shadows at all.
To use a darker or lighter color for shaded sheets (sheets that are turned away from the light source) set the following:

sheetengine.shadows.shadeAlpha = alpha;
where alpha is a value between 0 and 1: 1 means black shades, 0 means no shade at all.
Shadow drawings can be switched of globally (this could lead to slight performance gain on slower machines):

sheetengine.shadows.drawShadows = false;

Last edited Dec 11, 2012 at 8:50 PM by dobsonl, version 4

Comments

No comments yet.