Posted: Wed Oct 24, 2007 9:35 pm
Added a ' General procedure for setting the camera settings' section.
3/1/10 for reinhard is cool on all my three CRT's (but violets reinhard settings are way brighter using this values ).Whaat wrote:What's a good default pre-scale value?
Code: Select all
We have
N = f / d
where
N = f-number, f = focal length, d = aperture diameter.
Therefore
r = f / (N*2)
where
r = aperture radius.
Code: Select all
f-stop = 4
sensor_width = 0.035
sensor_distance = sensor_width / (2*tan(cameraFOV/2))
aperture_radius = sensor_distance / ( f-stop * 2)
Code: Select all
$x = `getAttr locator1.rx`;
$y = `getAttr locator1.ry`;
$z = `getAttr locator1.rz`;
float $xCos = cos (deg_to_rad($x));
float $xCo_ = -1 * `cos (deg_to_rad($x))`;
float $xSin = `sin (deg_to_rad($x))`;
float $xSi_ = -1 * `sin (deg_to_rad($x))`;
float $yCos = `cos (deg_to_rad($y))`;
float $yCo_ = -1 * `cos (deg_to_rad($y))`;
float $ySin = `sin (deg_to_rad($y))`;
float $ySi_ = -1 * `sin (deg_to_rad($y))`;
float $zCos = `cos (deg_to_rad($y))`;
float $zCo_ = -1 * `cos (deg_to_rad($y))`;
float $zSin = `sin (deg_to_rad($y))`;
float $zSi_ = -1 * `sin (deg_to_rad($y))`;
matrix $mx[3][3] = << 1 , 0 , 0 ;
0 , $xCos, $xSi_;
0 , $xSin, $xCos>>;
matrix $my[3][3] = << $yCos , 0 , $ySin ;
0 , 1, 0 ;
$yCo_ , 0, $yCos>>;
matrix $mz[3][3] = << $zCos , $zSi_ , 0 ;
$zSin , $zCos, 0;
0 , 0, 1>>;
matrix $mAll[3][3] = $mx * $my * $mz;
print "\nrotation Matrix:";
print $mAll;
Code: Select all
float $xCos = cos (deg_to_rad($rix));
float $xCo_ = -1 * `cos (deg_to_rad($rix))`;
float $xSin = `sin (deg_to_rad($rix))`;
float $xSi_ = -1 * `sin (deg_to_rad($rix))`;
float $yCos = `cos (deg_to_rad($riy))`;
float $yCo_ = -1 * `cos (deg_to_rad($riy))`;
float $ySin = `sin (deg_to_rad($riy))`;
float $ySi_ = -1 * `sin (deg_to_rad($riy))`;
float $zCos = `cos (deg_to_rad($riz))`;
float $zCo_ = -1 * `cos (deg_to_rad($riz))`;
float $zSin = `sin (deg_to_rad($riz))`;
float $zSi_ = -1 * `sin (deg_to_rad($riz))`;
matrix $R0[3][3] = << $zCos , $zSi_ , 0 ;
$zSin , $zCos, 0;
0 , 0, 1>>;
matrix $Rx[3][3] = << 1 , 0 , 0 ;
0 , $xCos, $xSi_;
0 , $xSin, $xCos>>;
matrix $R1[3][3] = << $yCos , $ySi_ , 0 ;
$ySin , $yCos, 0;
0 , 0, 1>>;
matrix $Rresult[3][3] = $R1 * $Rx;
matrix $Rresult[3][3] = $Rresult * $R0;
print $Rresult;
matrix $RtoY [3][3] = <<1, 0, 0;
0, 0, -1;
0, 1, 0>>;
if ($upAxis == "y")
{
$Rresult = $Rresult * $RtoY;
}
Yeah, it's EZ with SketchUp API.suvakas wrote:Why are you doing this manually?
Can't you get a nice rotation/transform matrix out of Maya?
Code: Select all
trans=entity.transformation
Code: Select all
-1 -1
matrix = SP * S * SH * SP * ST * RP * RA * R * RP * RT * T
Code: Select all
RX = | 1 0 0 0 | RY = | cy 0 -sy 0 |
| 0 cx sx 0 | | 0 1 0 0 |
| 0 -sx cx 0 | | sy 0 cy 0 |
| 0 0 0 1 | | 0 0 0 1 |
RZ = | cz sz 0 0 | sx = sin(rx), cx = cos(rx)
| -sz cz 0 0 | sy = sin(ry), cx = cos(ry)
| 0 0 1 0 | sz = sin(rz), cz = cos(rz)
| 0 0 0 1 |