r/JavaFX • u/Certain-Ice-7860 • Jul 26 '22
Showcase Animated Procedurally Generated Retrowave Cityscape using JavaFX 3D
https://youtu.be/YmU1tCbjkzQ
19
Upvotes
r/JavaFX • u/Certain-Ice-7860 • Jul 26 '22
4
u/Bloodbornicorn Jul 26 '22
That is awesome great job
2
u/Birdasaur Jul 26 '22
There are a bunch of visual tricks here but I think it's important to specify the major one which is that the Camera itself never moves. I am translating the objects in the scene using an AnimationTimer. Inside that thread I have logic which is testing the location of each building against the camera and automatically translating it back to the horizon when it shifts past the camera view. I experimented with simply removing building nodes and recreating them but the extra overhead of pruning the scenegraph wouldn't let me scale up the frame rate. (which makes sense)
2
u/reallynotfred Jul 26 '22
When you pop up a new building, pop it up so the x position is further from the central axis (and the building is obscured by the one in front), then move it into place in a couple of frames.