hyperlogic / splatapult

A 3d gaussian splatting renderer in C++ and OpenGL
MIT License
89 stars 12 forks source link

How to change the height of the camera? #5

Closed oUp2Uo closed 6 months ago

oUp2Uo commented 6 months ago

Thanks for the great work. My computer does not have enough spec to run the SIBR viewer with CUDA, but could run this viewer.

I have two questions:

  1. How to change the height of the camera? WASD for moving, UpLeftDownRight for rotating, QE for rolling. But it seems that we could not control the height position now.
  2. Is it possible to add a new mode, like camera rotating around a point (e.g. (0,0,0), or can be setting), to see the main object just like bullet time?

Thank you.

hyperlogic commented 6 months ago

I added up and down movement with the T and G keys.

I'm not sure what the best approach would be to add this orbit feature. You can sort of achieve orbiting by "circle strafing" using mouse look. I'm open to ideas, though. I hesitate to add configuration or "modes" or additional UI to the app. So, not sure how to add this.

hyperlogic commented 6 months ago

Added in commit 28b0b9d You can download a new executable here

oUp2Uo commented 6 months ago

Hi, thanks for the quick response. I have tested T and G keys, and it works.

I tried to add a mode for bullet time (just like -v for VR mode). Then just edit Process, https://github.com/hyperlogic/splatapult/blob/main/src/app.cpp#L797 add a mode to setting camera matix directly instead of calling flyCam->Process, which value just like LearnOpenGL site provided: https://learnopengl.com/Getting-started/Camera

const float radius = 10.0f;
float camX = sin(glfwGetTime()) * radius;
float camZ = cos(glfwGetTime()) * radius;
glm::mat4 view;
view = glm::lookAt(glm::vec3(camX, 0.0, camZ), glm::vec3(0.0, 0.0, 0.0), glm::vec3(0.0, 1.0, 0.0)); 

(Instead of glfwGetTime(), just using SDL ticks or just count a number instead.) before view is set to camera matrix, inverse is needed. I donot know why. And the bullet time should work.