Overlapping display regions

Hi all,
Loving Panda so far. I’m probably missing something obvious, but…

I want two cameras to view a model in different positions of the screen (top and bottom split screen say). So no problem using two display regions.

The catch is, I want the second view to ‘spawn’ out of the first, and move into position - ie the display regions must initially be overlapped.

However after spawning, the views need to be clipped to their own area.

Hopefully this sketch makes clear what I’m trying to say:

I’ve tried several approaches, but none quite worked out.
Having both DisplayRegions full screen size, and moving one of them up works fine for the ‘spawning’ but then to get the regions to clip I need to set them to their half screen sizes. At the same time I set the aspect ratio of the lens to keep the shape correct. Unfortunately this makes the model half size.

Ie: If you have a full screen display region showing a model, and want to change to a half screen display region and have nothing change except the model becomes clipped to its half screen… how would you do it?

I also tried just leaving the full display region and clipping by placing a virtual ‘piece of paper in front of the camera over the top half’ (using cardMaker) which worked visually, but even when the whole scene is blocked out in the way the FPS doesn’t change - it seems this didn’t cull anything from the clipped region which isn’t very desirable.

Any thoughts would be much appreciated!

Cheers :slight_smile:


If you adjust the lens’s film size and lens offset parameters while you adjust the DisplayRegion size and placement, you can keep the rendered image the same size. Think of the film size as corresponding to the same size and shape of the DisplayRegion, so that if you cut the top off the DisplayRegion, you should also cut the top off the film size.

By default, the film rectangle is centered over the lens. If you want to cut the top off the DisplayRegion and not chop the image equally from the top and the bottom, you will also need to adjust the position of the film rectangle so that it is no longer centered, using setLensOffset().

These operations take the place of adjusting the aspect ratio. Setting the aspect ratio will automatically recompute the film size, but if you set the film size explicitly in x and y, you do not need to adjust the aspect ratio.


Hey David, thanks a lot for your reply.

Altering the filmSize on a camera doesn’t seem to actually change the output (unless I alter the x/y ratio)
ie: topCamNode.getLens().setFilmSize(topCamNode.getLens().getFilmSize()*2)
doesn’t have any visible effect on the rendered image (its not doubled or halved in size).

So I still couldn’t get the original approach to work. Did I miss something here? Should setFilmSize change the output?

Your mention of the lens offset did give me an idea which more or less works for my requirements - I leave the display area the same size, but move half of it offscreen (which was already happening with the top camera) and use the lens offset to get the correct part of the image ie

filmSize = bottomCamNode.getLens().getFilmSize()
bottomCamNode.getLens().setFilmOffset( 0, -filmSize[1]/2 )

which leaves the output looking the same but with clipping.

This is a bit hacky I know… AND… the stuff off the bottom and top of screen is still rendered (as its in a valid part of a display area), so not so efficient.


Ah, sorry. This is the lens trying to be smart: it is automatically adjusting the focal length to keep the FOV the same as you change the film size. This happens because the lens properties of film size, focal length, and FOV are all interrelated, and the lens will remember the two properties that you most recently set explicitly, and automatically compute the third.

Since what you want in this case is to adjust the FOV while keeping the focal length the same, you just need to precede this operation with a set to the focal length, e.g.:

lens.setFilmSize(x, y)

That will then have a visible effect on the output.


Thats awesome David - it finally works as I hoped. I knew it would be easy if I just knew the magic one line!
Many thanks :slight_smile: