TinyGL normal scaling broken
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Daytona675x
    Posts: 103 from 2013/12/5
    Hi,

    at least on my Radeon 9000 setup normal-scaling doesn't work as expected.
    It is the "other way around".

    For example, to compensate a

    glScale(2,2,2)

    I have to use normals of length 0.5 (1/2) when using TinyGL, instead of normals of length 2 as OpenGL would require.

    Yes, at first you may think that I make a mistake here, but normals don't scale like vertex-coordinates in OpenGL (normal coordinates are transformed by the inverse transpose of the transformation that transforms points!)

    This is actually the "1st common OpenGL pitfall" :)

    Quote:

    The other option is to adjust the normal vectors passed to OpenGL so that after the inverse transpose modelview transformation, the resulting normal will become a unit vector. For example, if the earlier glScalef call tripled the vertex coordinates, we could correct for this corresponding thirding effect on the transformed normals by pre-multiplying each normal component by 3.


    Any chance this is going to be fixed?
    Is this a driver or general TinyGL bug?

    Cheers,
    Daniel

    [ Editiert durch Daytona675x 24.03.2014 - 18:02 ]
  • »24.03.14 - 17:12
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1513 from 2003/2/24
    From: Finland
    Seems neither kiero or bigfoot replied yet. Could you please report it via Bug report feature in MorphOS?

    I dont know if it could be fixed because then existing software could stop working if it is in TinyGL. That is just my guess though.
    1 + 1 = 3 with very large values of 1
  • »25.03.14 - 11:57
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Jupp3
    Posts: 1192 from 2003/2/24
    From: Helsinki, Finland
    @itix

    Quote:

    I dont know if it could be fixed because then existing software could stop working if it is in TinyGL.

    I don't think there would be too much software that specifically depends on "TinyGL-specific broken behavior", it's usually more about "generic OpenGL behavior" rather than that. Also, if some program really depends on current tgl behavior, fixing this would "only" make it look visually wrong, lighting result being too bright or too dark.

    Of course another question is, has it always been like this, or did it happen after the recent major changes? (iirc, at least texture matrix transformations used to work before?)

    Would GL_RESCALE_NORMAL be usable temporary solution?
  • »27.03.14 - 14:40
    Profile Visit Website