MatPreview not matching camera view [SOLVED]
-
On 08/07/2015 at 10:43, xxxxxxxx wrote:
Hello,
using your code and resource files the dimensions of the bitmap are 288 x 288 pixel. Exactly as defined in the resource file. Where do you change the resolution to 256 x 256?
best wishes,
Sebastian -
On 08/07/2015 at 11:05, xxxxxxxx wrote:
sorry I meant 288 x 288, the size should be 288 x 288 "or whatever is written in the resource file" , I mistyped 256 x 256 in the previous reply, but the problem remains the same, it uses wrong dimensions "or possibly wrong aspect ratio?"
-
On 13/07/2015 at 19:15, xxxxxxxx wrote:
any solution for this? I see the camera frustum is somehow affected by the current document image size
-
On 14/07/2015 at 00:29, xxxxxxxx wrote:
Hello,
as I said, I cannot reproduce any problems using the code you posted. Maybe it is related to the code of your renderer video post.
Best wishes,
Sebastian -
On 14/07/2015 at 04:37, xxxxxxxx wrote:
here is the problem:
RayCamera *RCam = vps->vd->GetRayCamera(); CameraObject* mCam = static_cast<CameraObject*>(RCam->link); GeData fov_h; mCam->GetParameter(DescID(CAMERAOBJECT_FOV), fov_h, (DTYPE_REAL, DESCFLAGS_GET_0)); GeData fov_v; mCam->GetParameter(DescID(CAMERAOBJECT_FOV_VERTICAL), fov_v, (DTYPE_REAL, DESCFLAGS_GET_0)); float fov = (fov_v.GetFloat() < fov_h.GetFloat())? fov_v.GetFloat() : fov_h.GetFloat();
this code gets the wrong fov, I consider this a bug, you may confirm or tell me how to fix, here is what happens:
1- open any material preview scene "for example Sphere(GI).c4d"
2- the scene by default is set to width = 90, height = 90, camera focal length = 190, sensor size = 36
and fov_h = fov_v = 10.824 ° = 0.18891f
3- if I render from MatPreview, with my scene standard settings (width = 800, height = 600) "the document which contains the material", I read this:
fov_h = 10.824 ° = 0.18891f
fov_v = 8.128 ° = 0.14186f // how is this<<<<<-------- it SHOULD be affected by MatPreview width and height which are printed = 288, 288hope this clarifies where the problem is, the MatPreview camera fov somehow affected by the current document NOT the MatPreview document.
-
On 14/07/2015 at 10:07, xxxxxxxx wrote:
Hello,
why do you include "DTYPE_REAL" in your call of GetParameter()? I cannot see how this makes any sense.
Best wishes,
Sebastian -
On 14/07/2015 at 10:53, xxxxxxxx wrote:
I copy pasted it from somewhere when I was searching, but this doesn't change any result after removing "DTYPE_REAL"
-
On 15/07/2015 at 08:27, xxxxxxxx wrote:
Hello,
as commented in the header file, both CAMERAOBJECT_FOV and CAMERAOBJECT_FOV_VERTICAL are "virtual" parameters that are not stored in the camera's base container (and thus should not be used this way).
In the case of CAMERAOBJECT_FOV_VERTICAL it indeed accesses the active object. It seems this parameter is only used in certain internal cases. So you have to calculate this value on your own using the current film aspect and CAMERAOBJECT_APERTURE.
Best wishes,
Sebastian -
On 15/07/2015 at 09:31, xxxxxxxx wrote:
so I consider this a "bad behavior" which is not anticipated.
thanks Sebastian for clarification, I will handle it. -
On 19/07/2015 at 00:24, xxxxxxxx wrote:
here is what I did, works fine, but I need to confirm that it is safe "I'm using BaseVideoPost node's document"
BaseContainer bcRender = node->GetDocument()->GetActiveRenderData()->GetData(); float w; float h; w = bcRender.GetFloat(RDATA_XRES); h = bcRender.GetFloat(RDATA_YRES); float fov_h = 2.f * atanf((ap) / (2.f * focus)); float fov_v = 2.f * atanf((ap / (w / h)) / (2.f * focus)); float fov = (fov_v < fov_h)? fov_v : fov_h;
-
On 20/07/2015 at 01:39, xxxxxxxx wrote:
Hello,
RenderDocument() has a parameter for the used render settings. These render settings can be accessed with Render::GetRenderData(), so if you want to get the resolution you should use:
BaseContainer rdata = vps->render->GetRenderData();
best wishes,
Sebastian -
On 20/07/2015 at 02:31, xxxxxxxx wrote:
true, but...
the SDK got a bug at this point, let me explain where the problem occurs:
1- let's consider I used the old approach "CAMERAOBJECT_FOV_VERTICAL and CAMERAOBJECT_FOV" as you mentioned, these are virtual,
so they fail in MatPreview "as they use the current Document camera, NOT the MatPreview Document camera"2- I already tested vps->render->GetRenderData(), works fine in MatPreview and picture viewer
but it fails in viewport "guess what? camera horizontal and vertical FOV are represented by the virtual descriptions!!!
which doesn't match Document dimensions" for example: Document image = 1280 x 720, viewport image = 1100 x 500,
camera got FOV calculated from the 1280 x 720 image "not the correct width, height values" -
On 20/07/2015 at 11:04, xxxxxxxx wrote:
Hello,
you could check the renderflags if RENDERFLAGS_EXTERNAL is set and react accordingly.
Best wishes,
Sebastian -
On 20/07/2015 at 11:06, xxxxxxxx wrote:
this looks great!!. so RENDERFLAGS_EXTERNAL means non viewport render?
-
On 20/07/2015 at 14:15, xxxxxxxx wrote:
Originally posted by xxxxxxxx
this looks great!!. so RENDERFLAGS_EXTERNAL means non viewport render?
Yes!
-
On 23/07/2015 at 19:29, xxxxxxxx wrote:
thanks Sebastian and Robert
you can consider this solved.