OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2009, Google Inc. | 2 Copyright 2009, Google Inc. |
3 All rights reserved. | 3 All rights reserved. |
4 | 4 |
5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
6 modification, are permitted provided that the following conditions are | 6 modification, are permitted provided that the following conditions are |
7 met: | 7 met: |
8 | 8 |
9 * Redistributions of source code must retain the above copyright | 9 * Redistributions of source code must retain the above copyright |
10 notice, this list of conditions and the following disclaimer. | 10 notice, this list of conditions and the following disclaimer. |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 return output; | 506 return output; |
507 } | 507 } |
508 | 508 |
509 /** | 509 /** |
510 * The pixel shader returns a shade of gray. The lighter the shade the | 510 * The pixel shader returns a shade of gray. The lighter the shade the |
511 * farther that fragment is from the light. | 511 * farther that fragment is from the light. |
512 */ | 512 */ |
513 float4 pixelShaderFunction(PixelShaderInput input): COLOR { | 513 float4 pixelShaderFunction(PixelShaderInput input): COLOR { |
514 // Pixels in the shadowmap store the pixel depth from the light's | 514 // Pixels in the shadowmap store the pixel depth from the light's |
515 // perspective in normalized device coordinates. | 515 // perspective in normalized device coordinates. |
516 return float4(input.depth.x / input.depth.y); | 516 float t = input.depth.x / input.depth.y; |
| 517 return float4(t, t, t, 1); |
517 } | 518 } |
518 | 519 |
519 // #o3d VertexShaderEntryPoint vertexShaderFunction | 520 // #o3d VertexShaderEntryPoint vertexShaderFunction |
520 // #o3d PixelShaderEntryPoint pixelShaderFunction | 521 // #o3d PixelShaderEntryPoint pixelShaderFunction |
521 // #o3d MatrixLoadOrder RowMajor | 522 // #o3d MatrixLoadOrder RowMajor |
522 </script> | 523 </script> |
523 | 524 |
524 | 525 |
525 <script id="shadowColorShader" type="text/O3DShader"> | 526 <script id="shadowColorShader" type="text/O3DShader"> |
526 /** | 527 /** |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 <h1>Shadow Maps</h1> | 619 <h1>Shadow Maps</h1> |
619 This sample implements a basic shadow map. | 620 This sample implements a basic shadow map. |
620 <br/> | 621 <br/> |
621 <!-- Start of O3D plugin --> | 622 <!-- Start of O3D plugin --> |
622 <div id="o3d" style="width: 600px; height: 600px;"></div> | 623 <div id="o3d" style="width: 600px; height: 600px;"></div> |
623 <!-- End of O3D plugin --> | 624 <!-- End of O3D plugin --> |
624 Use A, S, D, W, I and O to move the light. | 625 Use A, S, D, W, I and O to move the light. |
625 Press spacebar to see the shadow map. | 626 Press spacebar to see the shadow map. |
626 </body> | 627 </body> |
627 </html> | 628 </html> |
OLD | NEW |