我是个团结的新手需要一点帮助..。
我有两个不同的环境,用户可以选择。我为每个环境生成了一个cubemap。当用户切换环境时,我需要交换被反射到场景中的cubemap。以下是一些想法:
这似乎是我唯一能想到的,我倾向于第二,只是好奇它是否会导致一个性能的成功。有人有更好的建议吗?
发布于 2015-12-02 04:03:43
使用上面的概念2..。
// replaces the reflection cubemap for the selected environment (garage or gallery)
public void setReflectionMaps(Cubemap cubeMap)
{
// get all of the mesh renderers
var renderers = truckGO.GetComponentsInChildren<Renderer>();
foreach (Renderer r in renderers) {
// get the material for each renderer
Material mat = r.sharedMaterial;
// check if the material has a cubemap
if (mat.HasProperty("_ReflectionMap")) {
// replace existing cubemap
mat.SetTexture("_ReflectionMap",cubeMap);
}
}
}https://stackoverflow.com/questions/33990058
复制相似问题