Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/07/2007 at 05:21, xxxxxxxx wrote:
User Information: Cinema 4D Version: R10 Platform: Mac OSX ; Language(s) : C.O.F.F.E.E ; XPRESSO ;
--------- Hi, i'm looking for a way to convert world coordinates to screen coordinates in COFFEE. I know in cg-shader-language, I just have to multiply the local coordinates with the model-view-projection matrix.
Can I access a similar matrix inside COFFEE? Or do I have to create it all by myself (based on camera position, rotation and focal length)?
Or (even better) : is there a function, which does exactly that conversion?
Best regards, sk.
On 04/07/2007 at 07:40, xxxxxxxx wrote:
Nope, there is no such function in COFFEE. In C++ however you have several functions to convert from/to world, camera and screen space.
On 05/07/2007 at 04:54, xxxxxxxx wrote:
I am quite sure that the source code for the function used internally by C4d to do world->screen projections is avilable somewhere in the C++ API docs. Using that as reference, implementing a corresponding function in COFFEE should not be that hard.
If you can't find it, let me know and I'll look it up for you.
/Filip
On 05/07/2007 at 08:40, xxxxxxxx wrote:
Totally forgot about this. It´s in the GetViewParameter description. At least that´s the only source I know.
On 05/07/2007 at 08:49, xxxxxxxx wrote:
Quote: Originally posted by FilipM on 05 July 2007 > > * * * > > Using that as reference, implementing a corresponding function in COFFEE should not be that hard. > > > * * *
Nice tip, but it seems like the BaseView-class, which implements the WS() method is proprietary or something. At least I found only the header-file in the SDK, not the source itself. If you find out more, please let me know.
For this project a C++ plugin would only be the last resort, so I fear I have to create the matrix myself. I found a nice tutorial to calculate the projection matrix (http://www.codeguru.com/cpp/misc/misc/math/article.php/c10123__3/), the rest should be relatively easy. But a built-in approach would be much more desirable, of course!
Thanks, sk.
On 06/07/2007 at 12:53, xxxxxxxx wrote:
As I said, it´s in the GetViewParameter description of the C++ SDK documentation!
On 06/07/2007 at 13:40, xxxxxxxx wrote:
Thank you, guys... I simply overlooked that part. So after a good deal of tweaking, I've got a more or less working plugin.
I haven't found out, how to react to changes in the focal length, though... This negative-z value seems to be hard-coded to the standard-issue 36mm camera. But I guess that'll be not that much of a problem, and it's not that important anyway.
greets, stefan