Visual portals to simulate a seamlessly looping area

MirceaKitsuneMirceaKitsune Posts: 43Member
edited May 24 in 3D

I'm trying to simulate a world that creates the illusion of looping seamlessly in the horizontal direction. As far as moving objects go this should be easy: If the world is 100 units large, objects reaching position X = 100 will be teleported to X = 0, same for Z and vice versa. But I don't know what the best approach would be for the visual part.

I'm assuming I'll need to box the scene in between 4 planes, all perfectly aligned and facing inward: -X, +X, -Z, +Z. But how do make it so for instance, the -X plane renders a portal from the +X plane, and does so with the proper proportions to create the illusion of seeing from that position and angle? Is there a shader or render-to-texture script that could help out with this?

Answers

  • MegalomaniakMegalomaniak Posts: 2,645Admin
    edited May 24

    Make the world in at least two tiles(instanced scenes) that can be spawned and despawned.

    In your example they can probably remain loaded in all the time and this is probably what you want(if you go with just 2 that is), but the basic idea is the same for a large open world type games. I think you already have the basic idea, you just shift the tiles order 1, 2, 1, 2, 1, 2...

  • MirceaKitsuneMirceaKitsune Posts: 43Member

    I tried various mirror methods, none really worked. I'm going to go with spawning 8 copies of the seamless terrain (4 on each side + 4 in each corner). Only issue I see with this method is that, if entities are in the area, the player is going to see them suddenly appear / disappear as they transition from one edge to the other.

    To avoid that: Is there a method to copy and offset an entity in 8 directions by a predefined amount? Since I need terrain LOD to work across seams I want to copy the terrain node entirely... for other entities I'd only need visual copies with no other functionality, namely no scripts attached to the copies even if the original node has one. This is a better description of how I'm planning to map and use the duplicates:

    https://godotforums.org/discussion/comment/38533/#Comment_38533

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file