Skip to main content
gamedev.net
🔒 Locked

Texture coordinates "normalization"

Started by biraneto Feb 25, 2009 at 5:23 PM 0 replies 1.2k views
Original Post
biraneto
biraneto
First of all, I'm sorry if the title is misleading in any manner. I'm trying to do multitexturing using shaders with a second texture added to a first using different coordinates, and with the second having always the same visual aspect. -First texture has texture coordinates created by the 3d modeler.- -Second texture could generate coordinates using automatic generation or using the base coordinates of the first texture. My problem is making the second texture look always the same size, while the first one may have varying resolutions (ie. May be mapped on two objects with different sizes, streched in the bigger model). Using automatic textures generation on my shaders didn't work since I couldn't find a way of mapping the texture exactly on top of the face normal(there were some faces where the texture appeared as a bunch of colored lines)... fixing this may also solve my problem. Anyoneone with any clues of what could I do to solve this? Thanks for your time...
biraneto
biraneto
Well that was my problem



And this is the solution (not extensively tested yet... may be buggy) I found

gl_TexCoord[1].s = dot(gl_Vertex.zxy, gl_Normal);
gl_TexCoord[1].t = dot(gl_Vertex.yzx, gl_Normal);



If something is wrong or could be optimized feel free to advice. I got to this solution but maybe there is a better way :)

[Edited by - biraneto on February 26, 2009 11:39:28 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.