PDA

View Full Version : Rendering a texture with material properties



brett01
08-21-2009, 04:15 PM
Hi,

I have a triangle mesh with previously assigned texture coordinates.I want to assign the texture with material properties of the surface.I can do rendering a model to a texture but not material properties.Thanks in advance.

scratt
08-21-2009, 07:48 PM
Hmm.. What you need to read about are the combiner functions in OpenGL.

Here's a page about lighting and textures, which should explain some of the problems I think you are seeing / trying to overcome.

http://www.opengl.org/resources/faq/technical/texture.htm

Depending on what version of OpenGL you are using (you don't say) there are various texture combiner functions that allow you to mix primary colours, and apply certain affects to one or more texture and then mix the result in the final output. This can be used with a normal texture and it's corresponding normal map to produce bump mapping, for example.

Here is a wiki that has some info (do be aware that if you are on GL3.x then this has all changed / been deprecated), but from your question I am assuming you are using the fixed function pipeline still, so must be pre 3.x, or running a compatibility layer.

http://www.opengl.org/wiki/Texture_Combiners

brett01
08-22-2009, 03:23 PM
sorry for not giving much information.I m using shaders and i want to encode the material properties into a texture.

scratt
08-22-2009, 08:51 PM
Your best bet is to check out either the LightHouse3D OpenGL site, or the Orange Book companion site (http://www.3dshaders.com). Even better, buy The Orange Book! :)

On those sites there are examples of how to do similar functions to the Fixed Function Combiners, which is what you need. :)