Page 1 of 1

How to change the camera's offset in C++

Posted: 24.09.2010, 11:44
by su27
Imagine now the resolution of the screen is 1024x768, and the display content is from (0,0) to (1024,768)

I want to display the content of (-1024,0) to (0,768)

thus I can merge 3 screens together horizontally (simply rotate the camera horizontally is not right)

How to do this? thx :mrgreen:
or where can I modify it in the source code of Celestia.

By the way, I've just put my LAN time synchonize code here, :mrgreen:
http://www.celestiaproject.net/forum/viewtopic.php?f=4&t=16136

Re: How to change the camera's offset in C++

Posted: 24.09.2010, 19:00
by selden
Unfortunately, Celestia is currently limited to exporting images which are the size of the display device.

I'm not at all certain where that code is located. I agree that it would be great if Celestia could render to a buffer that's much larger than the screen size. My understanding is that larger image buffers are supported by OpenGL.

Re: How to change the camera's offset in C++

Posted: 25.09.2010, 02:19
by su27
I've examined it selden

maybe it does not need to be done by render to a large buffer.

It can be done by rotate the camera, and change the "Frustum" parameter.

But it's hard to examine where to change the code. :cry:

Re: How to change the camera's offset in C++

Posted: 27.09.2010, 04:02
by chris
Su27,

How large an image do you want to generate? There are two possible approaches, both of which require modifying the Celestia code:

1. Make Celestia render to an offscreen buffer. The size of the buffer can be larger than your monitor, but it's still limited by hardware capabilities and available graphics memory. This is practical for images as large as about 8000x4000 if you have a recently graphics card with 512M of memory. Celestia would have to be modified to draw into the offscreen buffer. This should just be a matter of creating an OpenGL framebuffer object and setting it as the current render target. The Celestia rendering engine wouldn't need to be changed, so it's probably the easiest option.

2. This is what you are proposing: render multiple views with different frustums, save the image files, and merge them together in Photoshop, GIMP, or some other software. The problem is that this requires asymmetric frusta, but Celestia only supports symmetric frusta. Celestia's rendering engine would have to be modified in a few places. The Frustum class would have to be modified, and some of the culling code changed. I don't think the modifications are too drastic, but if you're not familiar with the code, it's not obvious what needs to change. Adding support for asymmetric projections would have additional benefits, as it would enable stereo and multiwall projections.

So... how big do you need the images to be?

--Chris

Re: How to change the camera's offset in C++

Posted: 27.09.2010, 07:50
by su27
Thank you very much Chris,
I've read your reply and post. My image may not be very large,just 2 times of the screen,such as the resolution of 2560x1024.

My idea is first to use the function
void Frustum::transform(const Mat4f& m)
use a 4x4 matrix to cut the current frustum.

Thus, with certain matrix, the frustum will only be the left part of the original, and it's FOV will only be half of the original one.
But that's all right, when they merge together, it will also be a full screen image.

But it will not be a symmetric frustum, as you have said.
Can it be displayed properly? Or what other files shall I modify.

Thank you very much:D