Unity Skybox 6 Sided

0 views
Skip to first unread message

Hadi Sapre

unread,
Aug 4, 2024, 6:25:26 PM8/4/24
to atsereve
Ihave a small image (32x32) and I would like to tile it and use the tiled version for a side in a 6 sided skybox. I can easily use it as a texture and get a single image to show up for each side of the skybox, but I want the entire side to be tiled. I tried to create a tiled material, but after I have the material (which is tiled) I cannot use it in the 6 sided skybox because it is not a texture. Is there a way to tile a skybox if I only have one piece of the pattern.

This skyboxA special type of Material used to represent skies. Usually six-sided. More info

See in Glossary ShaderA program that runs on the GPU. More info

See in Glossary generates a skybox from six separate Textures. Each texture represents a view of the sky along a particular world axis. To illustrate this, think of the SceneA 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 as being inside a cube. Each Texture represents one of the interior faces of the cube and all six combine to create a seamless environment.


EDIT: I have tried simply putting a camera in the center of the scene and rotating it at 90 degree angles, and rendering to a square texture. However, the texture edges are not aligned, so I think I can assume that the field of view is wrong.


Prior to beginning, you must have set up an Environment material to render, or have set up a surrounding scene to capture. Once that is done, you set resolution of the render to a square texture, preferably with a power-of-two size (I set it to 1024).


Once the environment or scene is set up and ready to capture, the first step is to open the camera object's properties, and just below the Perspective/Orthographic/Panoramic selectors, you change the Lens Units from Millimeters to Field of View, and then set the field on the left to 90 degrees.


After that, set the camera's position to the center of the grid (0,0,0 coords), and set its rotation so that it is facing straight forward (rotation 90,0,0). Then render, and save it as the Front texture.


Then rotate 90 degrees counterclockwise, and render as the "Right" texture (even though the camera is facing left). Rotate 90 degrees counterclockwise again, and render that as the "Back" texture. Rotate 90 degrees counterclockwise again, and render that as the "Left" texture.


Rotate 90 degrees counterclockwise again, and then you're back at the starting position. Rotate the camera 90 degrees to point upwards (exact rotation should be 180,0,0), and render that as the "Up" texture. Then rotate the camera 180 degrees to point downwards (exact rotation is 0,0,0) and render that as the "Down" texture.


After that, fire up the Unity3D editor. Import each of the textures (which should be named according to direction). Bring up each texture in the inspector, and make sure that Texture Type is set to Texture, and that Wrap Mode is set to Clamp. Then, create a new Material asset, and in the inspector, set the Shader to "Skybox/6 Sided". Then assign each of the textures to the corresponding slots, and you're done.


I set up my scene to have 6 frames. Each frame animated the camera to capture a different face of the sky cube. This is what my fcurves looked like, but I'm not 100% certain that I got the up and down cameras perfect (please correct me in the comments if so).


As of 2016-June it seems like the most detailed skybox supported by unity is 1024x1024 per face. If you need resolution better than that, you might have to instantiate those objects in the Unity scene and leave them out of the skybox.


2. Unity will show a list of files to import. If it's your first time using Bakery, it is recommended you just click Import. Experienced users may want to untick the examples folder for a more lightweight installation.


Meshes must have non-overlapping UV for lightmapping. UV2 is used if present (otherwise UV1). If you did not unwrap models for lightmapping, make sure to check Generate Lightmap UVs on the asset. Unity primitives already have correct UV2.




6. Click Bakery->Render Lightmap. By default, Full Lighting mode is active. It will bake both direct and indirect contribution from all lights. If you want to combine real-time shadows with baked GI, change it to Indirect.


All render settings can be accessed via Bakery->Render Lightmap. Settings are saved for every scene. The topmost option in Bakery window allows you to switch between Simple, Advanced and Experimental settings, each succeeding mode revealing more tweakable options. Simple mode is enough for most scenes and it's a good way to get started.


To enable this behaviour, you must have both Unity and Bakery lights on the same object, with Baked Contribution set to Shadowmask and Indirect. Unmarked lights will be baked as in Indirect mode.


Defines how directional information is baked. Standard lightmaps only store a single color per texel, while directional lightmaps give shaders a hint of how lighting changes over a hemisphere around the texel. This data is required to combine fully lightmapped areas with normal maps. Plugging it into the built-in Bakery shader can also produce approximate specular response.


Still no directional data, but normal maps are taken into account when rendering the lightmap. There is no additional runtime overhead. Since lightmaps usually have lower resolution than normal maps, the result may look blurry. Other problems include aliasing at distance due to lack of mipmapping and denoising step potentially smudging the detail. To learn how to use custom shaders with procedural normals in this mode, read Normal Mapping section.


This mode is similar to what Enlighten and Progressive bake in Unity. It is compatible will most shaders, only generates one additional map and the runtime overhead is minimal. The downside is that bump-mapping looks rather faint and gray-ish and can be quite different comparing to the same object under real-time lighting.


Same as SH, but using a monochromatic L1 directional coefficients. Similarly good surface contrast, although not accurately representing different colors shining from different directions at one texel; but good enough for many scenes. Only generates one additional map, so the VRAM usage/bandwidth is similar to Dominant Direction; in fact it's even smaller, due to Dominant Direction using RGBA maps, while MonoSH only needing RGB. The map is fed via the built-in directional lightmap system, but won't look correct with standard shaders. Make sure to use a compatible shader.


It is assumed that scene scale is roughly 1 unit = 1 meter. Such scale is generally recommended when working in Unity for better navigation and for physics simulation. If your scale is different, multiply Texels accordingly.


Maximum lightmap size limit. If objects can't fit in a single lightmap (given current Texels Per Unit value), additional lightmaps will be allocated. Same 4 square objects can take four 512x512 maps or one 1024x1024.


Defines how many times light rays should bounce off surfaces. Usually lower values are sufficient for outdoor scenes (e.g. a city), while higher values are required for more closed scenes (interiors, caves).


When "Render Light Probes" is pressed, lets Unity bake occlusion probes using currently selected built-in lightmapper. Occlusion probes is additional data stored inside regular light probes, and it prevents dynamic objects from getting lit in shadowed areas. Currently there is no way to use custom occlusion probes in Unity, and it has to call its own lightmappers instead to do the job.


There seems to be a bug in Unity 2019.3 preventing Legacy light probe colors from being properly saved IF occlusion probes option is enabled. L1 mode is now default and recommended when using occlusion probes. Legacy mode will be soon deprecated and replaced with a new L2 mode based on L1.


Find best sample positions to prevent lighting leaks. Details of the algorithm are outlined here. In some cases (usually large and very low poly geometry with smooth normals) it may produce incorrect results, in which case you can disable it.


If multiple scenes are loaded at once, and this option is enabled, each scene will have its own set of lightmaps, not shared with others. It can be useful for limiting the amount of textures loaded when scenes are streamed at runtime.


If Show checker checkbox is on, Scene View will render a checkerboard pattern on top of visible objects to demonstrate lightmap texel size. This is useful to make sure you are using adequate values for Texels Per Unit and other resolution-affecting settings before you bake.


Atlas preview button is visible when Checker preview is on. Clicking it will open a new window where the UV layouts of future lightmaps are shown. Click "" buttons to browse the lightmaps.This is useful for checking out packing quality and lightmap count before baking.


If enabled, painted terrain trees will affect lighting. Trees themselves will not be baked. Note that highest possible LOD level is used for every tree during baking. It is not recommended to use this option for rendering multi-kilometer forests with highly detailed models.


If enabled (default), Terrains use separate ray tracing technique to take advantage of their heightfield geometry. Otherwise they are treated like any other mesh. Terrain optimization significantly reduces memory footprint required for high-resolution landscapes. In some cases it can also make terrain baking faster, in other cases (especially with simple low-resolution landscapes) it might make sense to disable it.


If this value is above 0, combines many Light Meshes into one, given they have identical settings and affect the same Lightmap Groups, but limiting their total sample count to this value (I.e. if the limit is 64, it can combine 2 lights with samples=32 or 4 lights with samples=16, etc). This will increase performance in scenes with many Light Meshes. Be careful setting this value too high, as the GPU may hit the OS driver timeout while processing too many samples at once.

3a8082e126
Reply all
Reply to author
Forward
0 new messages