Rescale Normal Conformance Test Proposal Dan Brokenshire, IBM (brokensh@austin.ibm.com) originally authored by Pat Brown, who is no longer at IBM mustpass.c ---------- This proposal suggests adding a subtest (RescaleNormal) that does something like the following: * Enable lighting, light 0, and normal rescaling. * Set material parameters: - ambient, emissive, and specular to black - diffuse color to white - color indexes to 0,2,2 - specular exponent to 1 * Set light 0 parameters: - position at infinity pointing along the Z axis - ambient color to black - specular and diffuse color to white * Use scale factors of 0.25, 1.0, and 4.0. * Render polygon with normal pointing along the Z axis such that diffuse and specular dot products are both 1.0. * In RGB mode, verify that the color rendered is within epsilon.color of white. * In CI mode, verify that the index rendered has a value of 2. Repeat with the specular material color set to white and diffuse material color set to black. In the color index case, the specular factor s' should be 1.0 so there will be no diffuse contribution to the index because it is multiplied by (1-s'). If that's not acceptable, the COLOR_INDEXES material property could be changed so the diffuse index is 0 instead of 2. If the subtest needs to be scaled back, the specular portion could be removed. xformn.c -------- The conformance test xformn.c already tests several aspects of the transformation of normals, which the rescale normal function extends. This proposal suggests extending this test (or generating a new equivalent test) that works as follows. In several areas of the current test, there is code that a polygon at various angles as below and then checks the rendered color against a theoretically computed color: glPushMatrix(); glRotatef(polyAngle, 0.0, 1.0, 0.0); glBegin(GL_POLYGON); glVertex2f(-0.7, 0.6); glVertex2f(-0.7, -0.6); glVertex2f(0.7, 0.0); glEnd(); glPopMatrix(); The proposed extension to the test simply modifies the test to generate and apply a random scale factor, render the polygon with a size compensating for the scale factor, and then test as before. The rescaling operation will produce results identical to those in the original test. glPushMatrix(); glRotatef(polyAngle, 0.0, 1.0, 0.0); | ComputeScale(scales, invScales); | glScalef(scales[0], scales[1], scales[2]); glBegin(GL_POLYGON); | glVertex2f(-0.7*invScales[0], 0.6*invScales[1]); | glVertex2f(-0.7*invScales[0], -0.6*invScales[1]); | glVertex2f(0.7*invScales[0], 0.0*invScales[1]); glEnd(); glPopMatrix(); The modified test would be run with several iterations. The first iteration works as in the original test. The second iteration tests rescaling (enabling GL_RESCALE_NORMAL) with only uniform scale factors generated. The third iteration tests normalization (enabling GL_NORMALIZE) in the same manner. The test could also be extended to test normalization and non-uniform scales, but it would have to account for the modification of the normal direction imposed by the non-uniform scale.