Hi everyone.. I have looked at many tutorials and mainly the vertex renderer example from Bobo in the maxscript help. I have created a function that I thought worked in the beginning but I have a odd error... all values in the Y direction is wrong
I use the following function to do this... but get the wrong y coord.. and it feels a bit scaled since the closer to 0 I get the better the result...
fn PixelPos inputPoint3D =
(
local screen_width, screen_height
screen_width=RenderWidth as float
screen_height=RenderHeight as float
thePos = inputPoint3D * viewport.getTM()
screen_origin = mapScreenToView [0,0] (thePos.z) [screen_width,screen_height]
end_screen = mapScreenToView [screen_width,screen_height] (thePos.z) [screen_width,screen_height]
world_size = screen_origin-end_screen
x_aspect = screen_width/(abs world_size.x)
y_aspect = screen_height/(abs world_size.y)
screen_coords = point2 (x_aspect*(thePos.x-screen_origin.x)) (-(y_aspect*(thePos.y-screen_origin.y)))
return screen_coords
)
Any suggestions why it behaves like this would be very appreciated. The sceenshot is from a little wpf util that adds markers at specific x,y positions... (and yes I have also checked the values in max they are wrong there too;-)
If or when you look at the screenshot... it is a plane in max and the red dots should align with the verts.. but does not do that in the Y direction
By Anton Berg · 2011-02-20