Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: dot3 weird problem , help needed !

  1. #1
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    13

    dot3 weird problem , help needed !

    Hello OpenGl fellas , sorry to disturb you , but i have the most wierd problem wih dot3 bump mapping. Here it is :

    1-My dot3 bump code wasn´t working properly, it was showing the scenes in grayscale..but bumpmapped(i wasn´t using grayscale images for this )

    2-For debugging purpose, i got the Radeon simple bump example,and ran it in my computer,it worked ok

    3-I changed my Render code to one similar to the Radeon example(with inverse modelview matrix multiplication instead of the binormal and tangente vectors code, for calculating tangent space) and this weird thing happened: when dot3 is enabled nothing is rendered, i got one blank screen .....
    so i changed the (N.L) unit texture to the base map , instead of the normal map , and i got the grayscale scene that was happening before.
    When i disable the N.L texture unit , the base map appears ok,the light vector also appears correct as in the ATI demo,and the normal map alone also appear correct as in the demo.
    When i change the GL_PRIMARY_COLOR_EXT in
    Code :
    glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
    for other constants like GL_TEXTURE , the scene appears(not with the correct bump mapping of course,but the blank screen problem fades)

    4-In a desperate moment i simply copy and paste the ATI example render code ....nothing ...same blank screen

    so , do you guys have any idea of what may be going on ?
    I´m using the TGA files that come with the radeon demo,i also used .bmp version of them

    I´m using a GF4 Ti 4600,and all the extensions needed are supported

    Thanks in advance, sorry for the giant post
    it´s just that i can´t figure what´s happening

    Thank you once more





    [This message has been edited by Arashikage (edited 05-23-2003).]

  2. #2
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    345

    Re: dot3 weird problem , help needed !

    1) Copy&Pasting code you don't understand is a very bad idea. In fact, I think copying code is always a bad idea as you'd better write your own code as you'll be sure it does what you want it to do.

    2) Read http://tfpsly.planet-d.net/english/3d/pplight_bump.html or any other doc about dot3 bump mapping

  3. #3
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    13

    Re: dot3 weird problem , help needed !

    I know that copy and paste is the worst solution possible, i did that only to see if things would work,but they didn´t

    The code in your page is very similar to mine (the one that shows bumpmapping but in grayscale) except for

    Code :
    glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_EXT,GL_PREVIOUS_EXT);
    which in mine is
    GL_PRIMARY_COLOR

    and for the scaling
    which i use
    R = 0.5 + x*0.5
    G = 0.5 + y*0.5
    B = 0.5 + z*0.5

    i changed to yours , again in my cde is grayscale , but clearer

    Thanks fr the response

    P.S
    there´s something wierd with your page , you put the where "i can get normal maps " section 2 times

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    857

    Re: dot3 weird problem , help needed !

    Sounds like your base texture is being ignored. Can you post your complete texture env. combine setup (for all texture units)? Also don't forget to mention which textures are bound to which units.

    -- Tom

    PS: glGetError() is your friend!

  5. #5
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    13

    Re: dot3 weird problem , help needed !

    Tom :
    here is my texture unit setup


    Code :
    //****************unit0********************
             /* dot product between N (the normal map) and L(PRIMARY_COLOR_EXT).*/
    //****************************************
             glActiveTexture(GL_TEXTURE0_ARB);
     
             glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
             glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT); 
     
             glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
             glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
             glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
             glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
    glBindTexture (GL_TEXTURE_2D,BumpTex);
    glEnable(GL_TEXTURE_2D);      
     
     
    //*************unit1**********************
             // modulates the base texture
    //****************************************
     
             glActiveTexture(GL_TEXTURE1_ARB);
     
     
             glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
             glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
     
             glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
             glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
             glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
             glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
     glBindTexture (GL_TEXTURE_2D,BaseTex);
     glEnable(GL_TEXTURE_2D);
    Thanks

    [This message has been edited by Arashikage (edited 05-23-2003).]

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    857

    Re: dot3 weird problem , help needed !

    Looks okay... If you change unit 1 to GL_REPLACE, does your base texture show up correctly?

    -- Tom

  7. #7
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    13

    Re: dot3 weird problem , help needed !

    Originally posted by Tom Nuydens:
    Looks okay... If you change unit 1 to GL_REPLACE, does your base texture show up correctly?

    -- Tom

    Yes , and if i disable the texture unit 0 it appears correct too ( coloured and stuff..)

    The most weird thing is that , when i use the base texture as bump ,i got no more a blank screen , but a grayscale bump.
    The other things , like rendering the L vector as texture and the the normal map only works perfecly ...

    This makes me wonder ..( i never saw that ...but...)
    Do i need a special loading fucntion for loading normal maps ?? or i can use the same for normal maps and base texture ?

    Thanks once more
    sorry for bothering


    [This message has been edited by Arashikage (edited 05-23-2003).]

  8. #8
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    345

    Re: dot3 weird problem , help needed !

    Originally posted by Arashikage:
    there´s something wierd with your page , you put the where "i can get normal maps " section 2 times
    True, thanks. Did I just say copy/pasting was bad ?

  9. #9
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    345

    Re: dot3 weird problem , help needed !

    Originally posted by Arashikage:
    Do i need a special loading fucntion for loading normal maps ?? or i can use the same for normal maps and base texture ?
    Nop. If your normal map was properly created, it is ready to be used like any other texture.

  10. #10
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    13

    Re: dot3 weird problem , help needed !

    Hey Tom i noticed that in the second texture , even if i use GL_REPLACE the screen gets blank when the bump texture is binded ....

    now it´s even weirder ...GL_REPLACE is giving me the same result as GL_MODULATE ...


    I´ll check if there´s an error while trying to generate mipmaps or something for normal maps .....
    i changed the textures(once more for the some that came with the demo) ...same result

    Thank you all for attention.

    Be welcome tfpsly ..your page is one the best in that subject (probably the most clear explanation on D3 bumpmapping)

    [This message has been edited by Arashikage (edited 05-23-2003).]

Posting Permissions

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