Reverse perspective & culling of objects

I’m trying to make the effect of the reverse perspective, which is discussed at this link.
I managed to achieve adequate geometry for projecting the reverse perspective using matrices that are generated by perspective_m4 or orthographic_m4.
In this video it can be seen that the chess pieces disappear when turning. Where to look for a problem? What code file is the culling of objects?

I think the most important one is where the bounding box is retrieved from the object in drw_call_culling_init and then tested in draw_culling_sphere_test.

But if you search the draw/ module for “boundbox” and “cull” you might find others that need changes too.

1 Like

How can I correctly disable this check to verify the source of the problem?

Thank. A forced culling objects was made. Now the objects do not disappear. But at some point, the object’s shadow disappears. In which code is the shadow culling?

I’m not familiar with this specific code, but look for the word “cull” in draw/engines/eevee? There’s a few occurrences in the files related to shadows and light probes.

One of the problems is that the code does not have an unambiguous definition of is_ortho and is_persp. This is done in many places and many times. In my opinion, it is incorrect to make a conclusion about projection by the phrase mat [3] [3] == 0.0f. This leads to an inadequate result. Better to check is_pesp is not is_ortho, that is, mat [3] [3]! = 1.0f. Such a test would be appropriate for perspective and reverse perspective.

The code below from draw_manage_data.c makes the shadow correct for eevee in reverse perspective. The problem was the wrong definition of near and far.

bool DRW_view_is_persp_get(const DRWView *view)
view = (view) ? view : DST.view_default;
//return view->storage.winmat[3][3] == 0.0f;
return view->storage.winmat[3][3] != 1.0f;

float DRW_view_near_distance_get(const DRWView *view)
view = (view) ? view : DST.view_default;
const float(*projmat)[4] = view->storage.winmat;

if (DRW_view_is_persp_get(view)) {
return -projmat[3][2] / (projmat[2][2] - 1.0f);
else {
return -(projmat[3][2] + 1.0f) / projmat[2][2];

Reverse perspective shadow correct

I turned off the culled check as the sphere does not cover all objects in the camera’s view in reverse perspective and adjusted the definition for is_pers. Here is the test result for animating camera perspective.

Thank you so much for your help!
Огромное спасибо за помочь!

Hello. I need help again. I managed to get a good grasp of the geometry of reverse perspective and even managed to formulate a universal perspective matrix that can be flexibly configured for perspective and orthogonal projections or a projection with reverse perspective.

But I am having trouble dealing with shadows and materials with IOR. Is there any code that uses the projection matrix when rendering IOR materials?

Good day! Could you help me. tell me who can know about who can know about the refraction of light in space for rendering EEVEE? I have a misunderstanding of how this code works for developing a reverse perspective camera render.