Manual issue for admins

I report an inconsistency in the user manual of Panda3D relative to the coordinates of pixel2d at this link: … ipulations
It says that the lower-right corner max coordinates is (1,0,-1), but in the following post says that the bottom right corner equals your window resolution. … I_Elements
I have tested it and confirm that the second post is the right one.

This sentence is the misleading one, I guess:
“The lowerright corner represents (1, 0. -1)”

One could argue that “represents” refers to render2d.

Is this less confusing?:
“The lower right corner has x and y values equal to the width and height of the window.”

Certainly your phrase is more proper and understandable.

Fixed. Thanks for reporting.

I’m not quite sure if it was the y or the z value for width, though.

The screen Y (width) is -Z in pixel2d.

Panda uses Z-up, so lower-right corner is -height to prevent text from being upside down.

So is the right lower corner -screen_height or 0?

Maybe we should draw some simple illustrations, as people often get confused by that (myself included).

So render2d is like this:

| screen |

A = (-1, 0 1)
B = ( 1, 0, 1)
C = (-1, 0,-1)
D = ( 1, 0,-1)

assuming (window_width >= window_height) and (aspect_ratio = window_width/window_height) aspect2d is like this:

A = (-1aspect_ratio, 0, 1)
B = ( 1
aspect_ratio, 0, 1)
C = (-1aspect_ratio, 0, -1)
D = ( 1
aspect_ratio, 0, -1)

and pixel2d is then probably something like this:
A = (0, 0, 0)
B = (window_width, 0, 0)
C = (0, 0, -window_height)
D = (window_width, 0, -window_height)

Is that all correct so far?

That looks correct to me, though that can easily be verified using a few lines of Python code. :wink:

The reason why we chose for D.z = -height instead of D.z = 0 in the pixel2d case is because we thought it’s more intuitive this way. People can just use coordinates from the top-left corner of the window like they are probably used to, they just need to remember to put a negation sign in front of the Z coordinate, ie it’s just flipped over the X axis.

Well, in most graphics programs and in HTML you usually only use positive numbers where the lower right corner has maximum values. But considering the Y axis being the one that points forward, it makes sense the way it is.
One could argue that beginning in the lower left corner (0,0,0) and ending in the upper right would lead to positive coordinates only, but that’s probably a matter of taste.

I think that if Panda3D uses the coordinate system * right-handed * for the 3D world, the same should be done for rendering 2d, where the lower-left corner is (0,0,0) as it would be all clearer without dozens of changes to the coordinates.

p.s.: for aspect 2d can do(0,0,0) in the center of screen but with top-right equal to the positive maximum.

There are good arguments to be raised for either convention, but in the end we had to choose something. If you don’t like it, you can always use your own node, there’s nothing special about pixel2d.

Maybe we could use yet another node, like window2d or screen2d(or a sub-node pixel2d.window2d?) that would understand coordinates in the rest-of-the-world way? X=0 and Y=0 would be top-left, X=window_width and Y=window_height would be bottom-right. Z would be depth (+values on top of -values).

pixel2d is kind of wierd for me, but it’s logical… in a Panda3D way.

That doesn’t work. Any text or images that you add would be upside down.

If you turn the node so that the camera looks at it from Z+, then it actually should work.