Got Portals within Portals working

Just thought I would show off a picture.
Building portals mainly for a 3d GUI system, portals required for the clipping.
All the scenes rendered in a single render.

Have an interesting effect with infinite regressed portals, may make an interesting space flying race game…
Been at it for days, been hard work but can fly through portals with no problems.

Thought I would show another image. Looks much better with lighting and a bit of shadow.

I’ve now implemented clipping for lighting and shadows for the portals, now lights and shadows can only enter and leave the front of the portals and not to the sides, which if I’m correct is a world first?

Here’s the latest screenshots of my portals implementation.

Producing many portals is hard, having portals within portals is even harder, a portal can be at any place and go to any scene and then back again, each portal has multiple instances, so does each scene and each model.
For every portal you need 2 copies of every scene forward and then back as it’s a view into the complete universe both ways. If you have 10 scenes and 10 portals within portals, that’s 20 scene instances for each portal, 10 going forward and 10 going back. So that’s 200 scene instances in total.

If you have 200 scene instances you may think I’m doing something wrong, no, you can do it with just a single instance but calculating all the portals each frame dramatically reduces the framerate. So you have many instances and only need to update the portals maths when you go through a portal. This speeds up the framerate dramatically.

There’s a lot of pixel discarding going on in the shaders, and lots of culling both to the camera and portals to keep up the framerate.

I’ve fixed the lighting and shadows, working well now, seamless!

Not bad for 2 months work. :slight_smile:

Engine is a deferred renderer, has multiple lighting, multiple shadows, normal and parallax mapping.

With my NVidia GTX 1050 graphics card it’s real fast! As you can see it’s probably the most complicated and advanced portals yet, and I believe a worlds first for light and shadows entering and leaving the portals.

If your wondering what the smiley faces are about? It’s the beginning of what will be 3D buttons for a 3D window GUI system for both applications and games.