Creating Cubemaps in Unity3D

http://docs.unity3d.com/ScriptReference/Camera.RenderToCubemap.html

using UnityEngine;
using UnityEditor;

public class RenderCubemapWizard : ScriptableWizard
{

    public Transform renderFromPosition;
    public Cubemap cubemap;

    void OnWizardUpdate()
    {
        helpString = "Select transform to render from and cubemap to render into";
        isValid = renderFromPosition != null && cubemap != null;
    }

    void OnWizardCreate()
    {
        // create temporary camera for rendering
        GameObject go = new GameObject("CubemapCamera");
        go.AddComponent();
        // place it on the object
        go.transform.position = renderFromPosition.position;
        go.transform.rotation = Quaternion.identity;
        // render into cubemap
        go.GetComponent().RenderToCubemap(cubemap);

        // destroy temporary camera
        DestroyImmediate(go);
    }

    [MenuItem("GameObject/Render into Cubemap")]
    static void RenderCubemap()
    {
        DisplayWizard("Render cubemap", "Render!");
    }
}

你可能感兴趣的:(Creating Cubemaps in Unity3D)