I am making an impossible geometry game using portals to fake the effect (subviewport as a texture).
Then, a shader and some math make the illusion, as in the video. A teleporter is in the middle to switch gate while keeping the same angle / velocity. The shader has culling off.
Problem is, while going at normal speed, there is a flicker caused by the camera, as you can see in the video.
Analyzing frame by frame, while teleporting the camera very briefly stand inside the teleporter, making it display the other side, causing a frame to flicker when finally exiting.
TL;DR
Player walks in World A, camera displays a preview of World B.
Player teleports into World B, but camera briefly shows World A since we swapped world (it shows the preview).
Player exits the teleporter, camera displays World B normally.
How to get rid of that singular frame previewing the world we just exited ?
I tried a few techniques, to make the teleporter a thick cube as seen here (https://youtu.be/cWpFZbjtSQg?si=67kca2XLB9MZ0RjM&t=567). But it persists.
I tried to make some math, but it goes over my head. I know the problem seems to be with the camera itself, but i've not worked with those settings much for my projects.
Here's my current shader logic.
`shader_type spatial;
render_mode blend_mix, cull_disabled, specular_schlick_ggx, unshaded;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
void fragment() {
vec4 albedo_tex = texture(texture_albedo, SCREEN_UV);
ALBEDO = albedo_tex.rgb;
}`
Let me know if you have any questions. Appreciate any help.
Experimenting with portals, for science.
The project is available here: https://github.com/SebLague/Portals/tree/master
If you'd like to get early access to new projects, or simply want to support me in creating more videos, please visit https://www.patreon.com/SebastianLague
Resources I used:
http://tomhulton.blogspot.com/2015/08/portal-rende...