## Guide For Exporter Writers

What's a good default pre-scale value? SkIndigo has been using 6.0 for a long time and I am starting to notice that most the of renders uploaded by new SkIndigo users look like the pre-scale is set too high.

I think the reason I set it so high is because my old computer had a really dark monitor and I had to use a higher pre-scale value for the render to look right. Now, when I see renders on my new laptop and my computer at work, they look too bright.

Maybe a value of 4.0 (like Blendigo) is the way to go. It should be a value that will give a good render for a variety of lighting situations.

Does anyone find Blendigo's default value of 4.0 too low? Too high?

Thanx.

I have a camera with 24mm focal lenght, zoom factor 3.2, focal dis 1 and camera f-stop 4.

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)
```

well, we got stuck. I checked the Skindigo tool but couldn't find any reference to rotation code.

As this will eventually concern every exporter that generates instances or that will implement efficient transformation-based animations, can somebody shed some light on this?

Here is the baby-code for generating rotation matrixes, or at least some starting point. I imagine it will be something similar for other programming / script languages.

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;
```

And as a reference, the latest version wich works only for rotations around up axis.
This approach is as follows (Z up):

1° Rotation around Z

2° Rotation aroun X

3° Second rotation around Z

Here I can't define the value for the second rotation around Z, I'm using Y rot value but seems wrong.

Indeed we need help. Thanks.

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;
}
```

1° Rotation around Z

2° Rotation aroun X

3° Second rotation around Z

Here I can't define the value for the second rotation around Z, I'm using Y rot value but seems wrong.

Indeed we need help. Thanks.

obsolete asset

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`

I can't answer your question suvakas, as the code I expose here is from someone's else algorithm and it appeared that afternoon that he hadn't the problem clear in mind so the algorithm is finally not suitable.

I do ignore almost everything about rotation matrices...

Anyhow the "how" is not the point here, we need to know the right composition of the RM and their multiplication order, if I understood enough. Thought you guys had cracked that easily...

That said, suvakas, that was a good question. Inquiring now...

>> Indeed every object has:

- matrix

- world matrix

- parent matrix

and each of these has an inverse matrix also available as output. bkircher, maybe we have been fooled...

I do ignore almost everything about rotation matrices...

Anyhow the "how" is not the point here, we need to know the right composition of the RM and their multiplication order, if I understood enough. Thought you guys had cracked that easily...

That said, suvakas, that was a good question. Inquiring now...

>> Indeed every object has:

- matrix

- world matrix

- parent matrix

and each of these has an inverse matrix also available as output. bkircher, maybe we have been fooled...

obsolete asset

But the Maya Help is great in that respect:

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 |
```

Maya is thinking Y-up to my experience: In a Z-up environment, probably a XYZ rotation order with Y up is part of the problem?

(We can get the world 4x4 matrix, does this help ?)

Any help is appreciated on this issue...

### Who is online

Users browsing this forum: No registered users and 1 guest