retrocube icon indicating copy to clipboard operation
retrocube copied to clipboard

lag with perspective and larger cube sizes

Open quantenzitrone opened this issue 2 years ago β€’ 8 comments

Since I updated retrocube last the command

cube -wi 200 -de 200 -he 200 -sx 0.99 -sy 0.90 -up

doesn't work properly anymore on commit 76a13dc378c1dd611819e504d9ba6d00f9649754:

https://github.com/leonmavr/retrocube/assets/74491719/ac12edc5-e01d-4dc3-bed2-8832372d38bf

on current HEAD (95bf2f54ff98813921d34723afb3f467dc912ad3):

https://github.com/leonmavr/retrocube/assets/74491719/d472f986-8d85-49bd-8d24-008d7727ddec

The cube offset in the videos is just because I recorded my terminal window on the left with obs and somehow obs still recorded in 1920x1080

i also tried to record with asciinema, but it didn't work well

quantenzitrone avatar Sep 13 '23 14:09 quantenzitrone

It seems like -up in combination with a large cube like -wi 200 -de 200 -he 200 results in the lag. The drift seems to happen even with no arguments.

quantenzitrone avatar Sep 13 '23 14:09 quantenzitrone

Hey @Quantenzitrone,

It's true that the arguments -wi 200 -de 200 -he 200 make it slower. That's because -up activates the perspective transform and combined with large dimensions this makes it map more pixels from 3D to 2D.

For the drift, it happens because I now bounce the cube around the screen to show off that it can move as you can see below: https://github.com/leonmavr/retrocube/blob/master/main.c#L44 So I should update the README to show it.

I now have some more demos in the demo folder: https://github.com/leonmavr/retrocube/tree/master/demos

I haven't worked on this project in summer because I was busy with real life but I'll get back to it in about a week. I'll fix demo 6 and then I'm planning to use path tracing instead of ray tracing to reduce the lag (hopefully!).

leonmavr avatar Sep 18 '23 17:09 leonmavr

So is there currently a way to turn off the bouncing?

quantenzitrone avatar Sep 18 '23 17:09 quantenzitrone

No, it's hardcoded at the latest main. You think I should add a toggle or something?

leonmavr avatar Sep 18 '23 17:09 leonmavr

yes

quantenzitrone avatar Sep 18 '23 17:09 quantenzitrone

The latest master now includes a toggle to enable drift (-b N, where N is non-zero number of frames) and some options to define the motion. Drift is off my default. I also updated the README.

leonmavr avatar Sep 23 '23 12:09 leonmavr

beautiful, thank you the new implementation of perspective still lags very much for larger cube sizes, so i'll keep this open

quantenzitrone avatar Sep 23 '23 12:09 quantenzitrone

Yeah, we can keep it open till I implement the new algorithm

leonmavr avatar Sep 23 '23 12:09 leonmavr