PDA

View Full Version : GF3 Vertex Prog - how to implement...



pocketmoon
02-08-2002, 05:26 AM
Hi Folks,

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
else
u = v.x
v = v.y
end if
else
if v.y > v.z
u = x
v = z
else
u = x
v = y
end if
end if


How simply can this be translated into Vertex Shader code ?

ta ta
Rob J.

okapota
02-08-2002, 08:58 AM
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.

pocketmoon
02-08-2002, 10:34 AM
I'm only working with one vertex.
I just need to extract into the tex co-ords the two smallest components on the vector.

Korval
02-08-2002, 11:36 AM
You're on a GeForce 3, so why not use Cube Mapping?

mcraighead
02-08-2002, 11:48 AM
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.

- Matt

pocketmoon
02-08-2002, 12:42 PM
Hi Matt,

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 http://www.opengl.org/discussion_boards/ubb/wink.gif


Rob

pocketmoon
02-12-2002, 01:13 AM
ok..

my cherished 3dfx baseball cap to anyone who offers a workable solution http://www.opengl.org/discussion_boards/ubb/wink.gif

davepermen
02-12-2002, 01:58 AM
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

kon
02-12-2002, 03:40 AM
Try
u = min(x, y);
v = min(z, max(x, y);

Not exactly what you want, but maybe you can live with that.

kon

pocketmoon
02-12-2002, 06:10 AM
Chears Kon!

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[24].x

Works a treat http://www.opengl.org/discussion_boards/ubb/smile.gif