Pro camera library

Hello, I have been a photographer for more than 2 years. I got tired of trying to figure out camera frustum settings, so I created my own library for setting the camera with actual camera sensor sizes and lenses.

These two topics got me started:

I have created a demo, originally to show off to my class, but why not showcase it on the forum as well!

Here are some screenshots:

To create a lens you use:

LensDef lens = new LensDef("Canon EF 24-70mm f/2.8L USM")
            .setCanAutoFocus(true)
            .setFstop(2.8f, 22f)
            .setMaximumFocal(70f)
            .setMinimumFocal(24f)
            .setNearestFocus(0.38f)
            .usableWith(Sensor.FULLFRAME, Sensor.CANON_APS_C);

and to initialize the appstate you call: (an example)

CameraAppState camState = new CameraAppState(Sensor.FULLFRAME, lens.create ());

If you don’t want the depth of field filter you can call:

camState.setDofEnabled(false);

and no filter code will be called on initialization

You can download the program and source from this folder:
EDIT: now on github

Please tell me what you think!

15 Likes

Pretty cool.
I don’t know a thing about photography but that looks nice :wink:
Maybe you could setup your sources as a github repo?

Great! That’s exactly the spirit of indies and geeks and nerds! Can’t be crazy enough to be cool! :chimpanzee_closedlaugh: I love this. :+1:

This is great! I’m going to show this to someone who has been into photography for decades (as well as a programmer for decades). Going to see if this will be useful for my project, thanks!

It would be nice, as @nehon said to get it up on github or something similar.

I will do that once I finish documenting the library to make it easier for others to use

Hum. I tried to implement this library and I did everything above. My scene became invisible. I’m using the same town model. I don’t know what am I doing wrong.

But I noticed something: in the example above, when you initialize the CameraAppState, you give the lens object to the constructor. However, I can only add a Lens object, not a LensDef object. So, I simply created a Lens object and in the construtor I put the lensDef object. Is this the problem?

I forgot to add that you call create () on the LensDef.
You may also want to turn on auto focus on the lens object, otherwise I can’t tell what you are doing wrong. Take a look at the source for the demo to see how I did it.

I did what you said, but still doesn’t work. I have the setCanAutoFocus method to true. So, I decided to download the demo source, but for some reason it’s in .tmp extension and it doesn’t have size! I guess it’s a problem from Google Drive?

…I just tied downloading it and I had the same issue, I think it’s to do with 7zip and drive. I can’t test the code but I have uploaded the source I am working on right now for you along with the current library source

Thanks for the help! Let me tell you, your work is amazing! Don’t let this project die like SkyControl!

Don’t worry, I will be using this library for a long time so I most definitely won’t.
I will upload to the github repository I created once I get home and am able to test the source!

EDIT: I will post the github repository in a new thread if that is ok, along with better explanations on how to use

2 Likes

I’ve been using my “physical camera” system for a long time now, you can see some of its interface briefly in this video: https://youtu.be/obnTpQ8JtZk?t=3m26s .

I’ve never released the source but am happy to try and help out if you have any questions regarding more advanced / realistic camera systems =)

2 Likes

Thanks for offering to help! Right now I have been working on creating a version of CameraNode that implements my library and also detects collisions with the scene.

Right now I have bounding sphere around the camera with a specified radius and have written the code for sensing collisions, but I need to figure out how to reposition the camera when it collides, do you think you could help?

The specific source files are PCameraControl and PCameraNode
Where I sense collisions is in the updatePosition() method of the control

Btw, that game looks amazing! Is that jme or a different engine?
I do understand what some of the camera values in your interface might do, I use a depth of field filter that has similar variables (I didn’t write the shader however, I only modified it for use in jme)