   Saving a model's normals in a texture (Cg)
  Hi,I am programming a rust generation and propagation program.  In order to do what I want,  I need to extract all the normals from a model.My idea is a bit like reverse texture mapping: for a certain parametrisation of a texture, instead of fetching the texture color for a point ON the model, you store the xyz normal coordinates of the point into the rgb channels of the texture, (which is to be saved at the end of the process of course).I haven't tried it yet, but would it be possible to do that in Cg?  I'm really no expert in Cg, but I thought I could use a vertex program to bind an empty texture to a 'uniform sampler2D', store the normals in that texture, then after the first rendering, save that texture to a file.Does that make any sense? Any pointers?  Does anyone know of an example somewhere on the net that does something like this?I'm sure someone could use this idea to create normal maps from a high-poly model then apply them to low-poly models.thanks in advance,Louis Bouchard   
  if you want to create normal maps you could render a cube map (all 6 planes)and use the normals as colorsthen you just have to use the cubemap to normalmap you model   ;  Well the last sentence in my original post doesn't apply directly to what I am doing, it's just loosely related.I'm *NOT* trying to create a normal map in the traditional sense, i.e. planar representation of normal perturbations for bump mapping.What I'm trying to do is this:Let's say you have an empty texture and a model.  For each point on the surface of the model you have a corresponding (u,v) coordinate in texture space.  I want to take the normal on each point of the surface and save it to the right (u,v) in the texture.I hope I've made things clearer,thanks for any help anyone ca give,Louis Bouchard   ;  Basically no, it is not possible to do what you want. The only output pixel shaders have is the destination buffer (and in the case of the GeForce 6 and I'm-not-sure-which ATI card there can be four other output buffers), but which pixel you write to is selected by the geometry and can't be changed in the pixel shader itself.   ;  You might be able to get close to what you want. Search for recent work on Subsurface Scattering. The basic technique is to output the UVs as the positions from the vertex shader, this essentially does the texture unwrap in the shader. If you also did your transformation, and sent the actual normals in another interpolator, you could probably get the effect you'd like.   