Bake final lightmaps
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
public class GenerateLightProbes : MonoBehaviour
|
||||
{
|
||||
@@ -54,17 +55,12 @@ public class GenerateLightProbes : MonoBehaviour
|
||||
|
||||
GameObject[] objectsInScene = UnityEngine.Object.FindObjectsOfType<GameObject>() ;
|
||||
foreach(GameObject obj in objectsInScene)
|
||||
{
|
||||
if(obj.isStatic){
|
||||
|
||||
if(obj.GetComponent<Renderer>() != null){
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.max);
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.min);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
{
|
||||
if (!obj.isStatic) continue;
|
||||
if (obj.GetComponent<Renderer>() == null) continue;
|
||||
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.max);
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.min);
|
||||
}
|
||||
|
||||
lightProbes.GetComponent<LightProbeGroup>().probePositions = probeLocations.ToArray();
|
||||
@@ -87,20 +83,18 @@ public class GenerateLightProbes : MonoBehaviour
|
||||
|
||||
GameObject[] objectsInScene = UnityEngine.Object.FindObjectsOfType<GameObject>() ;
|
||||
foreach(GameObject obj in objectsInScene)
|
||||
{
|
||||
if(obj.isStatic){
|
||||
{
|
||||
if (!obj.isStatic) continue;
|
||||
if (obj.GetComponent<Renderer>() == null) continue;
|
||||
if (obj.name.ToLower().Contains("light") || obj.name.ToLower().Contains("lamp")) continue;
|
||||
if (obj.GetComponent<Renderer>().lightProbeUsage == LightProbeUsage.Off) continue;
|
||||
|
||||
if(obj.GetComponent<Renderer>() != null){
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.max);
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.min);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.max);
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.min);
|
||||
}
|
||||
|
||||
int boundProbes = probeLocations.Count *2;
|
||||
for(int i = 0; i < boundProbes; i++)
|
||||
for(var i = 0; i < boundProbes; i++)
|
||||
{
|
||||
probeLocations.Add(Vector3.Lerp(probeLocations[Random.Range(0,boundProbes/2)], probeLocations[Random.Range(0,boundProbes/2)], 0.5f));
|
||||
|
||||
@@ -126,16 +120,14 @@ public class GenerateLightProbes : MonoBehaviour
|
||||
|
||||
GameObject[] objectsInScene = UnityEngine.Object.FindObjectsOfType<GameObject>() ;
|
||||
foreach(GameObject obj in objectsInScene)
|
||||
{
|
||||
if(obj.isStatic){
|
||||
|
||||
if(obj.GetComponent<Renderer>() != null){
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.max);
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.min);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
{
|
||||
if (!obj.isStatic) continue;
|
||||
if (obj.GetComponent<Renderer>() == null) continue;
|
||||
if (obj.name.ToLower().Contains("light") || obj.name.ToLower().Contains("lamp")) continue;
|
||||
if (obj.GetComponent<Renderer>().lightProbeUsage == LightProbeUsage.Off) continue;
|
||||
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.max);
|
||||
probeLocations.Add( obj.GetComponent<Renderer>().bounds.min);
|
||||
}
|
||||
|
||||
int boundProbes = probeLocations.Count *4;
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.subsystemregistration": "1.0.5"
|
||||
"com.unity.subsystemregistration": "1.0.6"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user