PDA

View Full Version : 3D Texture Map



KraftDinner
09-22-2004, 11:59 AM
I'm sure we've all seen the 2D texture map of a flag blowing in the wind.

I need to write some code that will allow me to do this 'mesh warping?' in 3D.

Is this possible with OpenGL and/or can you point me to an example?

TIA
B.

Jan
09-22-2004, 12:21 PM
The question "can this be done with OpenGL" can usually be answered with "yes".

But i donīt know, what you want to do. Do you actually want to do that flag-blowing-in-the-wind-thing ? In this case, check out nehe.gamedev.net (lesson 11).
Otherwise, i donīt know what you mean.

Jan.

ZbuffeR
09-22-2004, 12:30 PM
I think the OP wants a 3D texture mapped on some animated waving teapot.

KraftDinner
09-22-2004, 01:02 PM
Well actually I want to move the verticies of the 3D texture, pass a plane through the cube and render the surface of that plane as it passes through the 3D texture.

Humus
09-22-2004, 01:55 PM
I'm not sure I understand what you mean. A texture does not have vertices ...
Is this anything near what you have in mind?
http://www.humus.ca/?page=3D&id=46

jwatte
09-22-2004, 04:21 PM
Put a plane into your fragment program using [0,0,0]->[1,1,0] coordinates.

In your fragment program, perturb the texture coordinate in any way you want before you fetch out of the 3D texture.

Problem solved.

KraftDinner
09-23-2004, 07:30 AM
As far as I know I define a 2D texture with glTexImage2D,
glTextParameterf and then with glBegin(GL_TRIANGLE_STRIP)
glBegin, glNormal3f, glVertex3f and compile these into a newlist etc. etc.

So that is what I mean about the texture having vertices...

So my question is how to do that in 3D? I've heard about 3D texture maps but haven't actually had chance to program it.

In 2D I need to move the points that I defined with glVertex to make an object move (Like the flag wave). Perhaps there is a better way to do this that I am unaware of.

dorbie
09-23-2004, 08:14 AM
A 2D texture can be applied in 3D. The vertices are 3D etc but the texture coordinates and interpolated image remain 2D. Yes 3D texture exists and can be used but that is really to sample a slice through a 3D image for example if you had a 3D marble texture and wanted to sample based on surface location in that volume.

I'm moving this thread to the beginners section.