Как добавить небо в юнити

от admin

Using skyboxes

In Unity, a skybox A special type of Material used to represent skies. Usually six-sided. More info
See in Glossary is a Material that uses a skybox Shader A program that runs on the GPU. More info
See in Glossary . For information on what skybox Shaders are available, see skybox Shaders.

Render pipeline compatibility

Feature Built-in Render Pipeline A series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
Universal Render Pipeline (URP) High Definition Render Pipeline (HDRP)
Skyboxes Yes (1) Yes (1) No (2)

Notes:

  1. The Built-in Render Pipeline, and the Universal Render Pipeline (URP) both exclusively use skyboxes to render a sky. These skyboxes are Materials that use a skybox Shader.
  2. The High Definition Render Pipeline (HDRP) does not support skybox Materials and instead includes multiple sky generation solutions.

Creating a skybox Material

To create a new skybox Material:

  1. From the menu bar, click Assets > Create > Material.
  2. In the Shader drop-down, click Skybox then the skybox Shader you want to use.
  3. You can now fill out the properties on the Material to set up the skybox. The properties available on the Material depend on the skybox Shader the Material uses.

Note: Each skybox Shader has its own set of prerequisite Textures that differ in number and Texture format A file format for handling textures during real-time rendering by 3D graphics hardware, such as a graphics card or mobile device. More info
See in Glossary . For information on the Textures a particular skybox Shader requires, see the documentation for that skybox Shader. You can find the list of skybox Shaders and their documentation on the skybox Shaders page.

Drawing a skybox in your Scene

After you create a skybox Material, you can render it in your Scene A Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary . To do this:

  1. From the menu bar, click Window > Rendering > Lighting Settings.
  2. In the window that appears, click the Environment tab.
  3. Assign the skybox Material to the Skybox Material property.

This draws the skybox in the background of every Camera A component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary in your Scene. If you instead only want to draw the skybox for a particular Camera, see Drawing a skybox for a particular Camera.

Using a skybox Material for ambient light settings

After you create a skybox Material, Unity can use it to generate ambient lighting in your Scene. To make Unity do this:

  1. Open the Lighting window (menu: Window > Rendering > Lighting Settings).
  2. Assign your chosen skybox to the Skybox Material property.
  3. Click the Source drop-down and, from the list, click Skybox.

You can also specify when Unity updates the ambient lighting. To do this, change the Ambient Mode. The two values are:

  • Realtime: Unity constantly regenerates ambient lighting for your Scene. This is useful if you alter the skybox at run-time
  • Baked: Unity only generates ambient lighting for your Scene when you click the Generate Lighting button at the bottom of the Lighting window. This is useful if your skybox does not change during run-time because it saves computational resources.

Drawing a skybox for a particular Camera

If you only want to draw a skybox in the background of a particular Camera, use the Skybox component. When you attach this component to a GameObject The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary with a Camera, it overrides the skybox that the Camera draws. To attach and set up the Skybox component:

  1. Select a Camera in your Scene and view it in the Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary window.
  2. Click Add Component > Rendering > Skybox.
  3. On the Skybox component, assign the skybox Material to the Custom Skybox property.

Best Practices

If your Skybox includes a sun, moon, or other light in it, set up a Directional Light that points in the same direction as the light. This makes it appear as though the light in your skybox creates shadows in your Scene. If there are multiple Directional Lights in your Scene, you can choose which Directional Light the Skybox uses. To do this:

  1. From the menu bar, click Window > Rendering > Lighting Settings.
  2. Click the Scene tab.
  3. Assign the Directional Light you want to use to the Sun Source property.

If you want to have fog in your Scene, match the fog color to the color of the skybox. This makes the fog blend to the color of the Scene sky. To do this:

Using skyboxes

In Unity, a skybox A special type of Material used to represent skies. Usually six-sided. More info
See in Glossary is a Material that uses a skybox Shader A program that runs on the GPU. More info
See in Glossary . For information on what skybox Shaders are available, see skybox Shaders.

Render pipeline compatibility

Feature Built-in Render Pipeline A series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
Universal Render Pipeline (URP) High Definition Render Pipeline (HDRP)
Skyboxes Yes (1) Yes (1) No (2)

Notes:

  1. The Built-in Render Pipeline, and the Universal Render Pipeline (URP) both exclusively use skyboxes to render a sky. These skyboxes are Materials that use a skybox Shader.
  2. The High Definition Render Pipeline (HDRP) does not support skybox Materials and instead includes multiple sky generation solutions.

Creating a skybox Material

To create a new skybox Material:

  1. From the menu bar, click Assets > Create > Material.
  2. In the Shader drop-down, click Skybox then the skybox Shader you want to use.
  3. You can now fill out the properties on the Material to set up the skybox. The properties available on the Material depend on the skybox Shader the Material uses.

Note: Each skybox Shader has its own set of prerequisite Textures that differ in number and Texture format A file format for handling textures during real-time rendering by 3D graphics hardware, such as a graphics card or mobile device. More info
See in Glossary . For information on the Textures a particular skybox Shader requires, see the documentation for that skybox Shader. You can find the list of skybox Shaders and their documentation on the skybox Shaders page.

Drawing a skybox in your Scene

After you create a skybox Material, you can render it in your Scene A Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary . To do this:

  1. From the menu bar, click Window > Rendering > Lighting Settings.
  2. In the window that appears, click the Environment tab.
  3. Assign the skybox Material to the Skybox Material property.

This draws the skybox in the background of every Camera A component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary in your Scene. If you instead only want to draw the skybox for a particular Camera, see Drawing a skybox for a particular Camera.

Using a skybox Material for ambient light settings

After you create a skybox Material, Unity can use it to generate ambient lighting in your Scene. To make Unity do this:

  1. Open the Lighting window (menu: Window > Rendering > Lighting Settings).
  2. Assign your chosen skybox to the Skybox Material property.
  3. Click the Source drop-down and, from the list, click Skybox.

You can also specify when Unity updates the ambient lighting. To do this, change the Ambient Mode. The two values are:

  • Realtime: Unity constantly regenerates ambient lighting for your Scene. This is useful if you alter the skybox at run-time
  • Baked: Unity only generates ambient lighting for your Scene when you click the Generate Lighting button at the bottom of the Lighting window. This is useful if your skybox does not change during run-time because it saves computational resources.

Drawing a skybox for a particular Camera

If you only want to draw a skybox in the background of a particular Camera, use the Skybox component. When you attach this component to a GameObject The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary with a Camera, it overrides the skybox that the Camera draws. To attach and set up the Skybox component:

  1. Select a Camera in your Scene and view it in the Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary window.
  2. Click Add Component > Rendering > Skybox.
  3. On the Skybox component, assign the skybox Material to the Custom Skybox property.

Best Practices

If your Skybox includes a sun, moon, or other light in it, set up a Directional Light that points in the same direction as the light. This makes it appear as though the light in your skybox creates shadows in your Scene. If there are multiple Directional Lights in your Scene, you can choose which Directional Light the Skybox uses. To do this:

  1. From the menu bar, click Window > Rendering > Lighting Settings.
  2. Click the Scene tab.
  3. Assign the Directional Light you want to use to the Sun Source property.

If you want to have fog in your Scene, match the fog color to the color of the skybox. This makes the fog blend to the color of the Scene sky. To do this:

Использование skyboxes в Unity3d

Skybox является панорамной текстурой, которая находится за всеми объектами в сцене, что бы симулировать небо или большой город или любую другую перспективу на большом расстоянии (своего рода фон). Этот урок объясняет, как использовать skybox в Unity.

Что такое Skyboxes?

Использование Skybox в Unity

Unity поставляется с рядом высококачественных Skybox в пакете Standard Assets (меню: Assets > Import Package > Skyboxes), но вы также можете подобрать подходящие наборы панорамных изображений из интернет-источников или создать свой собственный, используя программное обеспечение 3D-моделирования. Предполагаем, что вы уже имеете шесть текстур изображения для Skybox, вы должны импортировать их в Unity. После переходим к нашему skybox, затем переходим в панель Inspector. И устанавливаем его свойства, свойство Wrap Mode установим значение Clamp (если вы установите значение Repeat, края изображений не будут образовывать «бесшовную» текстуру).

image

Сам Skybox на самом деле тип материала, который использует один из шейдеров в подменю RenderFX. Если вы выберите Skybox Shader, вы увидите в панели инспектора (inspector), что то вроде следующего, с шестью примерами текстур:

image

Skybox Cubed шейдер работает в основном так же, но требует текстуры, которые будут добавлены к cubemap asset (меню:Assets > Create > Cubemap). Cubemap имеет шесть слотов текстур с теми же значения, как и Skybox в панели инспектора материалов (material inspector) .

После того, как он будет создан, вы можете установить новый Skybox, как Skybox по умолчанию (для всего проекта) в инспекторе настройки визуализации (меню: Edit> Render Settings). Вы можете переопределить Skybox по умолчанию для каждой камеры, назначив новый Skybox в компоненте Camera > Skybox (видно в инспекторе камеры).

Creating a Skybox in Unity

A quick guide about how to create a Skybox in Unity

Objective: Create and implement a Skybox using Unity.

In the last post I covered how to create a transparent window. Now, it’s time to create and implement a new Skybox that will give a new look to the horizon of a scene in Unity.

Creating the Skybox

We have the next scene in Unity, where a default Skybox gives this look in the scene:

In order to create the new Skybox we’re going to use the next 6 textures:

Now, let’s create a new material for the Skybox. Once created, let’s change the Shader that the material uses to Skybox > 6 Sided:

Then, let’s drag the textures into their respective slots through the inspector:

Implementing the Skybox

And now, in order to implement the new Skybox material into the scene, let’s open the Lighting tab at Window > Rendering > Lighting:

Once opened, drag the new material with the skybox into the Environment tab option that stores the Skybox material:

Once that the new material is in the respective slot we’ll be able to see the Skybox implemented in the scene. This Skybox will provide the lighting source by default:

And that’s it, we implemented a new Skybox for our scene in Unity! :D. I’ll see you in the next post, where I’ll be showing some aspects of a 3D environment with Unity.

Читать:
Нет функции уведомлять когда забыто

Похожие статьи