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"><!-- InstanceBegin template="/Templates/default_template.dwt" codeOutsideHTMLIsLocked="false" --> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5<meta http-equiv="Content-Style-Type" content="text/css" /> 6<!-- InstanceBeginEditable name="CSS の相対パス指定" --> 7<link href="../../../../common/manual.css" rel="stylesheet" type="text/css" /> 8<!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="ページのタイトル" --> 9<title>Write Test</title> 10<!-- InstanceEndEditable --> 11</head> 12<body> 13<div> 14 <div class="body"> <!-- InstanceBeginEditable name="本文のタイトル" --> 15 <h1>Write Test</h1> 16 <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="本文" --> 17 <p>This section describes the <em>write test</em> process used on generated fragment information to determine if a fragment should be written to the framebuffer.</p><!-- #BeginLibraryItem "/Library/glossary_frame_buffer.lbi" --> <!-- フレームバッファ ( frame_buffer ) --> 18 <p>The <I>framebuffer</I> is a memory region for temporarily storing data output from the fragment shader.<br /> Values for fragments for which processing by fragment using the blender has ended are stored here.</p> 19 <p>The table below gives an overview of the three <I>buffers</I> that collectively make up the framebuffer.</p> 20 <table> 21 <thead> 22 <tr> 23 <th>Buffer Type</th> 24 <th>Usage</th> 25 </tr> 26 </thead> 27 <tbody> 28 <tr> 29 <th>Color Buffer</th> 30 <td>Renders fragment values that contain color and alpha values.</td> 31 </tr> 32 <tr> 33 <th>Stencil Buffer</th> 34 <td>Stores information that limits the area being rendered. This is used during stencil tests.</td> 35 </tr> 36 <tr> 37 <th>Depth Buffer</th> 38 <td>Stores information about the depth from the camera. This is used during depth tests.</td> 39 </tr> 40 </tbody> 41 </table> 42 <!-- #EndLibraryItem --><h2>Types of Write Test</h2><!-- #BeginLibraryItem "/Library/glossary_write_test.lbi" --> <!-- 書き込みテスト ( write_test) --> 43 <p>The <I>write test</I> takes generated fragment information as a reference value and determines whether to actually write it to the framebuffer. This is carried out for each fragment. Specify the standard by which to judge fragments in CreativeStudio. Fragments that do not meet the standard are excluded from rendering.</p> 44 <p>The table below lists the conditions by which a fragment is judged during blending.</p> 45 <table> 46 <thead> 47 <tr> 48 <th>Conditions</th> 49 <th>Description</th> 50 </tr> 51 </thead> 52 <tbody> 53 <tr> 54 <th>Alpha test</th> 55 <td>An <I>alpha test</I> compares a fragment's alpha value with the reference value set for the alpha test.</td> 56 </tr> 57 <tr> 58 <th>Stencil test</th> 59 <td>A <I>stencil test</I> compares the value set for the fragment stencil test with the value in the <I>stencil buffer</I> to write to. If the fragment passes, the value in the stencil buffer is overwritten with the fragment value.</td> 60 </tr> 61 <tr> 62 <th>Depth test</th> 63 <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. If the fragment passes, the value in the depth buffer is overwritten with the fragment value.</td> 64 </tr> 65 </tbody> 66 </table> 67 <p class="hint"><I>Write tests</I> are carried out in alpha test → depth test → stencil test order.</p> 68 <!-- #EndLibraryItem --><h3>Alpha test</h3><!-- #BeginLibraryItem "/Library/glossary_alpha_test.lbi" --> <!-- アルファテスト ( alpha_test ) --> 69 <p>The <em>alpha test</em> compares the alpha values of fragments against a reference value to determine which fragments to use.<br /> If the test results do not satisfy conditions, the fragment is removed as a rendering target.<br /> Fragments that meet the conditions pass the alpha test and will be used, so their status is shown as <em>passed</em>. <br />Fragments that have passed this test are handed on to the Stencil Test process. <br />This is used to express translucency in textures and other images that use alpha values.</p> 70 <!-- #EndLibraryItem --><h4>Alpha Test Comparison Functions</h4><!-- #BeginLibraryItem "/Library/glossary_alpha.lbi" --> <!-- アルファ値 ( alpha ) --> 71<p>The <I>alpha value</I> is information stored in a fragment that indicates that fragment's transparency.<br /> The values range from 0 (<I>fully transparent</I>) to 1 (<I>fully opaque</I>).</p> 72<!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/glossary_alpha_test_reference_value.lbi" --><!-- アルファテストの参照値 ( alpha_test_reference_value --> 73<p>The <em>alpha test reference value</em> is a value that can be set using CreativeStudio for comparison with the alpha value for each fragment.</p><!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/glossary_alpha_test_comparison_function.lbi" --> <!-- アルファテストの比較関数 ( alpha_test_comparison_function ) --> 74 <p>The <em>alpha test comparison function</em> is a formula used to compare the reference value with the alpha value of each fragment.<br /> With CreativeStudio, you can select from eight different comparison functions.</p> 75 <!-- #EndLibraryItem --><p>The table below gives the different alpha test comparison functions and a description of each.</p> 76 <table> 77 <thead> 78 <tr> 79 <th>Comparison function</th> 80 <th>Function Name</th> 81 <th>Description</th> 82 </tr> 83 </thead> 84 <tbody> 85 <tr> 86 <th>All fail</th> 87 <th>NEVER</th> 88 <td>Never passes.</td> 89 </tr> 90 <tr> 91 <th>All pass</th> 92 <th>ALWAYS</th> 93 <td>Always passes.</td> 94 </tr> 95 <tr> 96 <th>Pass if less than the reference value</th> 97 <th>LESS</th> 98 <td>Passes if the fragment alpha value is less than the reference value.</td> 99 </tr> 100 <tr> 101 <th>Pass if less than or equal to the reference value</th> 102 <th>L_EQUAL</th> 103 <td>Passes if the fragment alpha value is less than or equal to the reference value.</td> 104 </tr> 105 <tr> 106 <th>Pass if equal to the reference value</th> 107 <th>EQUAL</th> 108 <td>Passes if the fragment alpha value is equal to the reference value.</td> 109 </tr> 110 <tr> 111 <th>Pass if greater than or equal to the reference value</th> 112 <th>G_EQUAL</th> 113 <td>Passes if the fragment alpha value is greater than or equal to the reference value.</td> 114 </tr> 115 <tr> 116 <th>Pass if greater than the reference value</th> 117 <th>GREATER</th> 118 <td>Passes if the fragment alpha value is greater than the reference value.</td> 119 </tr> 120 <tr> 121 <th>Pass if not equal to the reference value</th> 122 <th>NOT_EQUAL</th> 123 <td>Passes if the fragment alpha value is not equal to the reference value.</td> 124 </tr> 125 </tbody> 126 </table> 127 <p>The table figure below depicts the flow of the alpha test process.</p> 128 <img class="user_guide_chart" src="assets/write_test_alpha_test.png" alt="Alpha test"/> 129 <h3>Stencil test</h3><!-- #BeginLibraryItem "/Library/glossary_stencil_test.lbi" --> <!-- ステンシルテスト ( stencil_test )--> 130 <p>The <em>stencil test</em> compares the value in the stencil buffer with a stencil reference value to determine which fragments to use.<br /> If the test results do not satisfy conditions, the fragment is removed as a rendering target.<br /> Fragments that meet the conditions pass the alpha test and will be used, so their status is shown as <em>passed</em>. <br />Fragments that have passed through are handed on to the depth test process.<br />In addition, the stencil buffer can be updated using the value for a fragment that has passed through. <br /> The stencil test is primarily used by the <em>mask process</em>, which limits the region to be rendered.</p> 131 <!-- #EndLibraryItem --><h4>Stencil Test Comparison Functions</h4><!-- #BeginLibraryItem "/Library/glossary_stencil_test_reference_value.lbi" --> <!-- ステンシルテストの参照値 ( stencil_test_reference_value --> 132 <p>The <em>stencil test reference value</em> is a value that can be set using CreativeStudio for comparison with the value in the stencil buffer.</p><!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/glossary_stencil_buffer.lbi" --><!-- ステンシルバッファ ( stencil_buffer ) --> 133 <p>The <I>stencil buffer</I> is a memory region that stores a <I>mask</I> limiting the region to be rendered stored in the fragment.</p> <!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/glossary_stencil_test_comparison_function.lbi" --> <!-- ステンシルテストの比較関数 ( stencil_test_comparison_function ) --> 134 <p>The <em>stencil test comparison function</em> is a formula used to compare the reference value with the value in the stencil buffer.<br /> With CreativeStudio, you can select from eight different comparison functions.</p> 135 <!-- #EndLibraryItem --><p>The table below gives the different stencil test comparison functions and a description of each.</p> 136 <table> 137 <thead> 138 <tr> 139 <th>Comparison function</th> 140 <th>Function Name</th> 141 <th>Description</th> 142 </tr> 143 </thead> 144 <tbody> 145 <tr> 146 <th>All fail</th> 147 <th>NEVER</th> 148 <td>Never passes.</td> 149 </tr> 150 <tr> 151 <th>All pass</th> 152 <th>ALWAYS</th> 153 <td>Always passes.</td> 154 </tr> 155 <tr> 156 <th>Pass if less than the stencil buffer value</th> 157 <th>LESS</th> 158 <td>Passes if the reference value is less than the stencil buffer value.</td> 159 </tr> 160 <tr> 161 <th>Pass if less than or equal to stencil buffer value</th> 162 <th>L_EQUAL</th> 163 <td>Passes if the reference value is less than or equal to the stencil buffer value.</td> 164 </tr> 165 <tr> 166 <th>Pass if equal to stencil buffer value</th> 167 <th>EQUAL</th> 168 <td>Passes if the reference value is equal to the stencil buffer value.</td> 169 </tr> 170 <tr> 171 <th>Pass if greater than or equal to stencil buffer value</th> 172 <th>G_EQUAL</th> 173 <td>Passes if the reference value is greater than or equal to the stencil buffer value.</td> 174 </tr> 175 <tr> 176 <th>Pass if greater than stencil buffer value</th> 177 <th>GREATER</th> 178 <td>Passes if the reference value is greater than the stencil buffer value.</td> 179 </tr> 180 <tr> 181 <th>Pass if not equal to stencil buffer value</th> 182 <th>NOT_EQUAL</th> 183 <td>Passes if the reference value is not equal to the stencil buffer value.</td> 184 </tr> 185 </tbody> 186 </table> 187 <h4>Detailed Control of the Stencil Test</h4> 188 <p>With the stencil test, you can specify in detail the range of stencil values to be tested using the value set for the <em>test mask</em>. The default value is 255, which specifies the entire range.</p> 189 <h4>Processing After Stencil Test and Depth Test Comparison</h4> 190 <p>It is possible to determine at the fragment level what to do with the frame buffer regarding fragments that have been determined for use by the stencil test.<br /> To update the stencil buffer value, the result of both the stencil test and the depth test are required.</p> 191 <p>The possible results for a given fragment when using a comparison test that combines the stencil test and depth test have been gathered together in the following table.</p> 192 <table> 193 <thead> 194 <tr> 195 <th>Item</th> 196 <th>Description</th> 197 </tr> 198 </thead> 199 <tbody> 200 <tr> 201 <th>When the stencil test fails:</th> 202 <td>This is the processing when a fragment fails the stencil test. Subsequent <em>depth test</em> processing is not carried out.</td> 203 </tr> 204 <tr> 205 <th>When the depth test fails:</th> 206 <td>This is the processing when a fragment has been determined for use by the stencil test, but failes the depth test.</td> 207 </tr> 208 <tr> 209 <th>When the depth test succeeds:</th> 210 <td>This is the processing when a fragment has been determined for use by both the stencil test and depth test.</td> 211 </tr> 212 </tbody> 213 </table> 214 <p>The stencil buffer value existing in the same location as the associated fragment can be updated based on the result of stencil test and depth test comparison. With CreativeStudio, you can select the operation to perform for the stencil value at this time from one of eight different functions</p> 215 <p>The following table lists the functions that can be used on stencil values.</p> 216 <table> 217 <thead> 218 <tr> 219 <th>Item</th> 220 <th>Function Name</th> 221 <th>Description</th> 222 </tr> 223 </thead> 224 <tbody> 225 <tr> 226 <th>Store current value</th> 227 <th>KEEP</th> 228 <td>This is the default setting. Stores the current stencil value. The stencil buffer value is not updated.</td> 229 </tr> 230 <tr> 231 <th>Replace with zero</th> 232 <th>ZERO</th> 233 <td>Updates the stencil buffer value to 0.</td> 234 </tr> 235 <tr> 236 <th>Replace with reference value</th> 237 <th>REPLACE</th> 238 <td>Updates the stencil buffer value using the stencil test reference value.</td> 239 </tr> 240 <tr> 241 <th>Increase (extreme clamping) </th> 242 <th>INCR</th> 243 <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> 244 </tr> 245 <tr> 246 <th>Increase (extreme wraparound) </th> 247 <th>INCR_WRAP</th> 248 <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> 249 </tr> 250 <tr> 251 <th>Decrease (extreme clamping) </th> 252 <th>DECR</th> 253 <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> 254 </tr> 255 <tr> 256 <th>Decrease (extreme wraparound) </th> 257 <th>DECR_WRAP</th> 258 <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> 259 </tr> 260 <tr> 261 <th>Invert all bits</th> 262 <th>INVERT</th> 263 <td>Inverts the stencil buffer value at the bit unit level.</td> 264 </tr> 265 </tbody> 266 </table><!-- #BeginLibraryItem "/Library/glossary_bit.lbi" --> <!-- ビット単位 ( bit ) --> 267 <p>A <em>bit unit</em> is the minimum unit of data handled.</p> 268<!-- #EndLibraryItem --><p>The table figure below depicts the flow of the stencil test process.</p> 269 <img class="user_guide_chart" src="assets/write_test_stencil_test.png" alt="Stencil test"/> 270 <h3>Depth test</h3><!-- #BeginLibraryItem "/Library/glossary_depth_test.lbi" --> <!-- デプステスト ( depth_test ) --> 271 <p>The term <em>depth test</em> refers to the process used to determine fragments to be used based on the result of comparing the depth value of the fragment with the depth value of the depth buffer.<br /> If the test results do not satisfy conditions, the fragment is removed as a rendering target.<br /> If test results satisfy conditions, the status of fragments selected for use are said to have <em>passed</em>. Fragments that have passed through undergo a blender process and are written to the frame buffer. The depth buffer can also be updated using the depth values of fragments that have passed by enabling a <em>depth mask</em>. This is usually used in <I>hidden surface removal</I>, when hidden polygons are excluded from processing.</p> 272 <!-- #EndLibraryItem --><h4>Depth Test Comparison Functions</h4><!-- #BeginLibraryItem "/Library/glossary_depth.lbi" --> <!-- デプス値 ( depth ) --> 273<p>The <I>depth value</I> is information stored in a fragment that indicates that fragment's distance from the camera. This is also called depth information.<br /> <I>Small</I> values indicate that the fragment is closer to the viewpoint, while <I>large</I> values indicate that the fragment is farther away.</p> 274<!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/glossary_depth_buffer.lbi" --> <!-- デプスバッファ ( depth buffer ) --> 275 <p>The <I>depth buffer</I> is a memory region for storing depth values.</p> 276 <!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/glossary_depth_test_comparison_function.lbi" --> <!-- デプステストの比較関数 ( depth_test_comparison_function ) --> 277 <p>The <em>depth test comparison function</em> is a formula used to compare the depth buffer value with the depth value of each fragment.<br /> With CreativeStudio, you can select from eight different comparison functions.</p> 278 <!-- #EndLibraryItem --><p>The table below gives the different depth test comparison functions and a description of each.</p> 279 <table> 280 <thead> 281 <tr> 282 <th>Comparison function</th> 283 <th>Function Name</th> 284 <th>Description</th> 285 </tr> 286 </thead> 287 <tbody> 288 <tr> 289 <th>All fail</th> 290 <th>NEVER</th> 291 <td>Never passes.</td> 292 </tr> 293 <tr> 294 <th>All pass</th> 295 <th>ALWAYS</th> 296 <td>Always passes.</td> 297 </tr> 298 <tr> 299 <th>Pass if less than depth buffer value</th> 300 <th>LESS</th> 301 <td>Passes if the depth value of the fragment is less than the depth buffer value.</td> 302 </tr> 303 <tr> 304 <th>Pass if less than or equal to depth buffer value</th> 305 <th>L_EQUAL</th> 306 <td>Passes if the depth value of the fragment is less than or equal to the depth buffer value.</td> 307 </tr> 308 <tr> 309 <th>Pass if equal to depth buffer value</th> 310 <th>EQUAL</th> 311 <td>Passes if the depth value of the fragment is equal to the depth buffer value.</td> 312 </tr> 313 <tr> 314 <th>Pass if greater than or equal to depth buffer value</th> 315 <th>G_EQUAL</th> 316 <td>Passes if the depth value of the fragment is greater than or equal to the depth buffer value.</td> 317 </tr> 318 <tr> 319 <th>Pass if greater than depth buffer value</th> 320 <th>GREATER</th> 321 <td>Passes if the depth value of the fragment is greater than the depth buffer value.</td> 322 </tr> 323 <tr> 324 <th>Pass if not equal to depth buffer value</th> 325 <th>NOT_EQUAL</th> 326 <td>Passes if the depth value of the fragment is not equal to the depth buffer value.</td> 327 </tr> 328 </tbody> 329 </table> 330 <p>The figure below shows how the depth test works.</p> 331 <img class="user_guide_chart" src="assets/write_test_depth_test.png" alt="Depth test"/> 332 <h3>Write Test Performance</h3><!-- #BeginLibraryItem "/Library/performance_write_test.lbi" --><!-- 書き込みテストのパフォーマンス ( performance_write_test ) --> 333 <p>Using write tests increases processor load. Consequently, all fragment tests and operations are disabled by default. 334</p><!-- #EndLibraryItem --><!-- InstanceEndEditable --> </div> 335 <div class="footer" /> 336</div> 337<hr><p>CONFIDENTIAL</p></body> 338<!-- InstanceEnd --></html> 339