View Full Version : Maya API question N3
10-26-2003, 10:27 PM
My third question is about determining of points (vertexes) visibility of poly-mesh, when we are looking throught the camera.
Of course i can determine faces, that are "looking" wrong way, but what i have to do with intersections? I mean, if it's all fine with faces, but i just can't see some points, because they are behind other objects or faces?
I know theoretical methods and methods that use graphic buffers, but my question is:
If Maya API has methods to determine visibility of vertexes?
If not - may be you know some tip&tricks?
p.s. i have an array of some points of poly-mesh and i want to remove points, that i can't see through the camera.
Thank you very much, powerful gurus!
10-27-2003, 09:18 AM
I assume you're talking about the in-the-viewport case. It's much the same for the final render really...
Maya doesn't determine vertex visibility itself AFAIK, but relies on OpenGL for this. In which case, it's a matter of z-buffering.
If you want to find out if a particular vertex is visible, the naive way to do it would be to project the vertex into screen space for the view you are concerned about, then check the z-buffer to see if there's anything closer than it blocking it from view at that pixel.
However, this is fraught with problems due to aliasing.
10-27-2003, 09:52 PM
thank you, playmesumch00ns for answer.
but i'm really affraid of z-buffers and e.t.c. Now i just can't use it, because of lack of my knowledge. so i try to ask about simpler situation. please look at the picture. I hope that you know solutions, or know where can i read about it. But i want to work only in 3d space without any 2.5 data (like z-buffers).
if i go further i'll be able to work with 2d data (all curves are flat and at the z=0 position) in 3d space, but without 2.5 data.
thank you very much.
Are you trying to clip the objects based on a point that has a lower z, or because of how it appears in the view?
10-28-2003, 08:01 AM
Hi sbp! you are right. i want to clip the curves (move or remove some theirs points). i want to find points in intersections, that stay farther from the camera (than on other curves).
may be we have to get two "curve point" and move them along the curves, and when points "meet" each other we'll cut (using "detach curves") lower curve at this point?
may be it's wrong way, it's just my imagination. may be the best - is using "edit points"?
but anyway, i don't know how to do it, please show me the way and direction how to walk on it. i'll try to go there myself.
10-28-2003, 09:14 AM
toshich, if you're scared of using z-buffering, then the only other feasible solution is a line visibility alorithm like Appel's Quantitative Invisibility algorithm. Jim Blinn also designed a small upgrade to this algorithm, but I forget its name now.
10-28-2003, 09:28 AM
hi playmesumch00ns! may be you know good links to these algorithms?
i've found some, but it's not so good.
10-28-2003, 02:50 PM
Or it's better to use z-buffer anyway? if so, can you explain me, how to do it inside Maya, using API and OpenGL. i know, that it's a big lection, but i want to know only about main things.
project the vertex into screen space for the view you are concerned about, then check the z-buffer to see if there's anything closer than it blocking it from view at that pixel.
i'm totally new in such things, that's why i'm asking.
10-29-2003, 09:57 AM
Well you're doing something that's quite complicated. A search for "Appel QI hidden line" on google threw up a number, but I don't have time to go through them now.
The Z-buffer approach is simple but slow and inaccurate. Basically you draw the scene once, then get the modelview, projection and viewport matrices from OpenGL, then plug those and the world space vertex into a gluProject() call. This gives you back the screen-space position of that vertex. You then read the depth buffer at that posiiton to see if there's anything closer.
If you can't read the depth buffer directly, you can draw a coloured ID image. Draw the polygons in white, then draw the lines in nuique colours. Then you just read the framebuffer at the relevant point (or its neghbourhood) to see if the right colour's there.
They deal a lot with this stuff in NPR papers that deal with drawing silhouette outlines. In particular papers by Northrup and Markosian. Look some of them up.
Hope this helps, haven't got time to go into too much detail right now,
01-16-2006, 01:00 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.