1 2Name 3 4 EXT_rescale_normal 5 6Name Strings 7 8 GL_EXT_rescale_normal 9 10Version 11 12 $Date: 1997/07/02 23:38:17 $ $Revision: 1.7 $ 13 14Number 15 16 27 17 18Dependencies 19 20 None 21 22Overview 23 24 When normal rescaling is enabled a new operation is added to the 25 transformation of the normal vector into eye coordinates. The normal vector 26 is rescaled after it is multiplied by the inverse modelview matrix and 27 before it is normalized. 28 29 The rescale factor is chosen so that in many cases normal vectors with unit 30 length in object coordinates will not need to be normalized as they 31 are transformed into eye coordinates. 32 33New Procedures and Functions 34 35 None 36 37New Tokens 38 39 Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, 40 and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 41 and GetDoublev: 42 43 RESCALE_NORMAL_EXT 0x803A 44 45Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) 46 47 Section 2.10.3 48 49 Finally, we consider how the ModelView transformation state affects 50 normals. Normals are of interest only in eye coordinates, so the rules 51 governing their transformation to other coordinate systems are not 52 examined. 53 54 Normals which have unit length when sent to the GL, have their length 55 changed by the inverse of the scaling factor after transformation by 56 the model-view inverse matrix when the model-view matrix represents 57 a uniform scale. If rescaling is enabled, then normals specified with 58 the Normal command are rescaled after transformation by the ModelView 59 Inverse. 60 61 Normals sent to the GL may or may not have unit length. In addition, 62 the length of the normals after transformation might be altered due 63 to transformation by the model-view inverse matrix. If normalization 64 is enabled, then normals specified with the Normal3 command are 65 normalized after transformation by the model-view inverse matrix and 66 after rescaling if rescaling is enabled. Normalization and rescaling 67 are controlled with 68 69 void Enable( enum target); 70 71 and 72 73 void Disable( enum target); 74 75 with target equal to NORMALIZE or RESCALE_NORMAL. This requires two 76 bits of state. The initial state is for normals not to be normalized or 77 rescaled. 78 . 79 . 80 . 81 82 Therefore, if the modelview matrix is M, then the transformed plane equation 83 is 84 85 (n_x' n_y' n_z' q') = ((n_x n_y n_z q) * (M^-1)), 86 87 the rescaled normal is 88 89 (n_x" n_y" n_z") = f * (n_x' n_y' n_z'), 90 91 and the fully transformed normal is 92 93 1 (n_x") 94 ____________ (n_y") (2.1) 95 __________________________________ (n_z") 96 V (n_x")^2 + (n_y")^2 + (n_z")^2 97 98 If rescaling is disabled then f is 1, otherwise f is computed 99 as follows: 100 101 Let m_ij denote the matrix element in row i and column j of M^-1, 102 numbering the topmost row of the matrix as row 1, and the leftmost 103 column as column 1. Then 104 105 1 106 __________ 107 f = ________________________________ 108 V (m_31)^2 + (m_32)^2 + (m_33)^2 109 110 Alternatively, an implementation my chose to normalize the normal 111 instead of rescaling the normal. Then 112 113 1 114 __________ 115 f = ________________________________ 116 V (n_x')^2 + (n_y')^2 + (n_z')^2 117 118 119 If normalization is disabled, then the square root in equation 2.1 is 120 replaced with 1, otherwise . . . . 121 122 123Additions to Chapter 3 of the 1.1 Specification (Rasterization) 124 125 None 126 127Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations and 128the Framebuffer) 129 130 None 131 132Additions to Chapter 5 of the 1.1 Specification (Special Functions) 133 134 None 135 136Additions to Chapter 6 of the 1.1 Specification (State and State Requests) 137 138 None 139 140Additions to the GLX Specification 141 142 None 143 144GLX Protocol 145 146 None 147 148Errors 149 150 None 151 152New State 153 154 Get Value Get Command Type Initial Value Attribute 155 --------- ----------- ---- ------------- --------- 156 RESCALE_NORMAL_EXT IsEnabled B FALSE transform/enable 157 158 159New Implementation Dependent State 160 161 None 162