[转载]等角(斜45度)游戏与数学

简介: 原文链接:http://www.javaeye.com/articles/1225 1984年欧洲的玩家被一款当时发布的游 Knight Lore 震惊了。这款2d游戏居然相当真实的模拟了3d环境,而当时游戏的发布平台是 ZX Spectrum, 48K的内存。

原文链接:http://www.javaeye.com/articles/1225

1984年欧洲的玩家被一款当时发布的游 Knight Lore 震惊了。这款2d游戏居然相当真实的模拟了3d环境,而当时游戏的发布平台是 ZX Spectrum, 48K的内存。这个技术就是isometric perspective(等角投影) 。后来大菠萝、最终幻想等游戏均采用了这种投影技术。点击在新窗口中浏览此图片
等角投影是指在一定范围内,投影面上任何点上两个微分线段组成的角度投影前后保持不变的一类投影。任何点上二微分线段组成的角度投影前后保持不变的一类投影。是角度和形状保持正确的投影,也称正形投影。这种投影类型不同于真3D常见的透视投影,并不以物体对摄像头的远近关系而对其缩放,x,y和z轴的投影角度均为120度。但是出于计算机渲染像素图像图形的特性,和开发方便,很多游戏实际上使用的是二等角投影。
由等角坐标变换到屏幕坐标可以参考这个公式:
点击在新窗口中浏览此图片
由屏幕坐标变换到等角坐标:
点击在新窗口中浏览此图片
以下文章摘自http://www.compuphase.com/axometr.htm:
The figure below shows a cube in the isometric projection as defined by ISO 5456-3.The first object from the left in the figure is the cube unadorned; the second object is the same cube with angles and measures annotated around it. The third and fourth graphics are the top and side views of the perspective scene and they give the camera position that fits the perspective view. The camera position is what you would feed into a 3D renderer (or ray tracer) to create the sprites or tiles for the isometric projection.
点击在新窗口中浏览此图片
Computer games with isometric maps are often tile-based. To make tiles match, the game designer must take into account how diagonal lines are plotted in discrete steps (Bresenham and all that). As it turns out, a line at 30 degrees (sine is 0.5) produces steps that are too irregular. A line at an angle where the tangent is 0.5 does have a nice regular pattern: two steps to the right, one step up. Thus, the isometric projection used by most games tilt the x- and z-axes with approximately 27 degrees (the exact angle is "arctangent(0.5)"). By the way, because the tangent of the angle of the rhombus is 0.5, the rhombus is twice as wide as it is high. This is why many sources mention a 1:2 scale for isometric perspectives. (To make the edges of the rhombuses match, the width of the rhombus should be a multiple of four pixels and the height should be one pixel less than ½ width. In other words, the height:width ratio of a rhombus is usually not exactly 1:2, but rather near 1:2.1. This makes no difference for the principles of the isometric perspective.)
Again, the figure below shows what this isometric projection looks like.
点击在新窗口中浏览此图片
Flash游戏采用等角投影的有PlayFish的餐厅(需要FQ):

 

目录
相关文章
|
JavaScript
Bert-vits2-v2.2新版本本地训练推理整合包(原神八重神子英文模型miko)
近日,Bert-vits2-v2.2如约更新,该新版本v2.2主要把Emotion 模型换用CLAP多模态模型,推理支持输入text prompt提示词和audio prompt提示语音来进行引导风格化合成,让推理音色更具情感特色,并且推出了新的预处理webuI,操作上更加亲民和接地气。
Bert-vits2-v2.2新版本本地训练推理整合包(原神八重神子英文模型miko)
|
7月前
|
传感器 人工智能 物联网
穿戴科技新风尚:智能服装设计与技术全解析
穿戴科技新风尚:智能服装设计与技术全解析
546 85
|
7月前
|
编解码 监控 网络协议
RTSP协议规范与SmartMediaKit播放器技术解析
RTSP协议是实时流媒体传输的重要规范,大牛直播SDK的rtsp播放器基于此构建,具备跨平台支持、超低延迟(100-300ms)、多实例播放、高效资源利用、音视频同步等优势。它广泛应用于安防监控、远程教学等领域,提供实时录像、快照等功能,优化网络传输与解码效率,并通过事件回调机制保障稳定性。作为高性能解决方案,它推动了实时流媒体技术的发展。
358 5
|
Java 关系型数据库 MySQL
Java中文乱码浅析及解决方案
Java中文乱码浅析及解决方案
|
7月前
|
数据采集 Web App开发 API
B站高清视频爬取:Python爬虫技术详解
B站高清视频爬取:Python爬虫技术详解
|
Dart
Flutter笔记:手动配置VSCode中Dart代码自动格式化
Flutter笔记:手动配置VSCode中Dart代码自动格式化
1420 5
|
12月前
|
存储 关系型数据库 MySQL
四种数据库对比MySQL、PostgreSQL、ClickHouse、MongoDB——特点、性能、扩展性、安全性、适用场景
四种数据库对比 MySQL、PostgreSQL、ClickHouse、MongoDB——特点、性能、扩展性、安全性、适用场景
|
UED iOS开发 异构计算
用阿里云无影电脑玩《黑神话·悟空》的最佳实践
近期,国产3A游戏《黑神话·悟空》引爆朋友圈,但对于使用MacBook Pro的玩家来说,因设备限制难以畅玩。本文提供了一种解决方案:利用阿里云无影云电脑服务。用户需首先下载无影客户端,订购具备显卡功能的套餐,并通过加载特定镜像快速安装游戏,避免长时间下载。此外,玩家还需根据自身需求配置云电脑参数以降低延迟。尽管此方法可让Mac用户体验游戏,但若追求极致游戏体验,仍建议配备高性能PC。
3861 7
无影云电脑免安装黑神话悟空-直面天命
无影云电脑现已预装《黑神话:悟空》免去漫长下载等待,让您即刻享受游戏乐趣。
|
机器学习/深度学习 编解码 API
《黑神话:悟空》中的光线追踪与DLSS技术解析
【8月更文第26天】《黑神话:悟空》是一款备受期待的国产动作冒险游戏,它采用了先进的图形技术,包括实时光线追踪和NVIDIA DLSS(Deep Learning Super Sampling),以提供令人震撼的视觉效果和流畅的游戏体验。本文将深入探讨这两种技术在游戏中的应用及其背后的原理。
385 1