Camera creation - aperture value ended up in vertical resolution in Houdini import

40 переглядів
Перейти до першого непрочитаного повідомлення

Nicholas Yue

не прочитано,
6 вер. 2020 р., 17:28:0106.09.20
Кому: alembic-discussion
Hi,

  I am attempting to create an Alembic camera from a set of JSON values I am reading in.

  However, when I set the FOV in the Alembic camera, it ended up as both values in the FOV view and also the vertical resolution of the Houdini camera. Here is my code.

void write_simple_camera(const std::string& i_abc_filename)
{
// Create an OArchive.
// Like std::iostreams, we have a completely separate-but-parallel class
// hierarchy for output and for input (OArchive, IArchive, and so on). This
// maintains the important abstraction that Alembic is for storage,
// representation, and archival (as opposed to being a dynamic scene
// manipulation framework).
Alembic::Abc::OArchive archive(

// The hard link to the implementation.
Alembic::AbcCoreOgawa::WriteArchive(),

// The file name.
// Because we're an OArchive, this is creating (or clobbering)
// the archive with this filename.
i_abc_filename.c_str() );

Alembic::Abc::OObject topObj( archive, Alembic::Abc::kTop );
Alembic::AbcGeom::OXform xform = addXform(topObj,"gabc");

    Alembic::AbcGeom::OCamera cameraObj( xform, "camera" );
    Alembic::AbcGeom::OCameraSchema &cameraSchema = cameraObj.getSchema();

    /*
{
"fov": 54.43222311461497,
"ratio": 2.386946386946387,
"name": "palmsCam",
"eye": [
-124.02546471925854,
405.62214562283157,
369.1730463283022
],
"focalLength": 34.999999999999986,
"centerOfInterest": 712.3912120407333,
"lensRadius": 0.0031249999999999984,
"up": [
-0.2003759454709524,
0.9725259665269878,
0.11850200381162401
],
"screenwindow": [
-1.0,
1.0,
],
"look": [
472.3129244023174,
571.462848388009,
16.499506125608377
]
}
     */
    Alembic::AbcGeom::CameraSample cameraSample(0.4189453125, -0.4189453125, -1.0, 1.0);
    cameraSample.setFocalLength(35.0);
    cameraSample.setFocusDistance(712.3912120407333);
    cameraSample.setHorizontalAperture(54.43222311461497*0.1);
    // cameraSample.setVerticalAperture(54.43222311461497/2.386946386946387);
    // cameraSample.setLensSqueezeRatio(2.386946386946387);
    double oTop;
    double oBottom;
    double oLeft;
    double oRight;
    cameraSample.getScreenWindow(oTop,oBottom,oLeft,oRight);

    cameraSchema.set(cameraSample);

    std::cout << boost::format("simple camera screenwindow (oTop=%1%,oBottom=%2%,oLeft=%3%,oRight=%4%)") % oTop % oBottom % oLeft % oRight << std::endl;
}

Cheers
Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень