1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> 3<!-- InstanceBegin template="/Templates/default_template.dwt" codeOutsideHTMLIsLocked="false" --> 4<head> 5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6<meta http-equiv="Content-Style-Type" content="text/css" /> 7<!-- InstanceBeginEditable name="CSS の相対パス指定" --> 8<link href="../../../common/manual.css" rel="stylesheet" type="text/css" /> 9<!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="ページのタイトル" --> 10<title>Write Test</title> 11<!-- InstanceEndEditable --> 12</head> 13<body> 14<div> 15 <div class="body"> <!-- InstanceBeginEditable name="本文のタイトル" --> 16 <h1>Write Test</h1> 17 <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="本文" --> 18 <p>The <I>write test</I> takes generated fragment information as reference values to determine whether to actually write the fragment data to the framebuffer. This is carried out on each fragment separately</p> 19 <p>Criteria are set for the evaluation of fragments, and those that do not fully meet the conditions are excluded from rendering.</p> 20 <p> Table 1 Types of Write Tests</p> 21 <table> 22 <thead> 23 <tr> 24 <th>Type</th> 25 <th>Description</th> 26 </tr> 27 </thead> 28 <tbody> 29 <tr> 30 <th>Alpha test</th> 31 <td>Compares a fragment's alpha value with the reference value set for the alpha test.</td> 32 </tr> 33 <tr> 34 <th>Stencil test</th> 35 <td>A <I>stencil test</I> compares the value set here for the fragment stencil test with the value in the <I>stencil buffer</I> to write to.<br /> If the fragment passes, the value in the stencil buffer is overwritten with the fragment value.</td> 36 </tr> 37 <tr> 38 <th>Depth test</th> 39 <td>A <I>depth test</I> compares the per-fragment <I>depth value</I> indicating the distance from the camera with the value in the <I>depth buffer</I> to write to.<br /> If the fragment passes, the value in the depth buffer is overwritten with the fragment value.</td> 40 </tr> 41 </tbody> 42 </table> 43 <p class="new_hint"><B>Note:</B> Write tests are carried out in order of Alpha test → Stencil test → Depth test.</p> 44 <p class="hint_warn">Caution:<br /> Using write tests increases processor load. Consequently, all fragment tests and operations are disabled by default. </p> 45 <h2>Alpha test</h2> 46 <p>The <I>Alpha test</I> compares the alpha value of a fragment against the Alpha test reference value to determine whether to use that fragment.</p> 47 <ul> 48 <li>If the comparison conditions are not fully satisfied, the fragment is removed as a rendering target.</li> 49 <li>A fragment that fully satisfies the comparison conditions is passed on to the Stencil test.<br /> The fragment is in the "pass-through" state.</li> 50 </ul> 51 <p class="new_hint">Usage:<br /> This is used to express translucency in textures and other images that use alpha values.</p> 52 <h3>Alpha Test Comparison Functions</h3> 53 <p>The Alpha test involves equations that are used to compare the alpha value with a reference value.</p> 54 <p>With CreativeStudio, you can select from eight different comparison functions.</p> 55 <p>Table 2 The different Alpha test comparison functions</p> 56 <table> 57 <thead> 58 <tr> 59 <th>Comparison function</th> 60 <th>Function Name</th> 61 <th>Description</th> 62 </tr> 63 </thead> 64 <tbody> 65 <tr> 66 <th>Alpha value < Reference value</th> 67 <th>LESS</th> 68 <td>Passes test if the fragment alpha value is less than the reference value.</td> 69 </tr> 70 <tr> 71 <th>Alpha value ≦ Reference value</th> 72 <th>L_EQUAL</th> 73 <td>Passes test if the fragment alpha value is less than or equal to the reference value.</td> 74 </tr> 75 <tr> 76 <th>Alpha value = Reference value</th> 77 <th>EQUAL</th> 78 <td>Passes test if the fragment alpha value is equal to the reference value.</td> 79 </tr> 80 <tr> 81 <th>Alpha value ≧ Reference value</th> 82 <th>G_EQUAL</th> 83 <td>Passes test if the fragment alpha value is greater than or equal to the reference value.</td> 84 </tr> 85 <tr> 86 <th>Alpha value > Reference value</th> 87 <th>GREATER</th> 88 <td>Passes test if the fragment alpha value is greater than the reference value.</td> 89 </tr> 90 <tr> 91 <th>Alpha value ≠ Reference value</th> 92 <th>NOT_EQUAL</th> 93 <td>Passes test if the fragment alpha value is not equal to the reference value.</td> 94 </tr> 95 <tr> 96 <th>Pass-through all</th> 97 <th>ALWAYS</th> 98 <td>Always passes the test.</td> 99 </tr> 100 <tr> 101 <th>Pass-through none</th> 102 <th>NEVER</th> 103 <td>Never passes the test.</td> 104 </tr> 105 </tbody> 106 </table> 107 <p>Fig. 1 The Alpha test process</p> 108 <img class="user_guide_chart" src="assets/write_test_alpha_test.png" alt="Alpha test"/> 109 <h2>Stencil test</h2> 110 <p>The <I>Stencil test</I> compares the stencil buffer value against a reference stencil value to determine whether to use that fragment.</p> 111 <p class="hint_warn">Caution:<br /> In CreativeStudio, the Stencil test settings are configured on the material <B>Properties</B> panel in Details mode.</p> 112 <ul> 113 <li>If the comparison conditions are not fully satisfied, the fragment is removed as a rendering target.</li> 114 <li>A fragment that fully satisfies the comparison conditions is passed on to the Depth test.<br /> The fragment is in the "pass-through" state.</li> 115 </ul> 116 <p>If a fragment has passed through, its value can be used to update the stencil buffer.</p> 117 <p class="new_hint">Usage:<br /> The stencil test is primarily used for masking to limit the region being rendered.</p> 118 <h3>Stencil Test Comparison Functions</h3> 119 <p>The Stencil test involves equations that are used to compare the stencil buffer value with a reference value.</p> 120 <p>With CreativeStudio, you can select from eight different comparison functions.</p> 121 <p>Table 3 The different Stencil test comparison functions</p> 122 <table> 123 <thead> 124 <tr> 125 <th>Comparison function</th> 126 <th>Function Name</th> 127 <th>Description</th> 128 </tr> 129 </thead> 130 <tbody> 131 <tr> 132 <th>All fail</th> 133 <th>NEVER</th> 134 <td>Never passes.</td> 135 </tr> 136 <tr> 137 <th>All pass</th> 138 <th>ALWAYS</th> 139 <td>Always passes.</td> 140 </tr> 141 <tr> 142 <th>Pass if less than the stencil buffer value</th> 143 <th>LESS</th> 144 <td>Passes if the reference value is less than the stencil buffer value.</td> 145 </tr> 146 <tr> 147 <th>Pass if less than or equal to stencil buffer value</th> 148 <th>L_EQUAL</th> 149 <td>Passes if the reference value is less than or equal to the stencil buffer value.</td> 150 </tr> 151 <tr> 152 <th>Pass if equal to stencil buffer value</th> 153 <th>EQUAL</th> 154 <td>Passes if the reference value is equal to the stencil buffer value.</td> 155 </tr> 156 <tr> 157 <th>Pass if greater than or equal to stencil buffer value</th> 158 <th>G_EQUAL</th> 159 <td>Passes if the reference value is greater than or equal to the stencil buffer value.</td> 160 </tr> 161 <tr> 162 <th>Pass if greater than stencil buffer value</th> 163 <th>GREATER</th> 164 <td>Passes if the reference value is greater than the stencil buffer value.</td> 165 </tr> 166 <tr> 167 <th>Pass if not equal to stencil buffer value</th> 168 <th>NOT_EQUAL</th> 169 <td>Passes if the reference value is not equal to the stencil buffer value.</td> 170 </tr> 171 </tbody> 172 </table> 173 <p>Fig. 2 The Stencil test process</p> 174 <img class="user_guide_chart" src="assets/write_test_stencil_test.png" alt="Stencil test"/> 175 <h4>Detailed Control of the Stencil Test</h4> 176 <h5>Test mask</h5> 177 <p>You can specify a range of values for the Stencil test by using a test mask.</p> 178 <p>The default value is 255, which specifies the entire range.</p> 179 <h5>Process for Stencil test and Depth test results</h5> 180 <p>You can configure which processes to run on the Stencil test and Depth test results.</p> 181 <p>Table 4 Results of Stencil test and Depth test</p> 182 <table> 183 <thead> 184 <tr> 185 <th>Item</th> 186 <th>Description</th> 187 </tr> 188 </thead> 189 <tbody> 190 <tr> 191 <th>When the stencil test fails</th> 192 <td>This is the processing when a fragment fails the stencil test. Subsequent <em>depth test</em> processing is not carried out.</td> 193 </tr> 194 <tr> 195 <th>When the depth test fails</th> 196 <td>This is the processing when a fragment has been determined for use by the stencil test, but fails the depth test.</td> 197 </tr> 198 <tr> 199 <th>When the depth test succeeds</th> 200 <td>This is the processing when a fragment has been determined for use by both the stencil test and depth test.</td> 201 </tr> 202 </tbody> 203 </table> 204 <p>When the above applies for the test results, CreativeStudio lets you select from the following eight functions to operate on the stencil value.</p> 205 <p>Table 5 Functions that can operate on stencil values</p> 206 <table> 207 <thead> 208 <tr> 209 <th>Item</th> 210 <th>Function Name</th> 211 <th>Description</th> 212 </tr> 213 </thead> 214 <tbody> 215 <tr> 216 <th>Store current value</th> 217 <th>KEEP</th> 218 <td>This is the default setting. Stores the current stencil value. The stencil buffer value is not updated.</td> 219 </tr> 220 <tr> 221 <th>Replace with zero</th> 222 <th>ZERO</th> 223 <td>Updates the stencil buffer value to 0.</td> 224 </tr> 225 <tr> 226 <th>Replace with reference value</th> 227 <th>REPLACE</th> 228 <td>Updates the stencil buffer value using the stencil test reference value.</td> 229 </tr> 230 <tr> 231 <th>Increase (extreme: clamp) </th> 232 <th>INCR</th> 233 <td>Increases the stencil buffer value by 1.<br /> The stencil value is clamped to 0 or 1 less than the nth power of 2. (Where n is the number of bits of the stencil buffer.)</td> 234 </tr> 235 <tr> 236 <th>Increase (extreme: wraparound) </th> 237 <th>INCR_WRAP</th> 238 <td>Increases the stencil buffer value by 1.<br /> However, if the stencil buffer value exceeds 1 and is increased, the value is wrapped.</td> 239 </tr> 240 <tr> 241 <th>Decrease (extreme: clamp) </th> 242 <th>DECR</th> 243 <td>Decreases the stencil buffer value by 1.<br /> The stencil value is clamped to 0 or 1 less than the nth power of 2. (Where n is the number of bits of the stencil buffer.)</td> 244 </tr> 245 <tr> 246 <th>Decrease (extreme: wraparound) </th> 247 <th>DECR_WRAP</th> 248 <td>Decreases the stencil buffer value by 1.<br /> However, if the stencil buffer value exceeds 0 and is decreased, the value is wrapped.</td> 249 </tr> 250 <tr> 251 <th>Invert all bits</th> 252 <th>INVERT</th> 253 <td>Inverts the stencil buffer value at the bit unit level.</td> 254 </tr> 255 </tbody> 256 </table> 257 <h2>Depth test</h2> 258 <p>The <I>Depth test</I> compares the depth value of a fragment against a depth value in the depth buffer to determine whether to use that fragment.</p> 259 <ul> 260 <li>If the comparison conditions are not fully satisfied, the fragment is removed as a rendering target.</li> 261 <li>A fragment the fully satisfies the comparison conditions passes the test.</li> 262 </ul> 263 <p> Fragments that have passed through the Depth test undergo a blender process and are written to the framebuffer.</p> 264 <p>If <CODE>depth mask</CODE> has been enabled, the depth buffer can be updated using the depth value of a fragment that has passed through.</p> 265 <p class="new_hint">Usage:<br /> This is usually used for hidden surface removal, in which hidden polygons are excluded from processing.</p> 266 <h3>Depth Test Comparison Functions</h3> 267 <p>The Depth test involves equations that are used to compare the Depth value with the value in the depth buffer.</p> 268 <p>With CreativeStudio, you can select from eight different comparison functions.</p> 269 <p>Table 6 The different Depth test comparison functions</p> 270 <table> 271 <thead> 272 <tr> 273 <th>Comparison function</th> 274 <th>Function Name</th> 275 <th>Description</th> 276 </tr> 277 </thead> 278 <tbody> 279 <tr> 280 <th>Depth value < Depth buffer value</th> 281 <th>LESS</th> 282 <td>Passes test if the depth value of the fragment is less than the depth buffer value.</td> 283 </tr> 284 <tr> 285 <th>Depth value ≦ Depth buffer value</th> 286 <th>L_EQUAL</th> 287 <td>Passes test if the depth value of the fragment is less than or equal to the depth buffer value.</td> 288 </tr> 289 <tr> 290 <th>Depth value = Depth buffer value</th> 291 <th>EQUAL</th> 292 <td>Passes test if the depth value of the fragment is equal to the depth buffer value.</td> 293 </tr> 294 <tr> 295 <th>Depth value ≧ Depth buffer value</th> 296 <th>G_EQUAL</th> 297 <td>Passes test if the depth value of the fragment is greater than or equal to the depth buffer value.</td> 298 </tr> 299 <tr> 300 <th>Depth value > Depth buffer value</th> 301 <th>GREATER</th> 302 <td>Passes test if the depth value of the fragment is greater than the depth buffer value.</td> 303 </tr> 304 <tr> 305 <th>Depth value ≠ Depth buffer value</th> 306 <th>NOT_EQUAL</th> 307 <td>Passes test if the depth value of the fragment is not equal to the depth buffer value.</td> 308 </tr> 309 <tr> 310 <th>Pass-through all</th> 311 <th>ALWAYS</th> 312 <td>Always passes the test.</td> 313 </tr> 314 <tr> 315 <th>Pass-through none</th> 316 <th>NEVER</th> 317 <td>Never passes the test.</td> 318 </tr> 319 </tbody> 320 </table> 321 <p>Fig. 3 The Depth test process</p> 322 <img class="user_guide_chart" src="assets/write_test_depth_test.png" alt="Depth test"/> <!-- InstanceEndEditable --> </div> 323 <div class="footer" /> 324</div> 325<hr><p>CONFIDENTIAL</p></body> 326<!-- InstanceEnd --> 327</html>