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 2 of 2

Thread: about env-mapping and spherical one

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2000
    Posts
    4

    about env-mapping and spherical one

    hi!

    when i coded usign my software renderer i use to have a trick for env-mapping that was taking the normal x/y componets (in eye space) and transform them from the [-1 1] range to [0 1] (val*0.5 + 0.5).

    i'm tring to do the same under opengl, but with texGen-SPHERICAL_MAP i don't get the desired results and i'd like to use my old algorithm. is there a way to specify in TexGen( EYE_SPACE ), that i want to use the NORMAL instead of the VERTEX? then i could adjust the TEXTURE_MATRIX to transform the range

    i want to do something like this (in eye_space):
    tex.s = (normal*{1 0 0})*0.5 + 0.5;
    tex.t = (normal*{0 1 0})*0.5 + 0.5;

    and i like sth like this with opengl:
    (ok, this is pseudo-GL, a bit faster to write)

    glTexGeni( GL_S, GL_TEXGENMODE, GL_EYE_LINEAR );
    glTexGeni( GL_S, GL_USENORMALS )

    glLoadMatrixfv( TEXTURE_MATRIX
    [0.5 0 0 0 .5]
    [0 0.5 0 0.5]
    [0 0 0 0]
    [0 0 0 0]
    )

    thx!!
    [m u r c i]

  2. #2
    Intern Newbie
    Join Date
    Aug 2000
    Location
    Berlin, Germany
    Posts
    34

    Re: about env-mapping and spherical one

    If you have a up-to-date Nvidia graphics card.You can just use their extension NV_texgen_reflection

    The following is the overview part copied
    from http://oss.sgi.com/projects/ogl-samp...reflection.txt
    This extension provides two new texture coordinate generation modes
    that are useful texture-based lighting and environment mapping.
    The reflection map mode generates texture coordinates (s,t,r)
    matching the vertex's eye-space reflection vector. The reflection
    map mode is useful for environment mapping without the singularity
    inherent in sphere mapping. The normal map mode generates texture
    coordinates (s,t,r) matching the vertex's transformed eye-space
    normal. The normal map mode is useful for sophisticated cube map
    texturing-based diffuse lighting models.

Posting Permissions

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