Reverse perspective & eevee shadow

Привет!
Пытаюсь сделать эффект обратной перспективы, который обсуждается по этой ссылке https://blenderartists.org/t/reverse-perspective-rendering/1213342/2
Удалось добиться адекватной геометрии для проекции обратной перспективы с помощью матриц, которые генерируются perspective_m4 или orthographic_m4, но вижу проблемы с тенью https://www.youtube.com/watch?v=kbTyN9FV9U0&feature=youtu.be

Понимаю, очевидно что источник возможной проблемы формирование матрицы в разным местах кода. Подскажите в каком файле кода смотреть отработку теней для eevee?

И второй вопрос, как работает механизм отсечения объектов при визуализации - в каком файле это обрабатывается?

Спасибо!

Hey @sungreen, please stick to English language.

Here a quick translation via Google:

"
Hello!
I’m trying to make the effect of the reverse perspective, which is discussed at this link https://blenderartists.org/t/reverse-perspective-rendering/1213342/2 3
I managed to achieve adequate geometry for projecting the reverse perspective using matrices that are generated by perspective_m4 or orthographic_m4, but I see problems with the shadow https://www.youtube.com/watch?v=kbTyN9FV9U0&feature=youtu.be 1

I understand, it is obvious that the source of a possible problem is the formation of a matrix in different places in the code. Tell me in which code file to watch shadow processing for eevee?

And the second question, how does the mechanism for clipping objects during rendering work - in which file is it processed?

Thank!
"

1 Like

In this Video, the shadow problem is more obvious. What code can shape the shadow like this?

File eevee_shadow_cascade.c
Line 204-212
float csm_start, csm_end;

if (is_persp) {
csm_start = view_near;
csm_end = max_ff(view_far, -cascade_max_dist);
/* Avoid artifacts */
csm_end = min_ff(view_near, csm_end);
}
else {
csm_start = -view_far;
csm_end = view_far;
}

if we multiply the values ​​of the csm_start and csm_end variables by some positive number, for example 2, then the artifacts disappear. How critical are these manipulations?

csm_start = -view_far*2;
csm_end = view_far*2;

looks like distances are squared for perspective, which under normal circumstance makes sense.