A quick one I hope. I want to generate texture co-ords in a vertex shader prog by taken the two smallest of the three vertex components (for simple spherical mapping)
if v.x > v.y
if v.x > v.z
u = v.y
v = v.z
u = v.x
v = v.y
if v.y > v.z
u = x
v = z
u = x
v = y
How simply can this be translated into Vertex Shader code ?
im not sure it can be, because this is per polygon, and vertex program works on the vertex level, but maybe if you put the other verts in the registers, it is possibile.
I’m only working with one vertex.
I just need to extract into the tex co-ords the two smallest components on the vector.
You’re on a GeForce 3, so why not use Cube Mapping?
Cubemapping is probably a better approach, but if you really want to implement that specific thing, you can do so with SGE/SLT followed by some MULs, ADDs, or MADs. Not sure how many total instructions it would take, but I would think not many.
I’m doing a surface texture using a cube map and i’d like to blend in a highly repeated detail texture. If I use a cube map for the detail texture would I have to repeat the detail texture 6 times? and does cube mapping allow repeated/wrapped textures ?
Oh and I guessed it would require a series of SGR/SLT/MAD’s etc
my cherished 3dfx baseball cap to anyone who offers a workable solution
use a small 3d-texture with only alpha as 3d-detailmap.
use your vertex-pos as coordinates and do some nice scaling to get it to a detailed very often repeated tex
u = min(x, y);
v = min(z, max(x, y);
Not exactly what you want, but maybe you can live with that.
MAX R5, v[OPOS], -v[OPOS];
MIN R4.x, R5.x, R5.y;
MAX R4.y, R5.x, R5.y;
MIN R4.y, R4.y, R5.z;
MUL o[TEX0].xy, R4, c.x
Works a treat