View Full Version : 3D texture plane extraction
01-25-2006, 12:16 PM
Hi, what I am trying to do is as follows. I have a 3D texture loaded and a user manipulated clip-plane. As the user moves the clip plane through the volume I want to store the 2D image of whats on the plane at that point into a texture. The clip plane is not perpendicular to the camera so it may be only partially visible to the user from that angle but i still want the information as if I was looking at it head on. So is there an easy way of accomplishing this?
Hopefully that makes sense
I'd move the volume into clip-plane space, and capture the slice through the origin in a textured quad.
In other words, I'd draw a quad at the origin, in the XY plane, with the inverse (along with appropriate texture space scaling) of the matrix that orients the clip-plane (assuming it's initially in the XY plane) in world space on the texture matrix stack, then grab the resulting image with glReadPixels (or do the entire rendering into a render-able 2D texture). I've never tried this so I'm not sure what kind of subtleties you may encounter off hand.
01-26-2006, 06:24 AM
Thx, I have tried playing around with glDraw/Read pixels but I don't think that will work for my purposes, as the plane may not be perpendicular to the user so without moving the camera I would not be able to get all the pixels of the plane as if I would be looking at it head on, plus the fact that its slow ;)
What I'm thinking of doing now is to simply move the camera according to the clip plane without the user knowing and render that to texture using an FBO, not sure if this will give me exactly what I want but I'll give that a shot.
Yes, ReadPixels can be slower that the RTT methods, but you did ask for an easy way to do this, in the beginner's forum no less ;)
By the way, orienting the camera with the clip-plane is exactly what I described, and as I said you can load the inverse of the clip-plane transformation matrix on the texture matrix stack and render a screen-aligned quad to capture the slice.
Please let us know how this works out.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.