Cameras.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Introduction to Camera Entities</title>
  5. </head>
  6. <body>
  7. <center><h1><font face="Verdana">Introduction to Camera Entities</font></h1>
  8. </center>
  9. <p>
  10. <font face="Verdana">
  11. Cameras allow you to see what's going on in the 3D world. Without at least one camera, nothing that may be happening in the world will be rendered to the screen.</font></p>
  12. <p>
  13. <font face="Verdana">
  14. Cameras also control a number of other effects, including rendering range, zoom and fog.</font></p>
  15. <h2><font face="Verdana"><span style="background-color: #6097C9">&nbsp;Creating Cameras&nbsp;</span></font></h2>
  16. <p>
  17. <font face="Verdana">
  18. To create a camera, simply use the <b>CreateCamera</b> command:</font>
  19. </p>
  20. <table border="1" width="100%" bordercolor="#FFFFFF">
  21. <tr>
  22. <td width="14%">&nbsp;</td>
  23. <td width="72%" bordercolor="#000000" bgcolor="#C0C0C0">&nbsp;<br>
  24. &nbsp;&nbsp;&nbsp;&nbsp;<font face="Arial">;create a new camera!<br>
  25. &nbsp;&nbsp;&nbsp;&nbsp;<b>camera=CreateCamera()</b></font><br><br>
  26. </td>
  27. <td width="14%">&nbsp;</td>
  28. </tr>
  29. </table>
  30. <h2><font face="Verdana"><span style="background-color: #6097C9">&nbsp;Camera Viewport&nbsp;</span></font></h2>
  31. <p>
  32. <font face="Verdana">
  33. A camera needs to know where on screen its view of the world is to be rendered. This area of the screen is known as the camera viewport. By default, a new camera's viewport is set to the entire screen.</font></p>
  34. <p>
  35. <font face="Verdana">
  36. To change the camera viewport use the <b>CameraViewport</b> command:</font></p>
  37. <table border="1" width="100%" bordercolor="#FFFFFF">
  38. <tr>
  39. <td width="14%">&nbsp;</td>
  40. <td width="72%" bordercolor="#000000" bgcolor="#C0C0C0">&nbsp;<br>
  41. &nbsp;&nbsp;&nbsp;&nbsp;<font face="Arial">;Draw to top left corner of the screen<br>
  42. &nbsp;&nbsp;&nbsp;&nbsp;<b>CameraViewport camera,0,0,GraphicsWidth()/2,GraphicsHeight()/2</b></font><br><br>
  43. </td>
  44. <td width="14%">&nbsp;</td>
  45. </tr>
  46. </table>
  47. <h2><font face="Verdana"><span style="background-color: #6097C9">&nbsp;Camera Range&nbsp;</span></font></h2>
  48. <p>
  49. <font face="Verdana">
  50. Camera range determines how far into the distance a camera can 'see'. You specify 2 values for camera range - a near value and a far value. All rendering is clipped to this range.</font></p>
  51. <p>
  52. <font face="Verdana">
  53. Its a good idea to try and keep the near value as high as possible, while keeping the far value as low as possible. This helps to minimize z-buffer problems like 'jaggies'. By default, the near value for a new camera is 1, and the far value is 1000.</font></p>
  54. <p>
  55. <font face="Verdana">
  56. To change the camera range, use the <b>CameraRange</b> command:</font></p>
  57. <table border="1" width="100%" bordercolor="#FFFFFF">
  58. <tr>
  59. <td width="14%">&nbsp;</td>
  60. <td width="72%" bordercolor="#000000" bgcolor="#C0C0C0">&nbsp;<br>
  61. &nbsp;&nbsp;&nbsp;&nbsp;<font face="Arial">;Sets the near range to 5 and the far range to 5000<br>
  62. &nbsp;&nbsp;&nbsp;&nbsp;<b>CameraRange camera,5,5000</b></font><br><br>
  63. </td>
  64. <td width="14%">&nbsp;</td>
  65. </tr>
  66. </table>
  67. <h2><font face="Verdana"><span style="background-color: #6097C9">&nbsp;Camera Zoom&nbsp;</span></font></h2>
  68. <p>
  69. <font face="Verdana">
  70. Changing a cameras zoom allows you to 'zoom-in' or 'zoom-out' of the action in the world. The default zoom value for a new camera is 1. Zoom values greater than 1 will cause a 'zoom-in' effect, while zoom values less than 1 will cause a 'zoom-out'. Zoom values should never be set at 0 or less!</font></p>
  71. <p>
  72. <font face="Verdana">
  73. The <b>CameraZoom</b> command controls camera zoom:</font></p>
  74. <table border="1" width="100%" bordercolor="#FFFFFF">
  75. <tr>
  76. <td width="14%">&nbsp;</td>
  77. <td width="72%" bordercolor="#000000" bgcolor="#C0C0C0">&nbsp;<br>
  78. &nbsp;&nbsp;&nbsp;&nbsp;<font face="Arial">;Zoom-in a bit!<br>
  79. &nbsp;&nbsp;&nbsp;&nbsp;<b>CameraZoom camera,1.5</b></font><br><br>
  80. </td>
  81. <td width="14%">&nbsp;</td>
  82. </tr>
  83. </table>
  84. <h2><font face="Verdana"><span style="background-color: #6097C9">&nbsp;Fog Effects&nbsp;</span></font></h2>
  85. <p>
  86. <font face="Verdana">
  87. Blitz3D allows you to setup fog effects independently for each camera. This can be useful for limiting what a certain camera can see. For example, a racing game might use a camera for its rearview mirror. However, you might want to limit what is visible in the rearview mirror in order to keep the game running fast.</font></p>
  88. <p><font face="Verdana">To setup a simple fog effect for a camera, you might use something like this:</font></p>
  89. <table border="1" width="100%" bordercolor="#FFFFFF">
  90. <tr>
  91. <td width="14%">&nbsp;</td>
  92. <td width="72%" bordercolor="#000000" bgcolor="#C0C0C0">&nbsp;<br>
  93. &nbsp;&nbsp;&nbsp; &nbsp;<font face="Arial">;Sets the color of fog for this camera<br>
  94. &nbsp;&nbsp;&nbsp;&nbsp;<b>CameraFogColor camera,0,128,255</b><br><br>
  95. &nbsp;&nbsp;&nbsp;&nbsp;;Sets the near/far range of fog for this camera<br>
  96. &nbsp;&nbsp;&nbsp;&nbsp;<b>CameraFogRange camera,1,1000</b><br><br>
  97. &nbsp;&nbsp;&nbsp;&nbsp;;Sets the fog mode for this camera.<br>
  98. &nbsp;&nbsp;&nbsp;&nbsp;<b>CameraFogMode camera,1</b></font><br><br>
  99. </td>
  100. <td width="14%">&nbsp;</td>
  101. </tr>
  102. </table>
  103. <p>
  104. <font face="Verdana">
  105. Often, the fog range and camera range will be the same. However, by increasing the near value of fog, you can control how 'thick' fog appears to be. Smaller fog near values will result in a thicker fog effect, since the fog will start nearer to the camera.</font></p>
  106. <p>
  107. <font face="Verdana">
  108. Unfortunately, fog is not well supported on all graphics cards. While all cards can perform some kind of fog effect, the quality varies a lot. For this reason, its a good idea to make fog optional in your Blitz3D games.</font></p>
  109. <p><center>
  110. <font color="#666666" face="Verdana">Copyright 2001 (c) Paul Gerfen -
  111. GamecodingUK</font></center></p>
  112. </body>
  113. </html>