2D texture or 3D texture

If I want to Texture a complex 3D model,which method should I choose?
How to texture a model only once,need not texture a model multiple times for diffeent parts of it?

3D texture takes a lot of place and not really usefull if you only need to texture the surface of the model (instead of 'volume rendering).
Wrapping a 2D texture around a complex model is difficult, but a range of sulutions exist depending of your needs :
Use a real modeler to generate the needed custom texture coordinates :
http://www.blender3d.org/cms/UV_Unwrapping.363.0.html

Some tools allow to directly paint on the model : http://www.cgray.com.cn/upload/2005_06/05061322299495.jpg
http://www.pixologic.com/zbrush/products/products.html

In simple cases, try to fit a simple texture projection on the model (plane, cylindre, shpere, cube), unwrap it, and draw the texture on the unwrapped mesh. If you can’t unwrap, you are left to draw texture, map it to check it is ok, and change texture accordingly, until you reach a good-enough solution.

I think my expression is not correct.I mean I need to write a program to texture 3D models,the calculateing of texture coordinates is difficult,is there any good arithmetic I can use or consult?

Search inside blender source :slight_smile:

Anyway I still don’t understand if you need texcoord generation (to map a texture on a mesh) or inversion (to find out where is a given 3D point on the 2D texture).
Generation for simple cases (plane, sphere, you may easily imagine for a cylinder) :
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html
For inversion, I guess you need to invert the texture matrix.
http://www.rush3d.com/reference/opengl-redbook-1.1/chapter09.html

The model I want to texture is not regular,like strata model.Its surface is closed,and I need to texture the closed surface.

for most models u will need to define the texture coordinates yourself inside the modelling program which is usually a timeconsuming task

there are some magic functions/algorithms that will automatically generate texcoords by either attempting to unwrap a model or another method, but these will give worse results than hand generated texturecoordinates thus u have to tweek these

Are there any better functions/algorithms that automatically generate texcoords can be used in my program?Because I think it is hard for me to excogitate it.

Your problem is under-constrained :slight_smile:

easy on u two, some of us have vocabularies of 7 year olds

Are there any better functions/algorithms that automatically generate texcoords can be used in my program?
look in your 3d modelling program, there will be a menu with UV texture coordinate generation, play around with that

Are there any better functions/algorithms that automatically generate texcoords can be used by my program?Is it right now?

what modelling program do u use + post a screenshot of your model

I don’t do modeling ,I only need to texture the strata models that were already modeling,I only have the data structure of the surface of the model.

If you already have texture coordinates, it is easy :
glTexCoord2D(…) before each relevant vertex.

No,I don’t have the texture coordinates,I want to know how to calculate them.I think it is difficult for me. :confused:

… here come the Blender modeler : not to create the model itself, but to easily create texcoords on it.

What is your mean?I can’t understand.What should I do?