|
|
Yet another ugly test image of a not so usefull camera.
Most cube map renderes don't support this format, it was mostly an
excercise in moving segments of a scene to certain positions in the
image. Gets messy quickly with all the selects,
ingo
---%<------%<------%<---
#version 3.8;
global_settings {assumed_gamma 1}
#macro CubeCamCross(Loc)
/*==
Renders cross shaped image for cube map.
Image aspect ratio 4:3
//+w800 +h600 +a0.1 +am3 +ua
Loc: location of the camera.
*/
#local Map05 = function(x,y,z){((x-y)/(z-y))-0.5};
#local CadreX = function(u,v){
select(//+Y
(v>1/6 & u>-0.25 & u<0),
0,
select(
(v<1/6 & v>-1/6),
0,
select(//-Y
(v<1/6 & u>-0.25 & u<0),
0,
0,
Map05(u,0,-0.25) //-Y true
),
select(//-X
(u<-0.25),
0,
select(//-Z
(u>-0.25 & u<0),
0,
select(//+X
(u>0 & u<0.25),
0,
select(//+Z
(u>0.25),
0,
0,
Map05(u,0.25,0.5)//+Z true
),
-0.5//-X true
),
Map05(u,0,-0.25)//-Z true
),
0.5//+X true
)
),
Map05(u,0,-0.25)//+Ytrue
)
};
#local CadreY = function(u,v){
select(//+Y
(v>1/6 & u>-0.25 & u<0),
0,
select(
(v<1/6 & v>-1/6),
0,
select(//-Y
(v<1/6 & u>-0.25 & u<0),
0,
0,
-0.5//-Y true
),
select(//-X
(u<-0.25),
0,
select(//-Z
(u>-0.25 & u<0),
0,
select(//+X
(u>0 & u<0.25),
0,
select(//+Z
(u>0.25),
0,
0,
Map05(v,-1/6,1/6)//+Z true
),
Map05(v,-1/6,1/6)//+X true
),
Map05(v,-1/6,1/6)//-Z true
),
Map05(v,-1/6,1/6)//-X true
)
),
0.5//+Y true
)
};
#local CadreZ = function(u,v){
select(//+Y
(v>1/6 & u>-0.25 & u<0),
0,
select(
(v<1/6 & v>-1/6),
0,
select(//-Y
(v<1/6 & u>-0.25 & u<0),
0,
0,
Map05(v,-1/6,-0.5)//-Y true
),
select(//-X
(u<-0.25),
0,
select(//-Z
(u>-0.25 & u<0),
0,
select(//+X
(u>0 & u<0.25),
0,
select(//+Z
(u>0.25),
0,
0,
0.5//+Z true
),
Map05(u,0,0.25)//-X true
),
-0.5//-Z true
),
Map05(u,-0.25,-0.5) //+X true
)
),
Map05(v,1/6,0.5)//+Ytrue
)
};
camera{
user_defined
location Loc
direction {
function{CadreX(u,v)}
function{CadreY(u,v)}
function{CadreZ(u,v)}
}
}
#end
CubeCamCross(<0,0,0>)
background{rgb 1}
light_source {<0,0,0> rgb 1}
sphere{< 2,0 ,0>,0.5 pigment{rgb x}} //X:<1,v,u> +X
sphere{<-2,0 ,0>,0.5 pigment{rgb x+z}}
sphere{< 0, 2,0>,0.5 pigment{rgb y}} //Y:<u,1,v>
sphere{< 0,-2,0>,0.5 pigment{rgb y+z}}
sphere{<0,0 , 2>,0.5 pigment{rgb z}} //Z:<u,v,1> +Z
sphere{<0,0 ,-2>,0.5 pigment{rgb x+y}} // -Z
#declare Radius = 2;
#for(I,1,18,1)
torus{1,0.04 sturm rotate<90,0,0> rotate<0,I*10,0> pigment{rgb I/36} }
#end
box{-0.3,0.3 translate < 1,-1, 1> pigment{rgb x}}
box{-0.3,0.3 translate <-1,-1, 1> pigment{rgb y}}
box{-0.3,0.3 translate < 1,-1,-1> pigment{rgb z}}
box{-0.3,0.3 translate <-1,-1,-1> pigment{rgb .5}}
box{-0.3,0.3 translate < 1, 1, 1> pigment{rgb x+y}}
box{-0.3,0.3 translate <-1, 1, 1> pigment{rgb x+z}}
box{-0.3,0.3 translate < 1, 1,-1> pigment{rgb y+z}}
box{-0.3,0.3 translate <-1, 1,-1> pigment{rgb 1}}
Post a reply to this message
Attachments:
Download 'cube_camx.jpg' (39 KB)
Preview of image 'cube_camx.jpg'
|
|