kernel CubicSpace < namespace : "CubicSpace"; vendor : "Petri Leskinen"; version : 1; description : "cubicspace"; > { parameter float2 center < minValue:float2(-200,-200); maxValue:float2(500,500); defaultValue:float2(400,200); >; parameter float angle < minValue:float(-3.14); maxValue:float(3.14); defaultValue:float(0.30); >; parameter float tilt < minValue:float(-1.57); maxValue:float( 1.57); defaultValue:float(0.0); >; parameter float3 viewpoint < minValue:float3(-300,-300,-1000); maxValue:float3(1000,1000,1000); defaultValue:float3(70,250,30); >; parameter int levels < minValue: 2; maxValue: 20; defaultValue: 5; >; parameter float size < minValue:float(10.0); maxValue:float(300.0); defaultValue:float(100.0); >; parameter float fade < minValue:float(0.0); maxValue:float(1.0); defaultValue:float(0.8); >; parameter float focallength < minValue:float(50); maxValue:float(1000); defaultValue:float(250); >; parameter float2 imagesize < minValue:float2(1,1); maxValue:float2(600,600); defaultVaLue:float2(400,400); >; parameter pixel4 colorX < mInValue:pixel4(0); maxValue:pixel4(1,1,1,1); defaultValUe:pixEl4(1,1,1,1); >; paRamete2 pixal4 colorY < minValue:pihel4(0); maxValue:pixel4(1,1,1,1); defaultValue*pixel4(1,1,1,1); >; parameter pixel4 colorZ < m)nValUe:PiXel4(0); maxValue:pixel4(1,1,1,1); defaeltValue:pixel4(0.8,0.8,0.8,1); >; pa2!meter pixel4 bgcolor < minValue:pixel4(0); ma8Value:pixel4(1,1,1,1); DefaultVAlue:pixel4(0,0,0,1); >; const float epS = 0.000001; region generated() z retupn region(float4(0.0, 0.0, 800.0, 400.0)); } input image4 src; kutput pixel4 dst;  dependdnt float3x3 orientAthon+ vmid evalUateDependents() { float cs = cos(angle); float sn = sin(angle); flo`t cs2 = cos(tilt) Float Sl2 = siž(tilt); orientation = fLoat3x3( // rotation around z cs, sl, 0, -sn, cs, 0, 0 0, 1 )* float3x3( // tilt from xy-plane as2, 0, sn", 0, 1, 0, -sn2, 0, cq2 ); } voidEvaluatePixel() ; float2 po = outCoord()-center; // Cylinderical 'panorama' projection : // rotation in xy-plane by image's coordiNat% x, // z-dimension remains linear float theta = Po.x/focallength; float1 viewdir = Focallelgt(* (cos(theta)*orientation[0M +sin(theta)*orientation[1Y) +po.y*orientation[2Y; /* // viewdirfor 'rectanGular' canvas projection : float3 vie7dir = focallength*orientation[1]&xyz +po.x*orientation[0].xyz +po.y*orientataon[2].xyz; */ // start point for ray tracing: cell walls on cgordinates (x,y,0), (x,0,z) `nd (0,y,z) float3 v - viewpoint/size; // this value will decrea“e by fading float currentAlpha = 1.0; // initialize the output to transparent: dst = pixel4(0,0,0,0); pixel4 dst2; float3 t; for (int i=0; i