Camera Position - From, To and UpVector

Hallo

Thank you for the feedback re linker errors. I managed to resolve the issue.

I have two more issues outstanding and then I should be able to render something.

1) I only have a camera FROM, TO (target) and UP vector.

How do I calculate the camera transformation using the makeTransform function (it uses rotx,roty,rotz,scale and an offset). I am very confused as to how to achieve this.

2) All my objects are basically white. I am setting the diffuse colour based on our mesh material diffuse colour.

BRDFVRayMtl brdf = options.vray()->newPlugin<BRDFVRayMtl>();
MtlSingleBRDF material = options.vray()->newPlugin<MtlSingleBRDF>();
IColour diffuse = IColour(pMat->DiffuseColor);

brdf.set_diffuse(diffuse);
brdf.set_reflect(diffuse /*AColor(0.8, 0.8, 0.8, 1.0) */);
brdf.set_opacity(diffuse.getAlpha() / 255.0);
brdf.set_fresnel(true);
material.set_brdf(brdf);

I do create a rectLight behind the camera pos (as per your examples).

Anton

Hello Anton,

For setting up the camera transformation in question 1, please try the following function:


Transform lookAtYUp(const Vector& eye, const Vector& center, const Vector& up) {
    Vector viewDir = center - eye;
    viewDir.makeNormalized();
    Vector side = viewDir ^ up;
    side.makeNormalized();
    Vector camUp = side ^ viewDir;

    Matrix mat = Matrix(side, camUp, -viewDir);
    return Transform(mat, eye);
}

In your case, this would be used like so:


Transform camTransform = lookAtYUp(FROM, TO, UP);

Hope this helps,
Martin

Martin

Thank you very much! I was almost there, but the main issue was that I was adding geometry using GeomStaticMesh, and unless I added a transform to the node, it was basically not in the scene - how strange. I had to add :- node.set_transform(makeTransform(0.0,0.0,0.0));

Issue with materials was my issue - I was using the incorrect diffuse parameter.

Anton