helmut.bressler Posted April 29, 2020 Posted April 29, 2020 Dear Unigine Team, during our investigations regarding the Water screen space reflections (as described here ) we encountered a tiny problem with render_border command. We are "modifying" the projection matrix a bit (by adding a translation in Y) and that translation gets lost when I invoke the render_border console command. That behaviour is not totally new to me, in the past, when we were using the app border plugin, we had the same issue, but it was easy to fix in the source code. In AppBorder.cpp in void AppBorder::render_window() instead of if (projection.m32 == 0.0f) projection = ortho(-x, x, -y, y, znear, zfar); else projection = frustum(-x, x, -y, y, znear, zfar); camera->setProjection(projection); // render textures viewport->renderTexture2D(camera, texture); we have been using if (projection.m32 == 0.0f) projection = ortho(-x, x, -y, y, znear, zfar); else projection = frustum(-x, x, -y, y, znear, zfar); camera->setProjection(translate(0, pmY, 0) * projection); // render textures viewport->renderTexture2D(camera, texture); I wonder if that is also the issue with the render_border command and if there is a simple fix to that. Thanks Helmut
silent Posted April 29, 2020 Posted April 29, 2020 Hi Helmut, There are two options: Resurrect ancient AppBorder plugin and modify it (so it will compile and link with current engine); Wait until we implement this behavior (saving translation inside the engine for current camera) Btw, which SDK you are currently using for this project? Do you plan to upgrade to 2.11? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
helmut.bressler Posted April 29, 2020 Author Posted April 29, 2020 Hello Silent, thanks for the quick reply - at the moment we are using 2.10. But we plan to move to 2.11 soon (mainly because we want to make use of the updated solution for colorbanding in the sky). Great that you are considering to add this feature - I could imagine that it is also usefull for other applications. Cheers Helmut
andrey-kozlov Posted April 30, 2020 Posted April 30, 2020 Hello Helmut, Could you elaborate what's the meaning of that translation after projection operation in context of your application? And what are usual values of pmY?
helmut.bressler Posted April 30, 2020 Author Posted April 30, 2020 Hello Andrey, i think the problem I'm describing also exists in photography. It is basically about vertical line distortion. In order to demonstrate that what we want to solve, I use an 80 degree FOV in the following images. Lets take the following scene, where I have about 50% sky and 50% water. Now I want to change the camera so that I have only about 25% water. In order to do so I need to rotate the camera so that it points a bit up into the sky. Now I get a distorted cylinder: However, if I change the projection I can have both - 25% water and an undistorted cylinder: The last image shows the main camera in the background, which has a 50% water and 50% sky. The foreground window runs the attached Pmy C# component. Thank you for looking at this, Andrey Pmy.cs
silent Posted May 8, 2020 Posted May 8, 2020 We can send you patched engine version for tests. Do you need Sim or Engineering edition? How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
helmut.bressler Posted May 13, 2020 Author Posted May 13, 2020 Hello Silent, sorry for the late reply, thank you very much, thats a great news! We are using the engineering edition (actually we are still on 2.10. but I think upgrading should be straight forward and I will do that in the next couple of days). Many thanks Helmut
Recommended Posts