Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/n-yoda/unity-sky-mesh
Render Skybox (sky sphere) by user-defined sky mesh.
https://github.com/n-yoda/unity-sky-mesh
shaders skybox unity
Last synced: 2 days ago
JSON representation
Render Skybox (sky sphere) by user-defined sky mesh.
- Host: GitHub
- URL: https://github.com/n-yoda/unity-sky-mesh
- Owner: n-yoda
- Created: 2015-10-17T17:08:17.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-18T10:44:06.000Z (almost 9 years ago)
- Last Synced: 2024-08-03T05:18:16.058Z (3 months ago)
- Topics: shaders, skybox, unity
- Language: C#
- Homepage:
- Size: 433 KB
- Stars: 41
- Watchers: 10
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SkyMesh shader for Unity
Do you want to use your own **sky sphere model** made in 3D modeling software (e.g. Blender, Maya)?
In that case, the SkyMesh shader in this repository will be **useful and efficient**.![screenshot.png](screenshot.png)
## How to use?
### 0. Think twice if you really need to render sky with your mesh.
In many cases, you should use [Skybox](http://docs.unity3d.com/Manual/class-Skybox.html) instead,
because **SkyMesh is not suitable for GI**.
Unity can import several types of textures as [Cubemaps](http://docs.unity3d.com/Manual/class-Cubemap.html).
Even if you don't want to use Cubemaps, **you'd better write your custom Skybox shader** if the mapping between view direction and color (or texture coordinates) is simple enough.### 1. Import your sky model, and create SkyMesh material.
You can also use builtin meshes.
Create a material and select "Custom/SkyMesh" as the shader.### 2. Choose radius of the sky. Finite or infinite?
Unity's skybox is rendered as **a sphere of infinite radius** when camera mode is perspective.
This means sky appearance doesn't depend on translation of camera,
but depends only on rotation and field of view of it.
If you prefer this behaviour, **uncheck Finite Radius checkbox** of your material.If your camera mode is orthographic or you prefer camera-translation-dependent sky,
**check Finite Radius checkbox**.In both cases, the sky mesh **doesn't need to be within the view volume** (read below).
### 3. Choose a renderer. MeshRenderer or CommandBuffer?
#### CommandBuffer
Attatch SkyMesh script to your main camera, and fill all the properties.
"Camera Event" is recommended to be "After Image Effects Opaque" for efficiency.
#### MeshRenderer
Create GameObject, and attach MeshFilter with your mesh and MeshRenderer with the SkyMesh material.
In order to avoid frustum culling, you have to scale the object or
[Mesh.bounds](http://docs.unity3d.com/ScriptReference/Mesh-bounds.html).## Features
### The sky is rendered even if far away from the camera.
Sky meshes will be rendered even if the actual meshes are outside camera view volumes.
The mesh is rendered as if it is stuck on the far plane of the volume.
It doesn't cosume your depth buffer bits.### Efficient rendering order.
The rendering order is as efficient as builtin Skybox.
The areas hidden by opaque objects are culled by depth test.![render.png](render.png)