View Full Version : problem with M3dView::viewToWorld()

11 November 2008, 10:34 AM

i want to do some raycasting and for this i need a function where i can choose a certain pixel of my render and then create a ray for this pixel.

Currently i'm using the function

M3dView::viewToWorld(short x_pos, short y_pos, MPoing & nearClipPt, MPoint & farClipPt);

i thoght it was working, but i just found out that i get different results, if i resize my viewport. but that's definately not what i want! i want the transformation to be dependant on the matrices used for software rendering, such that my rays correspond to the actual pixels of the render.

So - what else can I use than M3DView::viewToWorld? or how can I make sure that this gives me the right result?

//additional question:
can somebody tell me what the MFnCamera::postProjectionMatrix is good for? the docs are very unspecific on that and i couldn't find anything useful in the web.. thx!


11 November 2008, 07:10 PM
Not sure what specifically you're trying to achieve with the data, so the timing of this callback may not meet your needs, but have a look at MRenderCallback and MRenderData. If you create a callback, an MRenderData will be passed to you which contains the data I believe you're looking for.

CGTalk Moderation
11 November 2008, 07:10 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.