20,135
edits
(general review and minor rewrite of Occlusion section) |
(let's not rely on the image to tell the user what the coordinate system is) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Here we explain various aspects of Oni's graphical code. | Here we explain various aspects of Oni's graphical code, with introductions to basic computer graphics concepts and links to further reading. | ||
==Coordinate system== | |||
[[Image:3D coordinate systems with Oni added.jpg|right|300px]] | |||
In Oni's world, the Y axis is up, the X axis extends rightward, and the Z axis is depth, or "forward". This is referred to as a righthanded Y-up system, with the "hand" referring to a conventional mnemonic aid for keeping track of axes, pictured on the right. When compared with other game engines, Oni's coordinate system is not unusual, however it has a difference of opinion with Blender on the subject of which axis is up. Since Blender is now the 3D modeler most commonly used by modders, recent versions of our modding tool [[OniSplit]] have offered an argument, -blender, for converting between axis conventions automatically. Note that Oni has a BSL command, <tt>am_show_axes</tt>, for showing the world axes as a handy reference, except that it's ''wrong'', showing a lefthanded Z-up system, only used by Unreal Engine. | |||
==Environment mapping== | ==Environment mapping== | ||
| Line 28: | Line 32: | ||
;Field of view (FOV) | ;Field of view (FOV) | ||
:Oni defines the vertical field-of-view (FOV), i.e., the angle between the top and bottom planes of the frustum as measured at the camera's location, and its default value is 45°. On a 4:3 screen, the corresponding horizontal viewing angle is | :Oni defines the vertical field-of-view (FOV), i.e., the angle between the top and bottom planes of the frustum as measured at the camera's location, and its default value is 45°. On a 4:3 screen, the corresponding horizontal viewing angle is <tt>2 * arctan(4/3 * tan(45° / 2)) = '''57.8°'''</tt>. | ||
;Widescreen FOV | ;Widescreen FOV | ||
:On a 16:9 or 16:10 screen, the horizontal viewing angle for a vertical FOV of 45° is larger: | :On a 16:9 or 16:10 screen, the horizontal viewing angle for a vertical FOV of 45° is larger: <tt>2 * arctan(16/9 * tan(45° / 2)) = '''72.7°'''</tt> and <tt>2 * arctan(16/10 * tan(45° / 2)) = '''67.1°'''</tt>, respectively. This causes objects to show up in some of Oni's cutscenes which aren't meant to be seen, for example the opening cutscenes of {{C|2}}, {{C|11}}, and {{C|14}} (the camera even becomes blocked by a wall in Ch. 2). A quick way to fix this is to bring the horizontal viewing angle down to the intended '''57.8°''' during the cutscene: the 4:3 viewport will then effectively be trimmed vertically rather than extended sideways. On 16:9 and 16:10 screens, the corrected vertical FOV will be <tt>2 * arctan(3/4 * tan(45° / 2)) = '''34.5°'''</tt> and <tt>2 * arctan(5/6 * tan(45° / 2)) = '''38.1°'''</tt>, respectively. Remember to set it back to 45° after the cutscene to fully enjoy the extended viewport. (Note that the [[Anniversary Edition]] contains widescreen patches for some of the affected cutscenes, making this unnecessary.) | ||
==Occlusion== | ==Occlusion== | ||