예제 #1
0
 /* ----------------------------------------
  * At Awake, assign ReflectionProbe component to
  * probe' variable and update cubemap
  */
 void Awake()
 {
     // Assign assign ReflectionProbe component to 'probe' variable
     probe = GetComponent<ReflectionProbe> ();
     // Use RenderProbe function to update reflection cubemap
     probe.RenderProbe();
 }
예제 #2
0
    void Start()
    {
        _current = this;

        // Reflection probe
        var g = new GameObject();
        g.name = "System Reflection Probe";
        _reflectionProbe = g.AddComponent<ReflectionProbe>();
        _reflectionProbe.mode = UnityEngine.Rendering.ReflectionProbeMode.Realtime;
        _reflectionProbe.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.ViaScripting;
        _reflectionProbe.cullingMask = LayerMask.GetMask("Universe Backgrouund");
        _reflectionProbe.size = Vector3.one * (Universe.Current.CellSize + 100);
        _reflectionProbe.transform.position = Vector3.zero;

        foreach(var level in Levels)
        {
            level.SystemName = NameGenerator.GetRandomSystemName();
        }

        ChangeLevel(0);
    }
 public static extern bool BakeReflectionProbe(ReflectionProbe probe, string path);
        private bool ValidPreviewSetup()
        {
            ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;

            return(reflectionProbe != null && reflectionProbe.texture != null);
        }
        private bool IsCollidingWithOtherProbes(string targetPath, ReflectionProbe targetProbe, out ReflectionProbe collidingProbe)
        {
            ReflectionProbe[] array = UnityEngine.Object.FindObjectsOfType <ReflectionProbe>().ToArray <ReflectionProbe>();
            collidingProbe = null;
            ReflectionProbe[] array2 = array;
            bool result;

            for (int i = 0; i < array2.Length; i++)
            {
                ReflectionProbe reflectionProbe = array2[i];
                if (!(reflectionProbe == targetProbe) && !(reflectionProbe.customBakedTexture == null))
                {
                    string assetPath = AssetDatabase.GetAssetPath(reflectionProbe.customBakedTexture);
                    if (assetPath == targetPath)
                    {
                        collidingProbe = reflectionProbe;
                        result         = true;
                        return(result);
                    }
                }
            }
            result = false;
            return(result);
        }
예제 #6
0
 public override void OnInspectorGUI()
 {
     base.serializedObject.Update();
     if (base.targets.Length == 1)
     {
         this.DoToolbar();
     }
     this.m_ShowProbeModeRealtimeOptions.target = this.reflectionProbeMode == ReflectionProbeMode.Realtime;
     this.m_ShowProbeModeCustomOptions.target   = this.reflectionProbeMode == ReflectionProbeMode.Custom;
     EditorGUILayout.IntPopup(this.m_Mode, Styles.reflectionProbeMode, Styles.reflectionProbeModeValues, Styles.typeText, new GUILayoutOption[0]);
     if (!this.m_Mode.hasMultipleDifferentValues)
     {
         EditorGUI.indentLevel++;
         if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeCustomOptions.faded))
         {
             EditorGUILayout.PropertyField(this.m_RenderDynamicObjects, Styles.renderDynamicObjects, new GUILayoutOption[0]);
             EditorGUI.BeginChangeCheck();
             EditorGUI.showMixedValue = this.m_CustomBakedTexture.hasMultipleDifferentValues;
             UnityEngine.Object obj2 = EditorGUILayout.ObjectField(Styles.customCubemapText, this.m_CustomBakedTexture.objectReferenceValue, typeof(Cubemap), false, new GUILayoutOption[0]);
             EditorGUI.showMixedValue = false;
             if (EditorGUI.EndChangeCheck())
             {
                 this.m_CustomBakedTexture.objectReferenceValue = obj2;
             }
         }
         EditorGUILayout.EndFadeGroup();
         if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeRealtimeOptions.faded))
         {
             EditorGUILayout.PropertyField(this.m_RefreshMode, Styles.refreshMode, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_TimeSlicingMode, Styles.timeSlicing, new GUILayoutOption[0]);
             EditorGUILayout.Space();
         }
         EditorGUILayout.EndFadeGroup();
         EditorGUI.indentLevel--;
     }
     EditorGUILayout.Space();
     GUILayout.Label(Styles.runtimeSettingsHeader, new GUILayoutOption[0]);
     EditorGUI.indentLevel++;
     EditorGUILayout.PropertyField(this.m_Importance, Styles.importanceText, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_IntensityMultiplier, Styles.intensityText, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_BoxProjection, Styles.boxProjectionText, new GUILayoutOption[0]);
     EditorGUI.BeginDisabledGroup(SceneView.GetSceneViewRenderingPath() != RenderingPath.DeferredShading);
     EditorGUILayout.PropertyField(this.m_BlendDistance, Styles.blendDistanceText, new GUILayoutOption[0]);
     EditorGUI.EndDisabledGroup();
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowBoxOptions.faded))
     {
         EditorGUI.BeginChangeCheck();
         EditorGUILayout.PropertyField(this.m_BoxSize, Styles.sizeText, new GUILayoutOption[0]);
         EditorGUILayout.PropertyField(this.m_BoxOffset, Styles.centerText, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             Vector3 center = this.m_BoxOffset.vector3Value;
             Vector3 size   = this.m_BoxSize.vector3Value;
             if (this.ValidateAABB(ref center, ref size))
             {
                 this.m_BoxOffset.vector3Value = center;
                 this.m_BoxSize.vector3Value   = size;
             }
         }
     }
     EditorGUILayout.EndFadeGroup();
     EditorGUI.indentLevel--;
     EditorGUILayout.Space();
     GUILayout.Label(Styles.captureCubemapHeaderText, new GUILayoutOption[0]);
     EditorGUI.indentLevel++;
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f) };
     EditorGUILayout.IntPopup(this.m_Resolution, Styles.renderTextureSizes, Styles.renderTextureSizesValues, Styles.resolutionText, options);
     EditorGUILayout.PropertyField(this.m_HDR, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_ShadowDistance, new GUILayoutOption[0]);
     EditorGUILayout.IntPopup(this.m_ClearFlags, Styles.clearFlags, Styles.clearFlagsValues, Styles.clearFlagsText, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_BackgroundColor, Styles.backgroundColorText, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_UseOcclusionCulling, new GUILayoutOption[0]);
     EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarProperties, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]);
     EditorGUI.indentLevel--;
     EditorGUILayout.Space();
     if (base.targets.Length == 1)
     {
         ReflectionProbe target = (ReflectionProbe)this.target;
         if ((target.mode == ReflectionProbeMode.Custom) && (target.customBakedTexture != null))
         {
             Cubemap customBakedTexture = (Cubemap)target.customBakedTexture;
             if (customBakedTexture.mipmapCount == 1)
             {
                 EditorGUILayout.HelpBox("No mipmaps in the cubemap, Smoothness value in Standard shader will be ignored.", MessageType.Warning);
             }
         }
     }
     this.DoBakeButton();
     EditorGUILayout.Space();
     base.serializedObject.ApplyModifiedProperties();
 }
        static void CheckSceneContentForRayTracing(MenuCommand menuCommand)
        {
            // Flag that holds
            bool            generalErrorFlag = false;
            var             rendererArray    = UnityEngine.GameObject.FindObjectsOfType <Renderer>();
            List <Material> materialArray    = new List <Material>(32);
            ReflectionProbe reflectionProbe  = new ReflectionProbe();

            foreach (Renderer currentRenderer in rendererArray)
            {
                // If this is a reflection probe, we can ignore it.
                if (currentRenderer.gameObject.TryGetComponent <ReflectionProbe>(out reflectionProbe))
                {
                    continue;
                }

                // Get all the materials of the mesh renderer
                currentRenderer.GetSharedMaterials(materialArray);
                if (materialArray == null)
                {
                    Debug.LogWarning("The object " + currentRenderer.name + " has a null material array.");
                    generalErrorFlag = true;
                    continue;
                }

                // For every sub-mesh/sub-material let's build the right flags
                int numSubMeshes = 1;
                if (!(currentRenderer.GetType() == typeof(SkinnedMeshRenderer)))
                {
                    currentRenderer.TryGetComponent(out MeshFilter meshFilter);
                    if (meshFilter == null || meshFilter.sharedMesh == null)
                    {
                        Debug.LogWarning("The object " + currentRenderer.name + " has null meshfilter or mesh.");
                        generalErrorFlag = true;
                        continue;
                    }
                    numSubMeshes = meshFilter.sharedMesh.subMeshCount;
                }
                else
                {
                    SkinnedMeshRenderer skinnedMesh = (SkinnedMeshRenderer)currentRenderer;
                    if (skinnedMesh.sharedMesh == null)
                    {
                        Debug.LogWarning("The object " + currentRenderer.name + " has null mesh.");
                        generalErrorFlag = true;
                        continue;
                    }
                    numSubMeshes = skinnedMesh.sharedMesh.subMeshCount;
                }

                // Check the number of sub-meshes
                if (numSubMeshes >= 32)
                {
                    Debug.LogWarning("The object " + currentRenderer.name + " has more than 32 sub-meshes. Above this limit, the cutoff and double sided flags may not match the one defined in the materials.");
                    generalErrorFlag = true;
                    continue;
                }

                bool materialIsOnlyTransparent = true;
                bool hasTransparentSubMaterial = false;
                bool singleSided    = true;
                bool hasSingleSided = false;

                for (int meshIdx = 0; meshIdx < numSubMeshes; ++meshIdx)
                {
                    // Initially we consider the potential mesh as invalid
                    if (materialArray.Count > meshIdx)
                    {
                        // Grab the material for the current sub-mesh
                        Material currentMaterial = materialArray[meshIdx];

                        // The material is transparent if either it has the requested keyword or is in the transparent queue range
                        if (currentMaterial != null)
                        {
                            bool materialIsTransparent = currentMaterial.IsKeywordEnabled("_SURFACE_TYPE_TRANSPARENT") ||
                                                         (HDRenderQueue.k_RenderQueue_Transparent.lowerBound <= currentMaterial.renderQueue &&
                                                          HDRenderQueue.k_RenderQueue_Transparent.upperBound >= currentMaterial.renderQueue);

                            // aggregate the transparency info
                            materialIsOnlyTransparent &= materialIsTransparent;
                            hasTransparentSubMaterial |= materialIsTransparent;

                            // Evaluate if it is single sided
                            bool doubleSided = currentMaterial.doubleSidedGI || currentMaterial.IsKeywordEnabled("_DOUBLESIDED_ON");

                            // Aggregate the double sided information
                            hasSingleSided |= !doubleSided;
                            singleSided    &= !doubleSided;
                        }
                        else
                        {
                            Debug.LogWarning("The object " + currentRenderer.name + " has null material.");
                            generalErrorFlag = true;
                        }
                    }
                }

                if (!materialIsOnlyTransparent && hasTransparentSubMaterial)
                {
                    Debug.LogWarning("The object " + currentRenderer.name + " has both transparent and opaque sub-meshes. This may cause performance issues");
                    generalErrorFlag = true;
                }

                if (!singleSided && hasSingleSided)
                {
                    Debug.LogWarning("The object " + currentRenderer.name + " has both double sided and single sided sub-meshes. The double sided flag will be ignored.");
                    generalErrorFlag = true;
                }
            }

            if (!generalErrorFlag)
            {
                Debug.Log("No errors were detected in the process.");
            }
        }
예제 #8
0
 void Awake()
 {
     probe = GetComponent<ReflectionProbe>();
 }
예제 #9
0
 public override void OnGUI(Rect rc)
 {
     EditorGUILayout.LabelField("Select Reflection Probe", EditorStyles.boldLabel, new GUILayoutOption[0]);
     EditorGUILayout.Space();
     this.m_SelectedReflectionProbe = EditorGUILayout.ObjectField("", this.m_SelectedReflectionProbe, typeof(ReflectionProbe), true, new GUILayoutOption[0]) as ReflectionProbe;
 }
 private void Start()
 {
     this.MyIntensity = base.gameObject.GetComponent <ReflectionProbe>();
 }
        public SerializedHDReflectionProbe(SerializedObject so, SerializedObject addso)
        {
            this.so    = so;
            this.addso = addso;

            target     = (ReflectionProbe)so.targetObject;
            targetData = target.GetComponent <HDAdditionalReflectionData>();

            mode = so.FindProperty("m_Mode");
            customBakedTexture   = so.FindProperty("m_CustomBakedTexture");
            renderDynamicObjects = so.FindProperty("m_RenderDynamicObjects");
            refreshMode          = so.FindProperty("m_RefreshMode");
            timeSlicingMode      = so.FindProperty("m_TimeSlicingMode");
            intensityMultiplier  = so.FindProperty("m_IntensityMultiplier");
            boxSize             = so.FindProperty("m_BoxSize");
            boxOffset           = so.FindProperty("m_BoxOffset");
            resolution          = so.FindProperty("m_Resolution");
            shadowDistance      = so.FindProperty("m_ShadowDistance");
            cullingMask         = so.FindProperty("m_CullingMask");
            useOcclusionCulling = so.FindProperty("m_UseOcclusionCulling");
            nearClip            = so.FindProperty("m_NearClip");
            farClip             = so.FindProperty("m_FarClip");
            boxProjection       = so.FindProperty("m_BoxProjection");
            legacyBlendDistance = so.FindProperty("m_BlendDistance");

            influenceShape                 = addso.Find((HDAdditionalReflectionData d) => d.influenceShape);
            influenceSphereRadius          = addso.Find((HDAdditionalReflectionData d) => d.influenceSphereRadius);
            useSeparateProjectionVolume    = addso.Find((HDAdditionalReflectionData d) => d.useSeparateProjectionVolume);
            boxReprojectionVolumeSize      = addso.Find((HDAdditionalReflectionData d) => d.boxReprojectionVolumeSize);
            boxReprojectionVolumeCenter    = addso.Find((HDAdditionalReflectionData d) => d.boxReprojectionVolumeCenter);
            sphereReprojectionVolumeRadius = addso.Find((HDAdditionalReflectionData d) => d.sphereReprojectionVolumeRadius);
            weight                      = addso.Find((HDAdditionalReflectionData d) => d.weight);
            multiplier                  = addso.Find((HDAdditionalReflectionData d) => d.multiplier);
            blendDistancePositive       = addso.Find((HDAdditionalReflectionData d) => d.blendDistancePositive);
            blendDistanceNegative       = addso.Find((HDAdditionalReflectionData d) => d.blendDistanceNegative);
            blendNormalDistancePositive = addso.Find((HDAdditionalReflectionData d) => d.blendNormalDistancePositive);
            blendNormalDistanceNegative = addso.Find((HDAdditionalReflectionData d) => d.blendNormalDistanceNegative);
            boxSideFadePositive         = addso.Find((HDAdditionalReflectionData d) => d.boxSideFadePositive);
            boxSideFadeNegative         = addso.Find((HDAdditionalReflectionData d) => d.boxSideFadeNegative);

            editorAdvancedModeBlendDistancePositive       = addso.FindProperty("editorAdvancedModeBlendDistancePositive");
            editorAdvancedModeBlendDistanceNegative       = addso.FindProperty("editorAdvancedModeBlendDistanceNegative");
            editorSimplifiedModeBlendDistance             = addso.FindProperty("editorSimplifiedModeBlendDistance");
            editorAdvancedModeBlendNormalDistancePositive = addso.FindProperty("editorAdvancedModeBlendNormalDistancePositive");
            editorAdvancedModeBlendNormalDistanceNegative = addso.FindProperty("editorAdvancedModeBlendNormalDistanceNegative");
            editorSimplifiedModeBlendNormalDistance       = addso.FindProperty("editorSimplifiedModeBlendNormalDistance");
            editorAdvancedModeEnabled = addso.FindProperty("editorAdvancedModeEnabled");
            //handle data migration from before editor value were saved
            if (editorAdvancedModeBlendDistancePositive.vector3Value == Vector3.zero &&
                editorAdvancedModeBlendDistanceNegative.vector3Value == Vector3.zero &&
                editorSimplifiedModeBlendDistance.floatValue == 0f &&
                editorAdvancedModeBlendNormalDistancePositive.vector3Value == Vector3.zero &&
                editorAdvancedModeBlendNormalDistanceNegative.vector3Value == Vector3.zero &&
                editorSimplifiedModeBlendNormalDistance.floatValue == 0f &&
                (blendDistancePositive.vector3Value != Vector3.zero ||
                 blendDistanceNegative.vector3Value != Vector3.zero ||
                 blendNormalDistancePositive.vector3Value != Vector3.zero ||
                 blendNormalDistanceNegative.vector3Value != Vector3.zero))
            {
                Vector3 positive = blendDistancePositive.vector3Value;
                Vector3 negative = blendDistanceNegative.vector3Value;
                //exact advanced
                editorAdvancedModeBlendDistancePositive.vector3Value = positive;
                editorAdvancedModeBlendDistanceNegative.vector3Value = negative;
                //aproximated simplified
                editorSimplifiedModeBlendDistance.floatValue = Mathf.Max(positive.x, positive.y, positive.z, negative.x, negative.y, negative.z);

                positive = blendNormalDistancePositive.vector3Value;
                negative = blendNormalDistanceNegative.vector3Value;
                //exact advanced
                editorAdvancedModeBlendNormalDistancePositive.vector3Value = positive;
                editorAdvancedModeBlendNormalDistanceNegative.vector3Value = negative;
                //aproximated simplified
                editorSimplifiedModeBlendNormalDistance.floatValue = Mathf.Max(positive.x, positive.y, positive.z, negative.x, negative.y, negative.z);

                //display old data
                editorAdvancedModeEnabled.boolValue = true;
                Apply();
            }

            proxyVolumeComponent = addso.Find((HDAdditionalReflectionData d) => d.proxyVolumeComponent);
        }
예제 #12
0
 void Reset()
 {
     reflections = GameObject.FindObjectOfType <ReflectionProbe>();
 }
예제 #13
0
 public ReflectionProbeData(GameObject sphere, MeshRenderer rend, Material mat, ReflectionProbe probe, RenderTexture envMap)
 {
     this.reflectionSphere = sphere;
     this.render           = rend;
     this.skyboxMateral    = mat;
     this.probe            = probe;
     this.renderedCube     = envMap;
 }
예제 #14
0
        static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
        {
            var col = Gizmos.color;
            var mat = Gizmos.matrix;

            Gizmo6FacesBoxContained box;
            Vector3 boxCenterOffset;
            Vector3 boxSizeOffset;
            float   sphereRadiusOffset;
            Color   color;

            switch (type)
            {
            default:
            case InfluenceType.Standard:
            {
                box                = e != null ? e.m_UIState.alternativeBoxBlendHandle : null;
                boxCenterOffset    = a.boxBlendCenterOffset;
                boxSizeOffset      = a.boxBlendSizeOffset;
                sphereRadiusOffset = a.sphereBlendRadiusOffset;
                color              = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
                break;
            }

            case InfluenceType.Normal:
            {
                box                = e != null ? e.m_UIState.alternativeBoxBlendNormalHandle : null;
                boxCenterOffset    = a.boxBlendNormalCenterOffset;
                boxSizeOffset      = a.boxBlendNormalSizeOffset;
                sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
                color              = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
                break;
            }
            }

            Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
            switch (a.influenceShape)
            {
            case ShapeType.Box:
            {
                Gizmos.color = color;
                if (e != null)         // e == null may occure when editor have still not been created at selection while the tool is not used for this part
                {
                    box.DrawHull(isEdit);
                }
                else
                {
                    if (isEdit)
                    {
                        Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                    }
                    else
                    {
                        Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                    }
                }
                break;
            }

            case ShapeType.Sphere:
            {
                Gizmos.color = color;
                if (isEdit)
                {
                    Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                else
                {
                    Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                break;
            }
            }

            Gizmos.matrix = mat;
            Gizmos.color  = col;
        }
 void Start()
 {
     this.probe = GetComponent <ReflectionProbe>();
 }
	void Awake () 
	{
		rp = gameObject.GetComponent<ReflectionProbe>();
		lastRenderTime = Time.time - 1.0f/renderRate;
	}
예제 #17
0
 void Start()
 {
     reflection = GetComponent<ReflectionProbe>();
 }
 private void OnEnable()
 {
     reflectionProbe = GetComponent<ReflectionProbe>();
     updater = StartCoroutine(ReflectionProbeUpdate());
 }
예제 #19
0
 // Use this for initialization
 void Start()
 {
     rProbe = GetComponent<ReflectionProbe>();
     StartCoroutine(UpdateProbe());
 }
 internal void UpdateOldLocalSpace(ReflectionProbe target)
 {
     oldLocalSpace = HDReflectionProbeEditorUtility.GetLocalSpace(target);
 }
예제 #21
0
        static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, Editor e, InfluenceType type, bool isEdit)
        {
            var col = Gizmos.color;
            var mat = Gizmos.matrix;

            Vector3 boxCenterOffset;
            Vector3 boxSizeOffset;
            float   sphereRadiusOffset;
            Color   color;

            switch (type)
            {
            default:
            case InfluenceType.Standard:
            {
                boxCenterOffset    = a.boxBlendCenterOffset;
                boxSizeOffset      = a.boxBlendSizeOffset;
                sphereRadiusOffset = a.sphereBlendRadiusOffset;
                color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
                break;
            }

            case InfluenceType.Normal:
            {
                boxCenterOffset    = a.boxBlendNormalCenterOffset;
                boxSizeOffset      = a.boxBlendNormalSizeOffset;
                sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
                color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
                break;
            }
            }

            Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
            switch (a.influenceShape)
            {
            case ShapeType.Box:
            {
                Gizmos.color = color;
                if (isEdit)
                {
                    Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                }
                else
                {
                    Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                }
                break;
            }

            case ShapeType.Sphere:
            {
                Gizmos.color = color;
                if (isEdit)
                {
                    Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                else
                {
                    Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                break;
            }
            }

            Gizmos.matrix = mat;
            Gizmos.color  = col;
        }
예제 #22
0
 void Awake()
 {
     probe = GetComponent <ReflectionProbe>();
 }
예제 #23
0
 private bool IsCollidingWithOtherProbes(string targetPath, ReflectionProbe targetProbe, out ReflectionProbe collidingProbe)
 {
     ReflectionProbe[] probeArray = UnityEngine.Object.FindObjectsOfType <ReflectionProbe>().ToArray <ReflectionProbe>();
     collidingProbe = null;
     foreach (ReflectionProbe probe in probeArray)
     {
         if (((probe != targetProbe) && (probe.customBakedTexture != null)) && (AssetDatabase.GetAssetPath(probe.customBakedTexture) == targetPath))
         {
             collidingProbe = probe;
             return(true);
         }
     }
     return(false);
 }
        public static void ResetProbeSceneTextureInMaterial(ReflectionProbe p)
        {
            var renderer = p.GetComponent <Renderer>();

            renderer.sharedMaterial.SetTexture(_Cubemap, p.texture);
        }
예제 #25
0
        private bool ValidPreviewSetup()
        {
            ReflectionProbe target = (ReflectionProbe)this.target;

            return((target != null) && (target.texture != null));
        }
        internal static void ChangeVisibility(ReflectionProbe p, bool visible)
        {
            var meshRenderer = p.GetComponent <MeshRenderer>() ?? p.gameObject.AddComponent <MeshRenderer>();

            meshRenderer.enabled = visible;
        }
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            if (base.targets.Length == 1)
            {
                this.DoToolbar();
            }
            this.m_ShowProbeModeRealtimeOptions.target = (this.reflectionProbeMode == ReflectionProbeMode.Realtime);
            this.m_ShowProbeModeCustomOptions.target   = (this.reflectionProbeMode == ReflectionProbeMode.Custom);
            EditorGUILayout.IntPopup(this.m_Mode, ReflectionProbeEditor.Styles.reflectionProbeMode, ReflectionProbeEditor.Styles.reflectionProbeModeValues, ReflectionProbeEditor.Styles.typeText, new GUILayoutOption[0]);
            if (!this.m_Mode.hasMultipleDifferentValues)
            {
                EditorGUI.indentLevel++;
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeCustomOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_RenderDynamicObjects, ReflectionProbeEditor.Styles.renderDynamicObjects, new GUILayoutOption[0]);
                    EditorGUI.BeginChangeCheck();
                    EditorGUI.showMixedValue = this.m_CustomBakedTexture.hasMultipleDifferentValues;
                    UnityEngine.Object objectReferenceValue = EditorGUILayout.ObjectField(ReflectionProbeEditor.Styles.customCubemapText, this.m_CustomBakedTexture.objectReferenceValue, typeof(Cubemap), false, new GUILayoutOption[0]);
                    EditorGUI.showMixedValue = false;
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_CustomBakedTexture.objectReferenceValue = objectReferenceValue;
                    }
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeRealtimeOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_RefreshMode, ReflectionProbeEditor.Styles.refreshMode, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_TimeSlicingMode, ReflectionProbeEditor.Styles.timeSlicing, new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
                EditorGUILayout.EndFadeGroup();
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.Space();
            GUILayout.Label(ReflectionProbeEditor.Styles.runtimeSettingsHeader, new GUILayoutOption[0]);
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(this.m_Importance, ReflectionProbeEditor.Styles.importanceText, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_IntensityMultiplier, ReflectionProbeEditor.Styles.intensityText, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_BoxProjection, ReflectionProbeEditor.Styles.boxProjectionText, new GUILayoutOption[0]);
            bool flag  = SceneView.IsUsingDeferredRenderingPath();
            bool flag2 = flag && UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled;

            using (new EditorGUI.DisabledScope(!flag2))
            {
                EditorGUILayout.PropertyField(this.m_BlendDistance, ReflectionProbeEditor.Styles.blendDistanceText, new GUILayoutOption[0]);
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBoxOptions.faded))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(this.m_BoxSize, ReflectionProbeEditor.Styles.sizeText, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_BoxOffset, ReflectionProbeEditor.Styles.centerText, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    Vector3 vector3Value  = this.m_BoxOffset.vector3Value;
                    Vector3 vector3Value2 = this.m_BoxSize.vector3Value;
                    if (this.ValidateAABB(ref vector3Value, ref vector3Value2))
                    {
                        this.m_BoxOffset.vector3Value = vector3Value;
                        this.m_BoxSize.vector3Value   = vector3Value2;
                    }
                }
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
            GUILayout.Label(ReflectionProbeEditor.Styles.captureCubemapHeaderText, new GUILayoutOption[0]);
            EditorGUI.indentLevel++;
            EditorGUILayout.IntPopup(this.m_Resolution, ReflectionProbeEditor.Styles.renderTextureSizes.ToArray(), ReflectionProbeEditor.Styles.renderTextureSizesValues.ToArray(), ReflectionProbeEditor.Styles.resolutionText, new GUILayoutOption[]
            {
                GUILayout.MinWidth(40f)
            });
            EditorGUILayout.PropertyField(this.m_HDR, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_ShadowDistance, new GUILayoutOption[0]);
            EditorGUILayout.IntPopup(this.m_ClearFlags, ReflectionProbeEditor.Styles.clearFlags, ReflectionProbeEditor.Styles.clearFlagsValues, ReflectionProbeEditor.Styles.clearFlagsText, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_BackgroundColor, ReflectionProbeEditor.Styles.backgroundColorText, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_UseOcclusionCulling, new GUILayoutOption[0]);
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarProperties, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]);
            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
            if (base.targets.Length == 1)
            {
                ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;
                if (reflectionProbe.mode == ReflectionProbeMode.Custom && reflectionProbe.customBakedTexture != null)
                {
                    Cubemap cubemap = reflectionProbe.customBakedTexture as Cubemap;
                    if (cubemap && cubemap.mipmapCount == 1)
                    {
                        EditorGUILayout.HelpBox("No mipmaps in the cubemap, Smoothness value in Standard shader will be ignored.", MessageType.Warning);
                    }
                }
            }
            this.DoBakeButton();
            EditorGUILayout.Space();
            base.serializedObject.ApplyModifiedProperties();
        }
        public static Matrix4x4 GetLocalSpace(ReflectionProbe probe)
        {
            var t = probe.transform.position;

            return(Matrix4x4.TRS(t, GetLocalSpaceRotation(probe), Vector3.one));
        }
        private static IEnumerator LoadLegacyPreset(ProfileData preset, PHIBL.PHIBL phIBL)
        {
            yield return(new WaitForSeconds(.1f));

            Profile  profile  = preset.profile;
            float    nipples  = preset.nipples;
            Traverse traverse = Traverse.Create(phIBL);

            traverse.Method("LoadPostProcessingProfile", profile).GetValue();
            DeferredShadingUtils deferredShading = traverse.Field("deferredShading").GetValue <DeferredShadingUtils>();

            PHIBL.AlloyDeferredRendererPlus SSSSS = deferredShading.SSSSS;
            Traverse trav = Traverse.Create(SSSSS);

            trav.Field("TransmissionSettings").SetValue(profile.TransmissionSettings);
            trav.Field("SkinSettings").SetValue(profile.SkinSettings);
            trav.Method("Reset").GetValue();
            traverse.Field("phong").SetValue(profile.phong);
            traverse.Field("edgelength").SetValue(profile.edgeLength);
            DeferredShadingUtils.SetTessellation(profile.phong, profile.edgeLength);
            traverse.Field("nippleSSS").SetValue(nipples);
            Shader.SetGlobalFloat(Shader.PropertyToID("_AlphaSSS"), nipples);
            QualitySettings.shadowDistance   = preset.shadowDistance;
            RenderSettings.reflectionBounces = preset.reflectionBounces;
            ReflectionProbe probe = traverse.Field("probeComponent").GetValue <ReflectionProbe>();

            probe.resolution = preset.probeResolution;
            probe.intensity  = preset.probeIntensity;

            var PPCtrl_obj = traverse.Field("PPCtrl").GetValue <PHIBL.PostProcessing.Utilities.PostProcessingController>();

            PPCtrl_obj.enableDither = preset.enableDithering;

            if (preset.enabledLUT)
            {
                string[] names = traverse.Field("LutFileNames").GetValue <string[]>();
                if (names.Length >= preset.selectedLUT)
                {
                    string path = PHIBL.UserData.Path + "PHIBL/Settings/" + names[preset.selectedLUT] + ".png";
                    if (File.Exists(path))
                    {
                        traverse.Field("selectedUserLut").SetValue(preset.selectedLUT);

                        Texture2D texture2D = new Texture2D(1024, 32, TextureFormat.ARGB32, false, true);

                        byte[] Ldata = File.ReadAllBytes(path);
                        texture2D.LoadImage(Ldata);
                        texture2D.filterMode = FilterMode.Trilinear;
                        texture2D.anisoLevel = 0;
                        texture2D.wrapMode   = TextureWrapMode.Repeat;

                        PPCtrl_obj.userLut.lut          = texture2D;
                        PPCtrl_obj.userLut.contribution = preset.contributionLUT;
                        PPCtrl_obj.controlUserLut       = true;
                        PPCtrl_obj.enableUserLut        = true;
                    }
                }
            }
            else
            {
                PPCtrl_obj.enableUserLut = false;
            }

            Console.WriteLine("[PHIBL_PresetLoad] Loaded LEGACY preset");
        }
 public static bool IsCollidingWithOtherProbes(string targetPath, ReflectionProbe targetProbe, out ReflectionProbe collidingProbe)
 {
     ReflectionProbe[] probes = Object.FindObjectsOfType <ReflectionProbe>().ToArray();
     collidingProbe = null;
     foreach (var probe in probes)
     {
         if (probe == targetProbe || probe.customBakedTexture == null)
         {
             continue;
         }
         string path = AssetDatabase.GetAssetPath(probe.customBakedTexture);
         if (path == targetPath)
         {
             collidingProbe = probe;
             return(true);
         }
     }
     return(false);
 }
 internal static extern bool BakeReflectionProbeSnapshot(ReflectionProbe probe);
 public static bool BakeReflectionProbeSnapshot(ReflectionProbe probe)
 {
     return((bool)k_Lightmapping_BakeReflectionProbeSnapshot.Invoke(null, new object[] { probe }));
 }
 //Unity Start() method
 void Start()
 {
     rProbe = GetComponent<ReflectionProbe>();
     gameMaster = GameController.gameMaster;
     setQuality();
 }
        public void RenderLightVolumes(CommandBuffer cmd, HDCamera hdCamera, CullingResults cullResults, LightingDebugSettings lightDebugSettings)
        {
            // Clear the buffers
            HDUtils.SetRenderTarget(cmd, hdCamera, m_ColorAccumulationBuffer, ClearFlag.Color, Color.black);
            HDUtils.SetRenderTarget(cmd, hdCamera, m_LightCountBuffer, ClearFlag.Color, Color.black);
            HDUtils.SetRenderTarget(cmd, hdCamera, m_DebugLightVolumesTexture, ClearFlag.Color, Color.black);

            // Set the render target array
            cmd.SetRenderTarget(m_RTIDs, m_DepthBuffer);

            // First of all let's do the regions for the light sources (we only support Punctual and Area)
            int numLights = cullResults.visibleLights.Length;

            for (int lightIdx = 0; lightIdx < numLights; ++lightIdx)
            {
                // Let's build the light's bounding sphere matrix
                Light currentLegacyLight = cullResults.visibleLights[lightIdx].light;
                if (currentLegacyLight == null)
                {
                    continue;
                }
                HDAdditionalLightData currentHDRLight = currentLegacyLight.GetComponent <HDAdditionalLightData>();
                if (currentHDRLight == null)
                {
                    continue;
                }

                Matrix4x4 positionMat = Matrix4x4.Translate(currentLegacyLight.transform.position);

                if (currentLegacyLight.type == LightType.Point || currentLegacyLight.type == LightType.Area)
                {
                    m_MaterialProperty.SetVector(_RangeShaderID, new Vector3(currentLegacyLight.range, currentLegacyLight.range, currentLegacyLight.range));
                    switch (currentHDRLight.lightTypeExtent)
                    {
                    case LightTypeExtent.Punctual:
                    {
                        m_MaterialProperty.SetColor(_ColorShaderID, new Color(0.0f, 0.5f, 0.0f, 1.0f));
                        m_MaterialProperty.SetVector(_OffsetShaderID, new Vector3(0, 0, 0));
                        cmd.DrawMesh(DebugShapes.instance.RequestSphereMesh(), positionMat, m_DebugLightVolumeMaterial, 0, -1, m_MaterialProperty);
                    }
                    break;

                    case LightTypeExtent.Rectangle:
                    {
                        m_MaterialProperty.SetColor(_ColorShaderID, new Color(0.0f, 1.0f, 1.0f, 1.0f));
                        m_MaterialProperty.SetVector(_OffsetShaderID, new Vector3(0, 0, 0));
                        cmd.DrawMesh(DebugShapes.instance.RequestSphereMesh(), positionMat, m_DebugLightVolumeMaterial, 0, -1, m_MaterialProperty);
                    }
                    break;

                    case LightTypeExtent.Tube:
                    {
                        m_MaterialProperty.SetColor(_ColorShaderID, new Color(1.0f, 0.0f, 0.5f, 1.0f));
                        m_MaterialProperty.SetVector(_OffsetShaderID, new Vector3(0, 0, 0));
                        cmd.DrawMesh(DebugShapes.instance.RequestSphereMesh(), positionMat, m_DebugLightVolumeMaterial, 0, -1, m_MaterialProperty);
                    }
                    break;

                    default:
                        break;
                    }
                }
                else if (currentLegacyLight.type == LightType.Spot)
                {
                    if (currentHDRLight.spotLightShape == SpotLightShape.Cone)
                    {
                        float bottomRadius = Mathf.Tan(currentLegacyLight.spotAngle * Mathf.PI / 360.0f) * currentLegacyLight.range;
                        m_MaterialProperty.SetColor(_ColorShaderID, new Color(1.0f, 0.5f, 0.0f, 1.0f));
                        m_MaterialProperty.SetVector(_RangeShaderID, new Vector3(bottomRadius, bottomRadius, currentLegacyLight.range));
                        m_MaterialProperty.SetVector(_OffsetShaderID, new Vector3(0, 0, 0));
                        cmd.DrawMesh(DebugShapes.instance.RequestConeMesh(), currentLegacyLight.gameObject.transform.localToWorldMatrix, m_DebugLightVolumeMaterial, 0, -1, m_MaterialProperty);
                    }
                    else if (currentHDRLight.spotLightShape == SpotLightShape.Box)
                    {
                        m_MaterialProperty.SetColor(_ColorShaderID, new Color(1.0f, 0.5f, 0.0f, 1.0f));
                        m_MaterialProperty.SetVector(_RangeShaderID, new Vector3(currentHDRLight.shapeWidth, currentHDRLight.shapeHeight, currentLegacyLight.range));
                        m_MaterialProperty.SetVector(_OffsetShaderID, new Vector3(0, 0, currentLegacyLight.range / 2.0f));
                        cmd.DrawMesh(DebugShapes.instance.RequestBoxMesh(), currentLegacyLight.gameObject.transform.localToWorldMatrix, m_DebugLightVolumeMaterial, 0, -1, m_MaterialProperty);
                    }
                    else if (currentHDRLight.spotLightShape == SpotLightShape.Pyramid)
                    {
                        float bottomWidth = Mathf.Tan(currentLegacyLight.spotAngle * Mathf.PI / 360.0f) * currentLegacyLight.range;
                        m_MaterialProperty.SetColor(_ColorShaderID, new Color(1.0f, 0.5f, 0.0f, 1.0f));
                        m_MaterialProperty.SetVector(_RangeShaderID, new Vector3(currentHDRLight.aspectRatio * bottomWidth * 2, bottomWidth * 2, currentLegacyLight.range));
                        m_MaterialProperty.SetVector(_OffsetShaderID, new Vector3(0, 0, 0));
                        cmd.DrawMesh(DebugShapes.instance.RequestPyramidMesh(), currentLegacyLight.gameObject.transform.localToWorldMatrix, m_DebugLightVolumeMaterial, 0, -1, m_MaterialProperty);
                    }
                }
            }

            // Now let's do the same but for reflection probes
            int numProbes = cullResults.visibleReflectionProbes.Length;

            for (int probeIdx = 0; probeIdx < numProbes; ++probeIdx)
            {
                // Let's build the light's bounding sphere matrix
                ReflectionProbe            currentLegacyProbe = cullResults.visibleReflectionProbes[probeIdx].reflectionProbe;
                HDAdditionalReflectionData currentHDProbe     = currentLegacyProbe.GetComponent <HDAdditionalReflectionData>();

                if (!currentHDProbe)
                {
                    continue;
                }

                MaterialPropertyBlock m_MaterialProperty = new MaterialPropertyBlock();
                Mesh targetMesh = null;
                if (currentHDProbe.influenceVolume.shape == InfluenceShape.Sphere)
                {
                    m_MaterialProperty.SetVector(_RangeShaderID, new Vector3(currentHDProbe.influenceVolume.sphereRadius, currentHDProbe.influenceVolume.sphereRadius, currentHDProbe.influenceVolume.sphereRadius));
                    targetMesh = DebugShapes.instance.RequestSphereMesh();
                }
                else
                {
                    m_MaterialProperty.SetVector(_RangeShaderID, new Vector3(currentHDProbe.influenceVolume.boxSize.x, currentHDProbe.influenceVolume.boxSize.y, currentHDProbe.influenceVolume.boxSize.z));
                    targetMesh = DebugShapes.instance.RequestBoxMesh();
                }

                m_MaterialProperty.SetColor(_ColorShaderID, new Color(1.0f, 1.0f, 0.0f, 1.0f));
                m_MaterialProperty.SetVector(_OffsetShaderID, new Vector3(0, 0, 0));
                Matrix4x4 positionMat = Matrix4x4.Translate(currentLegacyProbe.transform.position);
                cmd.DrawMesh(targetMesh, positionMat, m_DebugLightVolumeMaterial, 0, -1, m_MaterialProperty);
            }

            // Define which kernel to use based on the lightloop options
            int targetKernel = lightDebugSettings.lightVolumeDebugByCategory == LightLoop.LightVolumeDebug.ColorAndEdge ? m_DebugLightVolumeColorsKernel : m_DebugLightVolumeGradientKernel;

            // Set the input params for the compute
            cmd.SetComputeTextureParam(m_DebugLightVolumeCompute, targetKernel, _DebugLightCountBufferShaderID, m_LightCountBuffer);
            cmd.SetComputeTextureParam(m_DebugLightVolumeCompute, targetKernel, _DebugColorAccumulationBufferShaderID, m_ColorAccumulationBuffer);
            cmd.SetComputeTextureParam(m_DebugLightVolumeCompute, targetKernel, _DebugLightVolumesTextureShaderID, m_DebugLightVolumesTexture);
            cmd.SetComputeTextureParam(m_DebugLightVolumeCompute, targetKernel, _ColorGradientTextureShaderID, m_ColorGradientTexture);
            cmd.SetComputeIntParam(m_DebugLightVolumeCompute, _MaxDebugLightCountShaderID, (int)lightDebugSettings.maxDebugLightCount);

            // Texture dimensions
            int texWidth  = m_ColorAccumulationBuffer.rt.width;
            int texHeight = m_ColorAccumulationBuffer.rt.width;


            // Dispatch the compute
            int lightVolumesTileSize = 8;
            int numTilesX            = (texWidth + (lightVolumesTileSize - 1)) / lightVolumesTileSize;
            int numTilesY            = (texHeight + (lightVolumesTileSize - 1)) / lightVolumesTileSize;

            cmd.DispatchCompute(m_DebugLightVolumeCompute, targetKernel, numTilesX, numTilesY, 1);

            // Blit this into the camera target
            cmd.SetRenderTarget(BuiltinRenderTextureType.CameraTarget);
            m_MaterialProperty.SetTexture(HDShaderIDs._BlitTexture, m_DebugLightVolumesTexture);
            cmd.DrawProcedural(Matrix4x4.identity, m_DebugLightVolumeMaterial, 1, MeshTopology.Triangles, 3, 1, m_MaterialProperty);
        }
예제 #35
0
 public void OnEnable()
 {
     this.m_SelectedReflectionProbe = EditorUtility.InstanceIDToObject(SessionState.GetInt("PreviewReflectionProbe", 0)) as ReflectionProbe;
 }
예제 #36
0
        protected virtual void Awake()
        {
            // Save initial settings in case we wish to restore them
            startSky = RenderSettings.skybox;

            // Pick camera based on platform
            #if WINDOWS_UWP && !UNITY_EDITOR
            cameraCapture = new CameraCaptureUWP();
            #elif (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
            captureCamera = new CameraCaptureARFoundation();
            #else
            // On a desktop computer, or certain laptops, we may not have access to any cameras.
            if (WebCamTexture.devices.Length <= 0)
            {
                // Alternatively, you can simulate a camera by taking screenshots instead.
                // captureCamera = new CameraCaptureScreen(Camera.main);

                // When disabling and returning immediately, OnDisable will be called without
                // OnEnable ever getting called.
                enabled = false;
                return;
            }
            else
            {
                cameraCapture = new CameraCaptureWebcam(Camera.main.transform, Camera.main.fieldOfView);
            }
            #endif

            // Try to get camera control as well
            cameraControl = cameraCapture as ICameraControl;

            // Make sure we have access to a probe in the scene
            if (probe == null)
            {
                probe = FindObjectOfType <ReflectionProbe>();
            }
            if (probe == null)
            {
                GameObject probeObj = new GameObject("_LightCaptureProbe", typeof(ReflectionProbe));
                probeObj.transform.SetParent(transform, false);
                probe = probeObj.GetComponent <ReflectionProbe>();

                probe.size          = Vector3.one * 10000;
                probe.boxProjection = false;
            }

            // Same with a camera object
            if (cameraOrientation == null)
            {
                cameraOrientation = Camera.main.transform;
            }

            // And check for a directional light in the scene
            if (useDirectionalLight && directionalLight == null)
            {
                Light[] lights = FindObjectsOfType <Light>();
                for (int i = 0; i < lights.Length; i++)
                {
                    if (lights[i].type == LightType.Directional)
                    {
                        directionalLight = lights[i];
                        break;
                    }
                }
                if (directionalLight == null)
                {
                    GameObject lightObj = new GameObject("_DirectionalLight", typeof(Light));
                    lightObj.transform.SetParent(transform, false);
                    directionalLight      = lightObj.GetComponent <Light>();
                    directionalLight.type = LightType.Directional;
                }
            }

            // Save initial light settings
            if (directionalLight != null)
            {
                startLightColor      = directionalLight.color;
                startLightRot        = directionalLight.transform.rotation;
                startLightBrightness = directionalLight.intensity;
            }
        }
예제 #37
0
 void Awake()
 {
     probe = GetComponent <ReflectionProbe>();
     probe.RenderProbe();
 }
예제 #38
0
 void CloneReflectionProbe()
 {
     reflectionProbe = Instantiate(reflectionProbeToCopy, transform.position, transform.rotation, transform);
     reflectionProbe.bakedTexture = reflectionProbeToCopy.bakedTexture;
 }
    static int _CreateReflectionProbe(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            ReflectionProbe obj = new ReflectionProbe();
            LuaScriptMgr.Push(L, obj);
            return 1;
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: ReflectionProbe.New");
        }

        return 0;
    }
예제 #40
0
 /// <summary> Check if the provided reflection probe is compatible with High-Definition Render Pipeline </summary>
 /// <param name="reflectionProbe">The ReflectionProbe to check</param>
 /// <returns>True if it is compatible, false otherwise</returns>
 public static bool IsHDReflectionProbe(ReflectionProbe reflectionProbe)
 => reflectionProbe.GetComponent <HDAdditionalReflectionData>() != null;
예제 #41
0
 void Awake()
 {
     probe = GetComponent<ReflectionProbe>();
     camT = Camera.main.transform;
 }
예제 #42
0
    private IEnumerator secondaryBake(ReflectionProbe rp)
    {
        yield return(new WaitForSeconds(1.5f));

        rp.RenderProbe();
    }