views:

47

answers:

2

Hello,

I want to make a 3d scene that loops around on its self. That is to say, if you keep going in any direction, you will loop back to the other side.

My current implementation is so bad, it's embarrassing to admit to it. I redraw the each change twenty-seven times, to make a 3x3x3 scene cube. When the user reaches the end of the middle cube, I jump them over to the other side. Maintaining consistency (let alone performance) is a nightmare. Total Disaster.

This doesn't seem like it would be an unusual request, so I'm wondering if anyone knows of a more legit solution.

Thanks!

EDIT/NOTE: There is no render-to-texture functionality available in Java3d.

A: 

Without any knowledge of your specific scene and what sort of objects you are rendering, the 27 cubes sounds like the "correct but not optimal" way of doing it.

However, if you cant think of anything else, you can at least perform frustum culling on your camera first, which means finding out which of the 27 cubes are currently inside the cameras field of view.

Then you never have to draw more than 6 of these cubes, plus the current cube you are in. Even less if you have a narrow field of view.

That is assuming that you can only see a maximum of 1 cube into the distance... Otherwise you will have to do rendering to texture.

Mikepote
A: 

I can think of another option, but it's not very pretty.

You could keep the user anchored at the origin of your universe. Therefore, instead of moving them, move everything else in the universe in the opposite direction. Anything that crosses the boundary of the universe would be brought back in on the opposite side.

Incredulous Monk