几百个天空盒,分了好几份
👉前言
有时候会用到很多资源包,所以整理一下方便使用,简单记录一下,不喜勿喷哦,
大家好,我是心疼你的一切,不定时更新Unity开发技巧,觉得有用记得一键三连哦。
有问题 欢迎点赞评论哦.
下面就让我们进入正文吧 !
👉一.天空盒下载
1.
太空天空盒下载
2.
白天天空盒下载
3.
夜晚天空盒下载
4.
阴天雾霾天空盒下载
5.
HDRI Haven skybox-1
6.
HDRI Haven skybox-2
7.
其他天空盒-1
8.
其他天空盒-2
最后是没分的天空盒暂且叫其他天空盒吧,按需下载,喜欢的话请点个赞吧 !
没有积分的可以评论私信,没有及时回复的请见谅,最多大半天哦,
9.
2022年新上传的天空盒内含预览图
10.
55个天空盒
预览图
补充:
👉Skybox的实现原理
-
渲染机制
Skybox在所有不透明物体之后渲染,作为场景的背景层。其本质是一个包围摄像机的立方体或球体网格,通过六个面的纹理(或程序化生成)模拟远方的天空或环境。
立方体贴图(Cubemap):传统方式使用六张纹理(前、后、左、右、上、下)拼接成立方体,形成无缝背景。
程序化生成(Procedural):基于物理公式(如大气散射模型)实时生成动态天空效果,支持日出、日落等自然现象模拟。 -
光照与物理模拟
大气散射:程序化天空盒通过瑞利散射(Rayleigh Scattering)和米氏散射(Mie Scattering)模拟光线在大气中的传播,决定天空颜色(如白天的蓝色和日落的红色)。
HDR支持:高动态范围渲染增强光照细节,使亮部和暗部过渡更自然。 -
动态特性
程序化天空盒允许实时调整参数(如太阳位置、云层密度),结合HDR和物理光照实现动态日夜循环。
👉使用Skybox的核心注意事项
-
设置与兼容性
摄像机的Clear Flags:必须设置为Skybox,否则无法显示。多摄像机场景中可为每个摄像机单独指定不同的Skybox组件。
渲染管线兼容:内置渲染管线(Built-in)和通用渲染管线(URP)支持传统Skybox组件,而HDRP需使用专用解决方案(如体积云系统)。 -
纹理与材质
立方体贴图顺序:自定义Skybox需确保六张纹理按正确顺序(Front、Back、Left、Right、Up、Down)加载,避免接缝问题。建议将纹理的Wrap Mode设为Clamp以减少接缝。
Shader选择:材质需使用Skybox/Procedural或Skybox/Cubemap着色器。程序化天空盒需调整参数如Sun Size(太阳尺寸)和Atmosphere Thickness(大气厚度)。 -
性能优化
静态与动态平衡:静态立方体贴图性能更高,适合固定场景;程序化天空盒灵活但需注意动态生成的性能开销(如高分辨率图集可能增加内存占用)。
分辨率控制:建议静态图集使用8192x8192分辨率容纳更多字符(如中文字体),动态生成时使用2048x2048以降低资源消耗。 -
环境一致性
雾效匹配:在Lighting窗口中调整雾效颜色与Skybox色调一致,避免视觉割裂。
反射探头(Reflection Probe):Skybox会影响场景反射效果,需合理配置反射探头的Type(Baked/Realtime)和Box Projection参数。 -
常见问题解决
字符显示异常:若中文字符显示为方块,需扩展字符集或启用动态字体补充。
材质异常:出现白色底纹时,检查材质Shader是否切换为Bitmap模式,或确保纹理的Is Readable属性开启。
👉二.能量罩的shader
先上效果图
unity能量罩shader
👉三.能量罩shaderd
最后附上demo链接:demo下载
四. unity植物树木模型资源
1.模型效果图
内含大量树的模型,植物的模型大概上百种吧
👉1.树第一个资源
👉2.树第二个资源
我就截取一部分吧
有需要可以自取
👉五.树资源如下
https://download.csdn.net/download/qq_42603590/86406562
👉六.摄像机代码
贴点摄像机移动的代码,添加完天空盒还能旋转一下看一看,不喜勿喷,主要是不贴代码推荐受影响
注释可以不用管,直接挂到摄像头上面,在拖一个地板在地面就可以了
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
//using UnityEngine.PostProcessing;
using UnityEngine.UI;
public class CameraMove : MonoBehaviour
{
//旋转变量
float rotateY;
float initialY;
float Camerdis;
Vector3 rayPoint;
float newDis;
float oldDis;
private Vector3 point;
private int isforward;//标记摄像机的移动方向
private float eulerAngles_x;
private float eulerAngles_y;
private float distancePoint;//绕点旋转距离
// public Texture2D ZoomView, PanView, OrbitView, FPSView;
//public Text PO;
public float Xpos;
public float Ypos;
public Camera cam;
public bool UIclipMove = false;//是否在ui上限制移动
bool LookFps=false;
//高度限制
public float maxHigh = 4000;
public float minHigh = 0;
public float maxX = 13000;
public float minX = -27000;
public float maxZ = 25000;
public float minZ = -35000;
// Use this for initialization
public GameObject escObj;
//public GameObject LightOBJ;
//private void Awake()
//{
// Screen.SetResolution(1920, 1080, false);
//}
void Start()
{
Camerdis = 1;
rayPoint = cam.transform.forward * 800 + cam.transform.position;
//ShowOrHideObj();
cameraRot = transform.localRotation;
}
//void FixedUpdate()
//{
// //if (Input.GetKeyDown(KeyCode.Escape))
// //{
// // escObj.SetActive(true);
// //}
// if (EventSystem.current.IsPointerOverGameObject())
// {
// return;
// }
// //Camerdis = (float)Math.Round(cam.transform.position.y, 2);
// if (Input.touchCount == 1)
// {
// if (Input.touches[0].phase == TouchPhase.Moved&& Camera.main.ScreenToViewportPoint(Input.touches[0].position).x>0.2f)
// {
// Translation(0.005f);
// }
// else if (Input.touches[0].phase == TouchPhase.Moved && Camera.main.ScreenToViewportPoint(Input.touches[0].position).x <0.2f)
// {
// float moveX = Input.GetAxis("Mouse X") * Camerdis * 0.002f;
// Camera.main.transform.Translate(Vector3.forward * moveX);
// }
// }
// if (Input.touchCount == 2)
// {
// 记录两个手指的位置
// //Vector2 nposition1 = new Vector2();
// //Vector2 nposition2 = new Vector2();
// 记录手指的每帧移动距离
// //Vector2 deltaDis1 = new Vector2();
// //Vector2 deltaDis2 = new Vector2();
// //if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved) //第二个手指
// //{
// // nposition1 = Input.GetTouch(0).position; //第一个手指屏幕坐标
// // nposition2 = Input.GetTouch(1).position; //第二个手指屏幕坐标
// // deltaDis1 = Input.GetTouch(0).deltaPosition;
// // deltaDis2 = Input.GetTouch(1).deltaPosition;
// // newDis = Vector3.Distance(nposition1, nposition2);
// // if (newDis > oldDis)
// // {
// // isforward = 1;
// // }
// // else
// // {
// // isforward = -1;
// // }
// // //记录旧的触摸位置
// // oldDis = newDis;
// // //移动摄像机
// // // Camera.main.transform.Translate(isforward * Vector3.forward * Time.deltaTime * (Mathf.Abs(deltaDis2.x + deltaDis1.x) + Mathf.Abs(deltaDis1.y + deltaDis2.y)) * Camerdis * 0.1f);
// // Camera.main.transform.Translate(isforward * Vector3.forward * Time.deltaTime * Camerdis * 0.1f);
// // PO.text = isforward.ToString();
// //}
// //else
// //{
// if (Input.touches[0].phase == TouchPhase.Moved)
// {
// RotatePoint();
// }
// }
//}
public void ExitQ()
{
Application.Quit();
}
//控制高度
void ControlHigh()
{
float highY = transform.position.y;
float highX = transform.position.x;
float highZ = transform.position.z;
highY = Mathf.Clamp(highY, minHigh, maxHigh);
highX = Mathf.Clamp(highX, minX, maxX);
highZ = Mathf.Clamp(highZ, minZ, maxZ);
//transform.position = new Vector3(transform.position.x, highY, transform.position.z);
transform.position = new Vector3(highX, highY, highZ);
//AmbientOcclus();//控制AO
}
// Update is called once per frame
void Update()
{
//if (UIclipMove)
//{
//if (EventSystem.current.IsPointerOverGameObject())
//{
// return;
//}
//}
//transform.LookAt(escObj.transform);
//if (Gamemanager._instatic.isMove)
//{
// return;
//}
//if (Input.touchCount <= 0 && Camera.main.ScreenToViewportPoint(Input.mousePosition).x < Xpos && Camera.main.ScreenToViewportPoint(Input.mousePosition).y > Ypos)
//{
//if (EventSystem.current.IsPointerOverGameObject())
//{
// return;
//}
//if (Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(2))
光标重置
//{
// Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
//}
if (Input.GetMouseButton(2))
//按住左键平移
{
// Cursor.SetCursor(PanView, Vector2.zero, CursorMode.Auto);
Translation(0.03f);
ControlHigh();
//ShowOrHideObj();
}
if (!EventSystem.current.IsPointerOverGameObject())
{
if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
RayPoint();
transform.Translate(Vector3.back * Camerdis * 0.1f);
ControlHigh();
//ShowOrHideObj();
}
if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
RayPoint();
transform.Translate(Vector3.forward * Camerdis * 0.1f);
ControlHigh();
//ShowOrHideObj();
}
}
if (Input.GetMouseButtonDown(1)|| Input.GetMouseButtonDown(0))
{
eulerAngles_y = this.transform.eulerAngles.x;
eulerAngles_x = this.transform.eulerAngles.y;
RayPoint();
ControlHigh();
//ShowOrHideObj();
distancePoint = Vector3.Distance(transform.position, rayPoint);
}
if (Input.GetMouseButton(1))
//右键旋转
{
// Cursor.SetCursor(OrbitView, Vector2.zero, CursorMode.Auto);
RotatePoint();
ControlHigh();
//ShowOrHideObj();
}
KeyTranslation();
//}
//if (Input.GetKeyDown(KeyCode.F10))
//{
// if (LookFps == false)
// {
// LookFps = true;
// }
// else
// {
// LookFps = false;
// }
//}
//if (LookFps)
//{
// lookFPS();
//}
}
void Translation(float sheep)
//平移控制
{
float moveX = Input.GetAxis("Mouse X") ;
float moveY = Input.GetAxis("Mouse Y") ;
//自身坐标的z轴投影到世界坐标的z轴,用自身坐标的y轴和z轴的值乘 自身的相对欧拉角的x的三角函数。
float tranY = moveY * (float)Math.Sin(Math.Round(this.transform.localRotation.eulerAngles.x, 2) * Math.PI / 180.0);
float tranZ = moveY * (float)Math.Cos(Math.Round(this.transform.localRotation.eulerAngles.x, 2) * Math.PI / 180.0);
transform.Translate(new Vector3(-moveX, -tranY, -tranZ) * Camerdis* sheep, Space.Self);
}
void Rotation()
//旋转控制
{
initialY = this.transform.localRotation.eulerAngles.y;
rotateY = 0;
rotateY += Input.GetAxis("Mouse X") * 2f;
var rotation = Quaternion.Euler(this.transform.localRotation.eulerAngles.x, rotateY + initialY, 0);
transform.rotation = rotation;
}
void RayPoint()
//射线得到碰撞点,针对绕点旋转
{
Ray ray = cam.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));//射线
// Ray ray = cam.ScreenPointToRay(Input.mousePosition);//射线
RaycastHit hit;
if (Physics.Raycast(ray, out hit))//发射射线(射线,射线碰撞信息,射线长度,射线会检测的层级)
{
rayPoint = new Vector3(hit.point.x, hit.point.y, hit.point.z);
Camerdis = (float)Math.Round(cam.transform.position.y- hit.point.y, 2)+10;
}
//else
//{
// rayPoint = transform.forward*0.005f + transform.position;//摄像机前方 800 点
// //Camerdis = (float)Math.Round(cam.transform.position.y, 2) ;
//}
}
float a = 0;
public float XSensitivity = 2f;
public float YSensitivity = 2f;
//是否平滑
public bool smooth;
//平滑参数
public float smoothTime = 5f;
//相机
private Quaternion cameraRot;
Quaternion quaternion;
void RotatePoint()
//绕点旋转
{
eulerAngles_x += (Input.GetAxis("Mouse X")*2);
eulerAngles_y -= (Input.GetAxis("Mouse Y")*2);
eulerAngles_y = ClampAngle(eulerAngles_y, 3,89);
quaternion = Quaternion.Euler(eulerAngles_y, eulerAngles_x, 0);
Vector3 vector = quaternion * new Vector3(0, 0, -distancePoint) + rayPoint;
transform.rotation = Quaternion.Slerp(transform.localRotation, quaternion, 20f * Time.deltaTime);
if (Input.GetKey(KeyCode.LeftControl))
//右键旋转
{
return;
}
transform.position = Vector3.Lerp(transform.position, vector, Time.deltaTime * 20f);
//
}
void Euler()
//当前物体的欧拉角
{
Vector3 eulerAngles = this.transform.eulerAngles;
this.eulerAngles_x = eulerAngles.y;
if (eulerAngles.x > 80)
{
this.eulerAngles_y = 80;
}
else if (eulerAngles.x < 10)
{
this.eulerAngles_y = 10;
}
else
{
this.eulerAngles_y = eulerAngles.x;
}
}
//键盘控制
void KeyTranslation()
//平移控制
{
float moveX = Input.GetAxis("Horizontal") * Time.deltaTime * 6;
float moveY = Input.GetAxis("Vertical") * Time.deltaTime * 6;
if (moveX == 0 && moveY == 0)
{
return;
}
//自身坐标的z轴投影到世界坐标的z轴,用自身坐标的y轴和z轴的值乘 自身的相对欧拉角的x的三角函数。
float tranY = moveY * (float)Math.Sin(Math.Round(this.transform.localRotation.eulerAngles.x, 2) * Math.PI / 180.0);
float tranZ = moveY * (float)Math.Cos(Math.Round(this.transform.localRotation.eulerAngles.x, 2) * Math.PI / 180.0);
transform.Translate(new Vector3(moveX, tranY, tranZ) * Camerdis * 0.05f, Space.Self);
}
//角度限制
private static float ClampAngle(float angle, float min, float max)
{
if (angle < -360)
angle += 360;
if (angle > 360)
angle -= 360;
return Mathf.Clamp(angle, min, max);
}
}
👉壁纸分享
👉总结
没有积分的老铁,可以私聊,评论哦
如能帮助到你,就帮忙点个赞吧,三连更好哦,谢谢
你的点赞就是对博主的支持,有问题记得留言评论哦!
不定时更新Unity开发技巧,觉得有用记得一键三连哦。么么哒