Metalを始める

以下を翻訳しました。DeepLで・・・。

www.raywenderlich.com

"In iOS 8, Apple released its own API for GPU-accelerated 3D graphics: Metal."

iOS 8では、AppleGPUで加速された3Dグラフィックスのための独自のAPIを公開しました。Metalです。

"Metal is similar to OpenGL ES in that it’s a low-level API for interacting with 3D graphics hardware."

Metalは、3Dグラフィックスハードウェアと対話するための低レベルAPIであるという点で、OpenGL ESに似ています。

"The difference is that Metal is not cross-platform. Instead, it’s designed to be extremely efficient with Apple hardware, offering improved speed and low overhead compared to using OpenGL ES."

違いは、Metalはクロスプラットフォームではないということです。その代わりに、Appleのハードウェアで非常に効率的に動作するように設計されており、OpenGL ESを使用する場合と比較して、速度が向上し、オーバーヘッドが低くなっています。


"In this tutorial, you’ll get hands-on experience using the Metal API to create a bare-bones app: drawing a simple triangle. In doing so, you’ll learn some of the most important classes in Metal, such as devices, command queues and more."

このチュートリアルでは、Metal API を使用して、シンプルな三角形を描画するという素のアプリを作成するための実践的な体験をします。その際、デバイスやコマンド キューなど、Metal の最も重要なクラスについて学びます。

"This tutorial is designed so that anyone can go through it, regardless of your 3D graphics background — however, things will move along fairly quickly. If you do have some prior 3D-programming or OpenGL experience, you’ll find things much easier, as many of the same concepts apply to Metal."

このチュートリアルは、3D グラフィックスの経験に関係なく、誰でも学習できるように設計されています。3D プログラミングや OpenGL の経験があれば、同じコンセプトの多くが Metal にも適用されるため、より簡単に学習できるでしょう。

"Note: Metal apps do not run on the iOS simulator; they require a device with an Apple A7 chip or later. To complete this tutorial, you’ll need an A7 device or newer."

注意:MetalアプリはiOSシミュレータ上では動作しません。このチュートリアルを完了するには、A7以降のデバイスが必要です。

Metal vs. SpriteKit, SceneKit or Unity

"Before you get started, it’ll be helpful to understand how Metal compares to higher-level frameworks like SpriteKit, SceneKit or Unity."

始める前に、Metal が SpriteKit、SceneKit、Unity などの高レベルフレームワークとどのように比較されているかを理解しておきましょう。

"Metal is a low-level 3D graphics API, similar to OpenGL ES, but with lower overhead meaning better performance. It’s a very thin layer above the GPU, which means that, in doing just about anything, such as rendering a sprite or a 3D model to the screen, it requires you to write all of the code to do this. The trade-off is that you have full power and control."

Metal は低レベルの 3D グラフィック API で、OpenGL ES に似ていますが、オーバーヘッドが低いためパフォーマンスが向上します。GPUの上に非常に薄い層があるため、スプライトや3Dモデルを画面にレンダリングするなど、何をするにしても、そのためのコードをすべて書く必要があります。トレードオフは、完全なパワーとコントロールが可能になることです。

"Conversely, higher-level game frameworks like SpriteKit, SceneKit and Unity are built on top of a lower-level 3D graphics APIs like Metal or OpenGL ES. They provide much of the boilerplate code you normally need to write in a game, such as rendering a sprite or 3D model to the screen."

逆に、SpriteKit、SceneKit、Unityのような高レベルのゲームフレームワークは、MetalやOpenGL ESのような低レベルの3DグラフィックスAPIの上に構築されています。これらのフレームワークは、スプライトや3Dモデルを画面にレンダリングするなど、ゲーム内で通常書く必要のある定型的なコードの多くを提供しています。

"If all you’re trying to do is make a game, you’ll probably use a higher-level game framework like SpriteKit, SceneKit or Unity most of the time because doing so will make your life much easier. If this sounds like you, we have tons of tutorials to help you get started with Apple Game Frameworks or Unity."

あなたがゲームを作ることだけをしようとしているのであれば、たいていの場合、SpriteKit、SceneKit、またはUnityのような高レベルのゲームフレームワークを使うことになるでしょう。このような場合、Apple Game Frameworks や Unity を使い始めるのに役立つチュートリアルがたくさんあります。

"However, there are still two really good reasons to learn Metal:"

しかし、Metal を学ぶには 2 つの理由があります。

"1.Push the hardware to its limits: Since Metal is at such a low level, it allows you to really push the hardware to its limits and have full control over how your game works."

1.ハードウェアの限界に挑戦すること。Metal は低レベルなので、ハードウェアを限界まで使いこなすことができ、ゲームの動作を完全にコントロールすることができます。

"2.It’s a great learning experience: Learning Metal teaches you a lot about 3D graphics, writing your own game engine, and how higher-level game frameworks work."

2.素晴らしい学習体験。Metal を学ぶことで、3D グラフィック、独自のゲーム エンジンの作成、高レベルのゲーム フレームワークの仕組みについて多くのことを学ぶことができます。

"If either of these sound like good reasons to you, keep reading!"

これらの理由のいずれかに当てはまる方は、読み進めてください。

Metal vs. OpenGL ES

"OpenGL ES is designed to be cross platform. That means you can write C++ OpenGL ES code, and, most of the time, with some small modifications, you can run it on other platforms, such as Android."

OpenGL ESは、クロスプラットフォーム向けに設計されています。つまり、C++OpenGL ESコードを書くことができ、ほとんどの場合、少しの修正で、Androidのような他のプラットフォームで実行することができます。

"Apple realized that, although the cross-platform support of OpenGL ES was nice, it was missing something fundamental to how Apple designs its products: the famous Apple integration of the operating system, hardware and software as a complete package."

Appleは、OpenGL ESのクロスプラットフォーム対応は素晴らしいものでしたが、Appleが製品を設計する上で基本的な何かが欠けていることに気づきました。

"So Apple took a clean-room approach to see what it would look like if it were to design a graphics API specifically for Apple hardware with the goal of being extremely low overhead and performant, while supporting the latest and greatest features."

そこで Apple は、最新かつ最高の機能をサポートしながら、非常に低いオーバーヘッドとパフォーマンスを目標に、Apple ハードウェア専用のグラフィックス API を設計した場合にどのようになるのかを確認するために、クリーンルーム アプローチを行いました。

"The result is Metal, which can provide up to 10✕ the number of draw calls for your app compared to OpenGL ES. This can result in some amazing effects — you may remember from the Zen Garden example in the WWDC 2014 keynote, as an example."

その結果、OpenGL ESと比較して、アプリのドローコール数を最大10✕倍にすることができるMetalが誕生しました。これにより、いくつかの驚くべき効果が得られる可能性があります。例として、WWDC 2014のキーノートでのZen Gardenの例を覚えているかもしれません。

"Time to dig right in and see some Metal code!"

さあ、さっそくMetalのコードを見てみましょう。

(続きはまた今度....)

Getting Started