当前位置:网站首页>Unity HDRP中代码动态修改天空盒以及其他环境参数
Unity HDRP中代码动态修改天空盒以及其他环境参数
2022-08-08 06:25:00 【LCF_CSharp】
方法一
直接在Assets资源文件夹下创建新的Volume Profile,然后为其中添加组件。
组件分别为Visual Environment和HDRI Sky。
注意:Volume的组件属性必须将其前面的对勾勾选,才能对进行修改。
然后如下图这样配置即可:(HdriSky属性需要赋值为一个Cubemap资源,也就是你想替换的天空盒)
最后利用c#代码实现环境材质的替换,也就实现了天空盒的替换。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
public Volume skybox;//获取场景中的环境体积控件
public VolumeProfile NewVolumeProfile;//自己新建的VolumeProfile资源
public class Test : MonoBehaviour
{
void Start()
{
skybox.profile = NewVolumeProfile;//替换
}
}
方法二
直接修改当前场景中的volume控件下组件的环境属性;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
public class Test0: MonoBehaviour
{
public Volume skybox;//获取场景中的环境体积控件
public Cubemap cubemap;//需要替换上的天空盒
void Start()
{
if (skybox.sharedProfile.TryGet<HDRISky>(out var Temp0))
{
Temp0.hdriSky.overrideState = true;//overrideState的值就是Volume的组件属性其前面的勾选状态
Temp0.hdriSky.value = cubemap;
}
}
}
当然,用以上方法不仅可以修改天空盒。还能修改exposure(曝光)值,fog(雾)等等;
具体可参考:
Unity官方环境体积介绍
边栏推荐
- PHP操作MongoDB的原生CURD方法
- Market Research: In-depth Analysis and Development Prospect Report of Metal Furniture Industry in 2022
- Meta-Learning and in-context Learning
- 多态的实现
- P03 线程安全 synchronized Lock
- 二分查找一个数首次与最后出现的位置
- uniapp微信小程序订阅消息发送服务通知--超详细
- Instant Noodle Industry Survey: Expected to Reach $43.6 Billion in 2028
- 深度神经网络的训练过程,深度神经网络训练方法
- NVIDIA CUDA 高度并行处理器编程(六):并行模式:卷积
猜你喜欢

传统图像特征提取方法:边缘与角点

Instant Noodle Industry Survey: Expected to Reach $43.6 Billion in 2028

ResNet 原理与代码复现

NVIDIA CUDA 高度并行处理器编程(八):并行模式:直方图计算

PURE(A Frustratingly Easy Approach for Entity and Relation Extraction)

Industry Research: Analysis of the Status and Prospects of the Pension Insurance Market in 2022
![[WUSTCTF2020]CV Maker1](/img/be/989b1ea8597f31f4b82c2edc6345d5.png)
[WUSTCTF2020]CV Maker1

神经网络预测值几乎一样,神经网络为什么能预测

jupyter notebook添加目录

【重度踩雷】ROS安装过程中的问题
随机推荐
深度学习基本实用工具
传统图像特征提取方法:边缘与角点
Lamp analysis: LED lamps are expected to reach $45.9 billion in 2028
Chemical Industry Research: Current Situation and Scale Analysis of Organic Silica Gel Market
线程同步与死锁
用户管理 用户的增删改查 切换用户 用户组 用户组相关文件
Part 10:iOS的数据持久化(2),Sqlite,CoreData
多神经网络模型联合训练,神经网络模型怎么训练
Analysis of the status quo of the chemical industry: the polyolefin market consumption is nearly 200 million tons
ACM latex
Map和Set
Windows中安装MongoDB的PHP扩展
MongoDB配置文件.conf配置项介绍
P19 美颜相机的实现——基础铺垫1
vlan路由配置
7.线程优先级
访问修饰符public、private、protected、default(默认不写) 区别
中序表达式转为后序表达式
Distributed voltage regulation using permissioned blockchains and extended contract net protocol to optimize efficiency
@Autowired和@Resource区别