unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

unity pixel

In our first 2D Pixel Perfect guide for retro games, we showed you how to set up the 2D Pixel Perfect tool and how 8-bit graphics were made back in the day. In this post, we fast-forward to the 16-bit era. With the help of Mega Cat Studios, you’ll learn how to create authentic art for Sega Genesis (or Mega Drive) and Super NES-style games using Unity settings, graphics structures, and color palettes.

在我们的第一本复古游戏2D Pixel Perfect指南中,我们向您展示了如何设置2D Pixel Perfect工具以及如何制作8位图形。 在这篇文章中,我们快进到16位时代。 在Mega Cat Studios的帮助下,您将学习如何使用Unity设置,图形结构和调色板为Sega Genesis(或Mega Drive)和Super NES风格的游戏创建真实的艺术品。

Mega Cat Studios has turned the creation of highly accurate retro games into an art form. So much so, in fact, that several of their titles can also be acquired in cartridge form and played on retro consoles like the Sega Genesis.

Mega Cat Studios 已将高度准确的复古游戏的创作转变为一种艺术形式。 如此之多,事实上,他们的一些头衔也可以盒装形式获得,并可以在Sega Genesis等复古游戏机上播放 。

使用2D Pixel Perfect进行复古游戏 (Using 2D Pixel Perfect for retro games)

Before you plunge into this post, we recommend you familiarize yourself with our previous retro guide, where we covered the 2D Pixel Perfect settings and how to recreate 8-bit-style graphics. 

在您投入这篇文章之前,我们建议您熟悉我们 之前的复古指南 ,其中涵盖了2D Pixel Perfect设置以及如何重新创建8位样式的图形。

With Unity 2019.2, 2D Pixel Perfect is now part of the 2D Renderer, which is in the Lightweight Render Pipeline (LWRP) package. 2D Pixel Perfect also exists as a standalone package (with the same functionality) for creators who don’t use LWRP. For this guide, we’ll show you how to set up the project in LWRP. 

在Unity 2019.2中,2D Pixel Perfect现在已成为2D渲染器的一部分,该2D渲染器位于轻量级渲染管线(LWRP)软件包中。 对于不使用LWRP的创作者,2D Pixel Perfect也作为独立软件包(具有相同功能)存在。 对于本指南,我们将向您展示如何在LWRP中设置项目。

在Unity 2019.2和LWRP中设置新项目 (Setting up a new project in Unity 2019.2 and LWRP)

  1. In the Unity Hub, click New, select 2D, then name your project. 

    在Unity Hub中,单击“新建”,选择 2D ,然后为您的项目命名。

2. To import the 2D Pixel Perfect package, click the Window menu in the toolbar and select Package Manager. In the pop-up window, select the Lightweight RP package, making sure you get version 6.9.0 or higher.

2.要导入2D Pixel Perfect软件包,请单击工具栏中的“窗口”菜单,然后选择“ 软件包管理器” 。 在弹出窗口中,选择 Lightweight RP 软件包,确保获得6.9.0或更高版本。

3. Next, you will configure the 2D Renderer in the Editor and create a new Pipeline Asset. In the Project window, right-click the Assets view and select Create > Rendering > Lightweight Render Pipeline > Pipeline Asset.

3.接下来,您将在编辑器中配置2D渲染器并创建一个新的管道资产。 在“项目”窗口中,右键单击“资产”视图,然后选择“ 创建”>“渲染”>“轻量级渲染管道”>“管道资产”

4. In the Assets view of the Project window, create a new 2D Renderer by right-clicking and selecting Create > Rendering > Lightweight Render Pipeline > 2D Renderer.

4 在“项目”窗口的“资源”视图中,右键单击并选择“ 创建”>“渲染”>“轻量级渲染管道”>“ 2D渲染器” ,以创建一个新的2D渲染

5. Select the Pipeline Asset you created. Select General, then change the Renderer Type from Forward Renderer to Custom.

5.选择您创建的管道资产。 选择“ 常规” ,然后将“渲染器类型”从“ 正向渲染器”更改为“ 自定义”

6. Assign the 2D Renderer you created to the data field.

6.将创建的2D渲染器分配给数据字段。

7. In the Graphics settings, set your Scriptable Render Pipeline Settings to use the new Pipeline Asset you created.

7.在“图形”设置中,将“脚本渲染管道设置”设置为使用您创建的新管道资产。

The 2D Renderer should now be configured, including the 2D Pixel Perfect Camera.

现在应该配置2D渲染器,包括2D Pixel Perfect Camera。

In Unity 2019.2, 2D Sprites can have a “Sprite-Lit” material, which allows them to react to 2D lighting conditions. If you are not using 2D lights in your project, make sure you have material that doesn’t require 2D Lights to make the Sprites visible, in which case you can change the material to “Sprites-Default.”

在Unity 2019.2中,2D Sprite可以具有“ Sprite-Lit”材质,使它们能够对2D光照条件做出React。 如果您在项目中未使用2D灯光,请确保您使用不需要2D灯光才能使Sprite可见的材质,在这种情况下,您可以将材质更改为“ Sprites-Default”。

为16位图形样式设置Pixel Perfect (Setting up Pixel Perfect for 16-bit graphic styles)

You need to add the Pixel Perfect Camera component to your Main Camera. We recommend checking Run In Edit Mode.

您需要将Pixel Perfect Camera组件添加到主摄像机。 我们建议选中在编辑模式下运行。

The Sega Genesis console has a resolution of 320×224 px (or a grid of 40×28 tiles of 8×8 pixels). That is the NTSC version. The Super NES has a resolution of 256×224 (30×28 tiles of 8×8 pixels) also in its NTSC version.

世嘉 控制台有 320×224像素 的分辨率 (或者8×8像素40×28瓷砖的网格 )。 那是NTSC版本。 在其NTSC版本中 , Super NES 的分辨率也为 256×224(30×28像素的8×8像素)。

Using a height resolution of 224 px and designing assets with 8 PPU is recommended for both graphic styles.

对于这两种图形样式,建议使用224 px的高度分辨率并使用8 PPU设计资产。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

Using a reference Sprite (shown is a full-screen 320×224 image from Sonic the Hedgehog for the Sega Genesis), you can observe how the Sprite at 8 pixels per unit (PPU) fits into a Scene view of the same resolution and PPU.

使用参考Sprite(显示为Sega Genesis的《刺猬索尼克》的全屏320×224图像),您可以观察到每单位8像素(PPU)的Sprite如何适合相同分辨率和PPU的场景视图。

If you need a refresher on what each option does in the 2D Pixel Perfect Camera component, see our previous retro game blog post.

如果您需要重新了解2D Pixel Perfect Camera组件中每个选项的功能,请参阅我们 以前的复古游戏博客文章

创作真实的创世纪风格艺术品 (Creating authentic Genesis-style artwork)

In this section, we’re going to cover the workflow for creating artwork that mimics the look of different consoles, as we did in our NES blog post. There are fewer restrictions than in an 8-bit project and more freedom with color, but the Genesis has its own limitations. We also think it’s important to explain how the original hardware works so you can apply those limitations to your own retro project.

在本节中,我们将介绍创建美术作品的工作流程,该美术作品模仿不同控制台的外观,就像在 NES博客文章中 所做的那样 。 与8位项目相比,限制更少,颜色*度更高,但是Genesis有其自身的局限性。 我们还认为,解释原始硬件的工作原理很重要,这样您就可以将这些限制应用于自己的复古项目。

调色板和子调色板 (Palettes and sub-palettes)

Making the jump from 8- to 16-bit consoles gives you more options on more-sophisticated hardware. That said, the fundamentals of doing great NES artwork still apply. All of the graphics are still stored in 8×8 tiles, for instance, and then assembled into larger images, whether they’re Sprites or background elements. You still need to work within limited sub-palettes with a common transparent color, although 16 bits offers greater freedom in palettes in some ways. You will likely be relieved to hear that 16-bit consoles generally do not have a hard-coded color palette like their 8-bit counterparts, which means the available colors are greatly expanded from the NES. 

从8位控制台过渡到16位控制台,您可以在更复杂的硬件上获得更多选择。 也就是说,制作出色的NES艺术品的基本原则仍然适用。 例如,所有图形仍然存储在8×8的图块中,然后组合成更大的图像,无论它们是Sprites还是背景元素。 尽管16位在某些方面为调色板提供了更大的*度,但您仍然需要在具有通用透明颜色的有限子调色板中工作。 听到16位控制台通常没有像8位控制台那样的硬编码调色板时,您可能会感到欣慰,这意味着NES可以提供​​的颜色大大扩展了。

Next, the Genesis boasts sub-palettes that contain 15 colors plus the common color used for Sprite transparency and layer transparency. One of the weaknesses of designing art for Genesis comes from the sub-palettes, though. Sub-palettes can be freely assigned to either Sprites or background tiles, but the Genesis only allows four sub-palettes to be used at a time. Because of this, artists must be mindful of which colors are being used in a sub-palette so that they can be maximized for both Sprite and background use. A sub-palette for the Genesis usually contains colors that are being used by both backgrounds and Sprites in order to fit everything in cleanly.

接下来,Genesis拥有包含15种颜色的子调色板,以及用于Sprite透明度和图层透明度的常用颜色。 但是,为创世纪设计艺术的弱点之一来自子调色板。 可以将子面板*分配给Sprites或背景图块,但Genesis一次仅允许使用四个子面板。 因此,美术师必须注意子调色板中使用的是哪种颜色,以便可以在Sprite和背景使用中最大化它们。 创世记的子调色板通常包含背景和Sprite都使用的颜色,以使所有内容都完全适合。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

Above is a Genesis scene and below are the sub-palettes used.

上面是创世纪场景,下面是所使用的子调色板。

To create for any 16-bit platform, you need to work with an indexed palette. For this, Gimp can be an open-source alternative to Photoshop that allows a lot of indexed palette manipulation.

要为任何16位平台创建,您需要使用索引调色板。 为此,Gimp可以成为Photoshop的开源替代品,它可以进行很多索引调色板操作。

To create the indexed palette in Gimp, go to Image > Mode > Indexed… 

要在Gimp中创建索引调色板,请转到 图像>模式>索引

The Indexed Color Conversion window appears.

出现“索引颜色转换”窗口。

Set the Maximum number of colors to 15. You can use automatic dithering patterns, but these tend to look better when they’re created manually.

将最大颜色数设置为 15 。 您可以使用自动抖动模式,但是在手动创建时,它们看起来会更好。

The image’s colors are now indexed. This information is automatically saved with the image so that the color index can be used. If you need to change the order of the colors in the index, you can simply right-click the color map and select Rearrange Colormap…

现在将索引图像的颜色。 该信息会自动与图像一起保存,以便可以使用颜色索引。 如果需要更改索引中颜色的顺序,只需右键单击颜色图,然后选择“ 重新排列 颜色图”即可

A pop-up menu appears, allowing you to drag and drop colors into a new order.

出现一个弹出菜单,允许您将颜色拖放到新顺序中。

One popular trick for creating greater color depth is to control the palette along a specified raster line, much as parallax scrolling was achieved on the NES. The Genesis is capable of changing the sub-palette selections for the artwork along a specified raster line. This trick is frequently used to create the illusion that part of a level is underwater. The “underwater” colors are added to a completely separate sub-palette selection, and the sub-palette selection is loaded once a certain raster line is rendered on-screen.

创建更大的色彩深度的一种流行技巧是沿着指定的光栅线控制调色板,就像在NES上实现了视差滚动一样。 Genesis能够沿着指定的栅格线更改艺术品的子调色板选择。 这个技巧经常被用来制造一种幻想,即一个关卡的一部分在水下。 “水下”颜色将添加到完全独立的子调色板选择中,并且一旦在屏幕上呈现了特定的光栅线,就会加载子调色板选择。

在原始硬件上基于图块的存储和加载 (Tile-based storage and loading on the original hardware)

In general, 16-bit consoles do not load graphics tiles in the same way as 8-bit consoles do. 8-bit consoles will load Sprite and background tiles separately and in large chunks of data to avoid using a lot of processing power, while 16-bit consoles have the processing power for greater flexibility. They can load and swap out individual tiles on the fly, allowing you to load in only the graphics you need when you need them. This allows a greater range of artwork to be used within a single level or screen of a game. 

通常,16位控制台的加载方式与8位控制台的不同。 8位控制台将分别以大量数据加载Sprite和背景图块,以避免使用大量处理能力,而16位控制台具有处理能力,可提供更大的灵活性。 它们可以动态加载和交换单个图块,从而允许您仅在需要时加载所需的图形。 这允许在游戏的单个关卡或屏幕中使用更大范围的艺术品。

Another aspect that’s unique to the Genesis/Mega Drive is that graphic tile and palette data are not the only things being loaded into the console’s VRAM during the game. That can make designing art for the console tricky because the number of graphic tiles that can be loaded into memory at a given time varies depending on what else is going on in the game. Generally speaking, most games will allow enough space to load in ~1000 tiles, and if there is a dynamic element then the tiles can always be swapped in and out freely.

Genesis / Mega Drive的另一个独特之处在于,在游戏过程中,图形拼贴和调色板数据并不是唯一要加载到控制台VRAM中的东西。 这可能会使控制台的设计艺术变得棘手,因为在给定时间可以加载到内存中的图形块的数量根据游戏中发生的其他事件而变化。 一般而言,大多数游戏会留出足够的空间来加载约1000个图块,并且如果有动态元素,则图块始终可以*交换。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

Tiles loaded into memory in the previous scene. The large blank space in the middle and the artifacts at the bottom are space to allocate enemies and other game elements in memory.

在前一场景中将切片加载到内存中。 中间的大空白和底部的文物是用于在内存中分配敌人和其他游戏元素的空间。

Although a greater range of available tiles can be loaded into VRAM at once, most of the time that extra freedom gets reserved for the Sprites, to allow for more varied animations and more types of Sprites on-screen at once. That means the basic design philosophy of using repeating segments of tiles tends to still be used a lot in 16-bit art so that the background doesn’t take up too much of the available space. The resolutions of the NES, Genesis, and SNES are all pretty similar, so 16×16 segments tend to be the starting point for these kinds of designs.

尽管可以立即将更大范围的可用图块加载到VRAM中,但是大多数时候大多数时候都会为Sprite保留额外的*度,以允许同时在屏幕上显示更多种类的动画和更多类型的Sprite。 这意味着使用重复的图块片段的基本设计原理在16位艺术中仍然经常使用,因此背景不会占用太多可用空间。 NES,Genesis和SNES的分辨率都非常相似,因此16×16片段往往是此类设计的起点。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

Here the artist used a pattern of clean 32×32 blocks to create the majority of the walkable space in the background.

在这里,艺术家使用干净的32×32块图案在背景中创建了大部分可步行空间。

使用背景图层 (Working with background layers)

The Genesis/Mega Drive allows for two background layers to be active at once on the screen. This means that layered elements are more readily available for designing backgrounds. That said, it’s still only two layers, so the artist and developer might have to rely on some raster-line tricks in order to create greater depth in a scene. Luckily, because all of those can go onto a second layer, designers are free to place foreground objects in front of the background without breaking the illusion. 

Genesis / Mega Drive允许在屏幕上一次**两个背景层。 这意味着分层元素更容易用于设计背景。 也就是说,它仍然只有两层,因此艺术家和开发人员可能必须依靠一些栅格线技巧才能在场景中创建更大的深度。 幸运的是,由于所有这些都可以进入第二层,因此设计师可以*地将前景对象放置在背景前面,而不会破坏幻觉。

Having a second layer also makes the use of Sprite-priority tricks to create foreground objects obsolete. Instead of having to repeatedly change Sprite priorities on the fly, now you can simply set the second background layer to display in front of the player, although more advanced layering might still require quick manipulation of Sprite priorities. The second background pane also features a sub-pane that can be used for heads-up displays (HUDs). The sub-pane will be locked in place and never scroll.

拥有第二层还使得使用Sprite-priority技巧无法创建前景对象。 现在,您不必设置动态更改Sprite优先级的方法,只需将第二个背景层设置为显示在播放器的前面即可,尽管更高级的分层可能仍需要快速操作Sprite优先级。 第二个背景窗格还具有可用于平视显示器(HUD)的子窗格。 子窗格将被锁定到位,并且永远不会滚动。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

Due to the game’s top-down view, special tiles needed to be created for the tree in order to manipulate Sprite layer order.

由于游戏的自上而下视图,因此需要为树创建特殊的图块以操纵Sprite图层顺序。

精灵限制 (Sprite limitations)

When you work with Sprites there is greater freedom when making the jump to 16-bit. The Genesis/Mega Drive lets you have 80 Sprites on-screen at a time and about 20 on a single horizontal line before it stops rendering any new Sprites. Beyond that, Sprites are no longer counted as individual 8×8 tiles. The Genesis is capable of generating single Sprites made of multiple tiles. These can be as small as a single tile and as large as 4×4 tiles in size. Anything larger than that would still require making it out of multiple Sprites.

当您使用Sprites时,跳转到16位时会有更大的*度。 通过Genesis / Mega Drive,您一次可以在屏幕上显示80个Sprite,在一条水平线上大约可以看到20个Sprite,然后再停止渲染任何新的Sprite。 除此之外,精灵不再被视为单独的8×8瓦片。 Genesis能够生成由多个图块组成的单个Sprite。 这些大小可以小至单个图块,大至4×4图块。 大于此值的任何内容仍需要使用多个Sprite制作。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

The final boss uses a large number of animated background elements, layers, and lots of Sprites. None of this would be possible on an 8-bit platform.

最终的老板使用了大量的动画背景元素,图层和大量的Sprite。 在8位平台上,这都是不可能的。

抖动模式和对比度 (Dithering patterns and contrast)

One of the defining features of 16-bit era artwork is the use of dithering. Games back then were displayed on CRT monitors, where pixels on-screen had a tendency to bleed into one another. Artists would take advantage of this fact by using dithering patterns in the artwork, so when one pixel bled into another in a repeating pattern it created the illusion of having more colors than were actually available. To this day, dithering is heavily used in pixel art, despite upgrades in our displays, to maintain an accurate aesthetic.

16位时代艺术品的定义特征之一是使用抖动。 当时的游戏都显示在CRT监视器上,屏幕上的像素往往会相互渗出。 艺术家可以通过在艺术品中使用抖动模式来利用这一事实,因此,当一个像素以重复的模式渗入另一个像素时,就会产生一种幻觉,即拥有比实际可用颜色更多的颜色。 时至今日,尽管我们的显示器进行了升级,但抖动仍在像素艺术中大量使用,以保持准确的美感。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

Dithering was used prominently in 16-bits. On a CRT, the pattern of pixels would blend together creating new colors or transparency effects that were not otherwise possible.

抖动主要用于16位。 在CRT上,像素的图案会融合在一起,从而创造出新的颜色或透明度效果,而这在其他方面是不可能的。

Of the two major 16-bit consoles, the Genesis/Mega Drive displays its colors with much greater contrast. This is also something you need to be aware of when choosing your sub-palettes. Making something with more muted and dull tones won’t end up looking quite how it’s expected to when it comes to actually rendering the image on hardware. Art should generally be created with a high-contrast color palette so the final result will stay in line with the artist’s original vision.

在两个主要的16位控制台中,Genesis / Mega Drive以更大的对比度显示其颜色。 在选择子调色板时,也需要注意这一点。 用更柔和和暗淡的色调制作东西最终不会看起来像在硬件上实际渲染图像时的预期效果。 通常应使用高对比度的调色板来创作艺术,这样最终的结果将与艺术家的原始视觉保持一致。

创建真实的SNES风格的艺术品 (Creating authentic SNES-style artwork)

For Super NES projects, we are still working with 8×8 pixels in size tiles/grid, so working with repeatable tiles is extremely useful. Generally speaking, these will be in some multiple of eight.

对于Super NES项目,我们仍在使用8×8像素大小的图块/网格,因此使用可重复图块非常有用。 一般来说,它们将是八分之一的倍数。

色彩调色板 (Color palette)

The first fundamental difference between the Genesis/Mega Drive and the SNES pertains to the color palette. Much like the Mega Drive, the SNES does not have a hard-coded color palette, so you can choose their colors. 

Genesis / Mega Drive与SNES之间的第一个基本区别在于调色板。 就像Mega Drive一样,SNES没有硬编码的调色板,因此您可以选择它们的颜色。

The tricky thing about the SNES is that it uses 5 bits per pixel (BPP) colors, which aren’t very common today. You can address this by using Gimp to create artwork, then you can simply posterize the image to 32 shades of RGB, which will work out to 5 BPP colors, even if you didn’t save the image as such. This allows your image colors to display accurately on the console.

SNES的棘手之处在于它使用5位每像素(BPP)的颜色,这在今天并不常见。 您可以使用Gimp创建图稿来解决此问题,然后可以简单地将图像后代化为32种RGB阴影,即使您不保存图像,它也可以处理5种BPP颜色。 这样可以使您的图像颜色准确地显示在控制台上。

You can find this option in Gimp under Colors > Posterize… A pop-up window appears, where you can set the Posterize levels to 32 to create 5 BPP-compatible colors.

您可以在Gimp的“ 颜色”>“海报化” 下找到此选项。 出现一个弹出窗口,您可以在其中将“海报化”级别设置为32,以创建5种BPP兼容颜色。

屏幕分辨率注意事项 (Screen-resolution considerations)

The next big difference between the two systems pertains to screen resolution. Since SNES is the successor of NES, the two systems share similar screen resolutions. The internal resolution of the SNES is 256×224. This allows any images that are being rendered to display within the safe zones of most CRT televisions, so none of the image will be cut off. This resolution never changes, so this will be the image size an artist will need to use as a reference.

两种系统之间的下一个重大区别在于屏幕分辨率。 由于SNES是NES的后继产品,因此两个系统共享相似的屏幕分辨率。 SNES的内部分辨率为256×224。 这允许将要渲染的任何图像显示在大多数CRT电视的安全区域内,因此不会剪切任何图像。 该分辨率永远不会改变,因此这将是艺术家需要用作参考的图像大小。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

This image is set to use the full-screen resolution of the SNES, which is used in most of the screen modes.

此图像设置为使用SNES的全屏分辨率,该分辨率在大多数屏幕模式中都使用。

原始硬件的屏幕模式 (Screen modes of the original hardware)

This section provides a quick reference to what the various screen modes have to offer.

本节提供了各种屏幕模式必须提供的快速参考。

The most significant difference between the systems is that the SNES can render background graphics in seven different screen modes. The SNES is capable of rendering a total of 256 colors on-screen at one time in a single sub-palette in certain screen modes. Here are some of the most popular screen modes:

系统之间最显着的区别是SNES可以在七个不同的屏幕模式下渲染背景图形。 SNES能够在某些屏幕模式下的单个子调色板中一次在屏幕上渲染总共256种颜色。 以下是一些最受欢迎的屏幕模式:

  • Mode 1: This is one of the most commonly used screen modes for the SNES. It boasts the best average showing of the console’s capabilities. Mode 1 allows you to have three background layers where two of them have their own 16-color sub-palette, and the final layer has a 4-color sub-palette.

    模式1: 这是SNES最常用的屏幕模式之一。 它拥有控制台功能的最佳平均显示。 模式1允许您具有三个背景层,其中两个背景层具有自己的16色子调色板,最后一层具有4色子调色板。

  • Mode 3: This mode is generally used for larger static images like title screens and story screens. It boasts two background planes. The first uses a full 256-color sub-palette, and the second allows for a 16-color sub-palette.

    模式3: 此模式通常用于较大的静态图像,例如标题屏幕和故事屏幕。 它拥有两个背景飞机。 第一个使用完整的256色子调色板,第二个使用16色的子调色板。

  • Mode 7: This was one of the main features of the SNES. It was shown off in most of the promotional material for the console, Mode 7 was the first time that a home console was able to apply transformations to an image in real-time, allowing scaling, rotation, stretching, and skewing in the background plane. This was used to create the pseudo-3D effects seen in a lot of racing and flight games for SNES. 

    模式7: 这是SNES的主要功能之一。 在控制台的大多数宣传材料中都展示了此模式,模式7是家用控制台首次能够将变换实时应用于图像,从而允许在背景平面中缩放,旋转,拉伸和倾斜。 这用于创建在SNES的许多赛车和飞行游戏中看到的伪3D效果。

The single background plane in Mode 7 is handled much differently than all other screen modes to allow these features to work. First, there is only a single 256-color background plane to work with, which means that all Sprites need to share their colors with the sub-palette of the background plane. Next, instead of working with the normal screen size of the SNES, a Mode 7 background plane is 1024×1024 pixels in size. It is then sized and adjusted to fit the screen however the designer wants.

模式7中的单个背景平面与所有其他屏幕模式的处理方式大不相同,以允许这些功能正常工作。 首先,只有一个256色背景平面可以使用,这意味着所有Sprite都需要与背景平面的子调色板共享其颜色。 接下来,代替使用SNES的正常屏幕尺寸,模式7背景平面的尺寸为1024×1024像素。 然后根据设计人员的需要调整大小和调整以适合屏幕。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

The office uses Mode 1 with one sub-palette (the other two are for the UI). The Thanks for Playing screen uses Mode 3, which allowed the artist to take advantage of a 256-color palette.

办公室使用模式1和一个子选板(其他两个用于UI)。 感谢播放屏幕使用模式3,该模式允许艺术家利用256色调色板。

精灵大小 (Sprite sizes)

After the complexity of the background screen modes, the rules for Sprites are relatively simple. The SNES has multiple different Sprite modes, much like the Mega Drive did, but with the hard limitation of only being able to use two different Sprite modes for the entirety of the game. 

在复杂的背景屏幕模式之后,“精灵”的规则相对简单。 SNES具有多种不同的Sprite模式,就像Mega Drive一样,但是有一个严格的限制,即只能在整个游戏中使用两种不同的Sprite模式。

Sprites can be 8×8, 16×16, 32×32 or 64×64. Not only that, but designers must choose from a predetermined list of Sprite size combinations. Games on the SNES can include the following combinations:

子画面可以是8×8、16×16、32×32或64×64。 不仅如此,设计人员还必须从预定的Sprite尺寸组合列表中进行选择。 SNES上的游戏可以包括以下组合:

  • 8×8, 16×16

    8×8、16×16

  • 8×8, 32×32

    8×8、32×32

  • 8×8, 64×64

    8×8、64×64

  • 16×16, 32×32

    16×16、32×32

  • 16×16, 64×64

    16×16、64×64

  • 32×32, 64×64

    32×32、64×64

These sizes are “set in stone” once you choose them, and all Sprites in the game must conform to them. The SNES is capable of rendering 32 Sprites on a single horizontal raster line at a time, but boasts a hefty 128 Sprite limit on what can be shown on-screen at a time. Anything beyond that will not be rendered on-screen.

一旦选择这些大小,它们就会“固定”,并且游戏中的所有Sprite都必须符合它们。 SNES一次可以在一条水平栅格线上渲染32个Sprite,但是一次只能在屏幕上显示128 Sprite限制。 超出此限制的任何内容将不会在屏幕上呈现。

unity pixel_2D Pixel Perfect:如何为复古的16位游戏设置Unity项目

Fork Parker’s Crunch-Out used a combination of 32×32 and 16×16 for all of the Sprites in the game.

Fork Parker的Crunch-Out对游戏中的所有Sprite都使用了32×32和16×16的组合。

Sprites have eight 16-color sub-palettes to work with. Much like all retro consoles, the first color of any sub-palette is a common shared color that’s used for transparency. The extensive quantity of sub-palettes compared to the other consoles covered gives you greater freedom when choosing colors for Sprites. You just need to keep in mind that there’s a hard 256-color limit.

Sprite具有八个可使用的16色子调色板。 与所有复古控制台一样,任何子调色板的第一种颜色是用于透明度的常见共享颜色。 与涵盖的其他控制台相比,大量的子调色板为Sprites选择颜色时提供了更大的*度。 您只需要记住有一个严格的256色限制。

下一步 (Next steps)

We hope you enjoyed this post on how to create 8- and 16-bit retro games using 2D Pixel Perfect in the latest version of Unity.

我们希望您喜欢这篇文章,了解如何在最新版本的Unity中使用2D Pixel Perfect创建8位和16位复古游戏。

We’re not done with 2D Pixel Perfect yet, as the feature will be verified for production in Unity 2019.3, and will also be more compatible with Cinemachine 2D.

我们尚未使用2D Pixel Perfect,因为该功能将在Unity 2019.3中进行生产验证,并且还将与Cinemachine 2D兼容。

Let us know how your own 2D Pixel Perfect project goes, and don’t forget to visit the 2D forum to engage with the Unity community and 2D development team.

让我们知道您自己的2D Pixel Perfect项目进展如何,不要忘了访问 2D论坛 与Unity社区和2D开发团队互动。

翻译自: https://blogs.unity3d.com/2019/08/02/2d-pixel-perfect-how-to-set-up-your-unity-project-for-retro-16-bit-games/

unity pixel