Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: GF3 Vertex Prog - how to implement...

  1. #1
    Member Regular Contributor
    Join Date
    May 2001
    Posts
    255

    GF3 Vertex Prog - how to implement...

    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.

  2. #2
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    israel
    Posts
    332

    Re: GF3 Vertex Prog - how to implement...

    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.
    -ofer-

  3. #3
    Member Regular Contributor
    Join Date
    May 2001
    Posts
    255

    Re: GF3 Vertex Prog - how to implement...

    I'm only working with one vertex.
    I just need to extract into the tex co-ords the two smallest components on the vector.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: GF3 Vertex Prog - how to implement...

    You're on a GeForce 3, so why not use Cube Mapping?

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Sep 2000
    Location
    Santa Clara, CA
    Posts
    1,463

    Re: GF3 Vertex Prog - how to implement...

    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

  6. #6
    Member Regular Contributor
    Join Date
    May 2001
    Posts
    255

    Re: GF3 Vertex Prog - how to implement...

    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


    Rob

  7. #7
    Member Regular Contributor
    Join Date
    May 2001
    Posts
    255

    Re: GF3 Vertex Prog - how to implement...

    ok..

    my cherished 3dfx baseball cap to anyone who offers a workable solution

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: GF3 Vertex Prog - how to implement...

    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
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  9. #9
    Junior Member Regular Contributor
    Join Date
    Aug 2001
    Posts
    204

    Re: GF3 Vertex Prog - how to implement...

    Try
    u = min(x, y);
    v = min(z, max(x, y);

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

    kon

  10. #10
    Member Regular Contributor
    Join Date
    May 2001
    Posts
    255

    Re: GF3 Vertex Prog - how to implement...

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •