I’m looking for a way in Panda3d to change where on screen something renders. For example, if I were rendering a 3d model that would normally show up in the center of the screen, I’d like it to show up in the upper left of the screen.
I don’t want to move the model or the camera, the idea is that I should be able to render many of these models across the screen with the exact same perspective.
In directX when I have had direct access to perspective matrices, I have accomplished this by setting offsets in the perspective matrix.
One thing I tried to do is just call setX on a NodePath, but the issue there is that I want to be able to pass in screen coordinates. So for example, if I want my model center to move from the center of the screen to the left edge, I might pass in setX(-400) if my window was 800 pixels wide.
Are you sure you want these models to be parented to render? The idea is that render is a 3-D scene, which is observed by a single 3-D camera, and those results displayed in the window.
It sounds like you are asking for something different: you want a model to be displayed in the window in a location unrelated to its position in space. Maybe you want multiple images of the model, seen from the same perspective, to be displayed in different locations on the window.
There are lots of ways to do this, of course, but most of them don’t involve parenting your model to render. One answer is to use render2d instead, which is already screen-relative. Another answer is to create and use separate DisplayRegions. A third answer is to render offscreen to a texture, and then attach multiple texture cards to render2d.
thanks for the info.
I was under the impression render2d used an orthographic view, which I don’t want. I still want a traditional perspective view, but as you mentioned, it’s sort of like I want to draw different models in different windows, all in the same frame.
It sounds like displayregions is what I want to use. so far the only time I see you can specify a displayRegion is in camera creation… I’ll look into that some more.
A DisplayRegion is a rectangular area in the window for displaying the results of a camera’s view. Since each DisplayRegion is associated with one camera, it is common to create them when you create the camera. It is also possible to create them individually. If you want all of your DisplayRegions to show the same thing, you are allowed to assign the same camera to all of them.
The normal way to create a DisplayRegion directly is something like:
dr = base.win.makeDisplayRegion(left, right, bottom, top)
where left, right, bottom, top define the rectangular region of the window, in the range 0 to 1 for all coordinates.
Thanks for the help.
I also found some info on these postings:
discourse.panda3d.org/viewtopic.php … playregion
Anyway, I got what I wanted working now!