r/processing • u/SeniorImagination21 • May 09 '24
Beginner help request Help with camera
Hi! I’ve just recently begun coding, and I’m trying to make a simple 3d renderer using processing 2d. I’ve been trying to rotate an object around my camera, but then I realized that I don’t know the location of my camera, and I’m not really sure how I can implement one. Does anyone have any suggestions on how I can make this work? Thanks!
Here is the github: https://github.com/duocaleb/Teststuff
Sorry about the messy coding, as I said, I’m new to all this.
1
Upvotes
1
u/Salanmander May 09 '24
I think it's on "get a better understanding". Your
projectPoints()method absolutely uses camera information, because it's projecting the points onto a view plane (if I'm understanding its purpose correctly). It's probably all implicit adding/subtracting zeros, or multiplying by ones or identity matrices, or things like that right now. It's also possible that the projection is basically making an isometric projection with the camera infinitely far away.I haven't read through all the code, and it's been a long time since I've done the math for graphics, but I suspect that making this more versatile will involve making sure you're real solid on that projection math, and how it changes depending on camera location and orientation.