Jump to content

Terrain appears dark, textureless when GTS is added to project/terrain (URP, Unity 2021.3.15f1)


neurodr0me

Recommended Posts

URP, Unity 2021.3.15f1

Terrain with normal shader:

image.png?width=833&height=587

Terrain when texture areas are created after applying profile:

image.png?width=803&height=587

 

Getting spammed in console with errors:

Quote

NullReferenceException: Object reference not set to an instance of an object
ProceduralWorlds.GTS.GTSProfile.RefreshTerrainLayers (ProceduralWorlds.GTS.GTSTerrain gtsTerrain, System.Boolean updateExisting) (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:778)
ProceduralWorlds.GTS.GTSTerrain.StartProfile (ProceduralWorlds.GTS.GTSProfile profile) (at Assets/Procedural Worlds/GTS/Scripts/Core/MonoBehaviours/GTSTerrain.cs:690)
ProceduralWorlds.GTS.GTSProfile.StartProfile () (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:546)
ProceduralWorlds.GTS.GTSProfile.CreateTextureArrays () (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:951)
ProceduralWorlds.GTS.GTSTerrainEditor.MainPanel (System.Boolean helpEnabled) (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomEditors/GTSTerrainEditor.cs:80)
PWCommon5.EditorUtils.Panel (UnityEngine.GUIContent panelLabel, System.String helpKey, System.Action`1[T] contentMethod, UnityEngine.GUIStyle labelStyle, System.Boolean ignoreGuiChange, System.Boolean defaultStatus, System.Boolean showVersionNumber, UnityEngine.GUILayoutOption[] options) (at <5e780e565d3b4b63836c767b4e8e9d7f>:0)
PWCommon5.EditorUtils.Panel (UnityEngine.GUIContent panelLabel, System.String helpKey, System.Action`1[T] contentMethod, System.Boolean ignoreGuiChange, System.Boolean defaultStatus, System.Boolean showVersionNumber, UnityEngine.GUILayoutOption[] options) (at <5e780e565d3b4b63836c767b4e8e9d7f>:0)
PWCommon5.EditorUtils.Panel (System.String nameKey, System.Action`1[T] contentMethod, System.Boolean defaultStatus, UnityEngine.GUILayoutOption[] options) (at <5e780e565d3b4b63836c767b4e8e9d7f>:0)
ProceduralWorlds.GTS.GTSTerrainEditor.OnInspectorGUI () (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomEditors/GTSTerrainEditor.cs:53)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <5457beb9f0d445908d881ac040090912>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

 

Link to comment
Share on other sites

Problem seems to be limited to this scene. This scene has exactly 2 terrains. If I make a dummy scene, generate a terrain, and apply GTS, it works as expected. That dummy scene only had 1 terrain, not sure if that's important.

Reloading this scene (I did not save it once GTS broke it, and I deleted the GTS user info folder to start fresh), let's go through the steps: Here it is with normal shader, both terrains visible, GTS manager is clearly nude, terrain clearly has layers, both terrains have the same exact layers in the exact same order.

image.png?width=1496&height=587

I hit NEW profile on the GTS manager. I name it Test1. I hit... okay, so this is different now.

Now I can't even get it to break the terrain 😅

When I try to click Apply Profile, nothing at all happens. Console spits this:

NullReferenceException: Object reference not set to an instance of an object
ProceduralWorlds.GTS.GTSProfile.RefreshTerrainLayers (ProceduralWorlds.GTS.GTSTerrain gtsTerrain, System.Boolean updateExisting) (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:778)
ProceduralWorlds.GTS.GTSTerrain.ApplyProfile () (at Assets/Procedural Worlds/GTS/Scripts/Core/MonoBehaviours/GTSTerrain.cs:669)
ProceduralWorlds.GTS.GTSProfile.ApplyProfile () (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:512)
ProceduralWorlds.GTS.GTSProfileEditor.DrawActionButtons (System.Boolean helpEnabled) (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomEditors/GTSProfileEditor.cs:169)
ProceduralWorlds.GTS.GTSManagerEditor.MainPanel (System.Boolean helpEnabled) (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomEditors/GTSManagerEditor.cs:127)
PWCommon5.EditorUtils.Panel (UnityEngine.GUIContent panelLabel, System.String helpKey, System.Action`1[T] contentMethod, UnityEngine.GUIStyle labelStyle, System.Boolean ignoreGuiChange, System.Boolean defaultStatus, System.Boolean showVersionNumber, UnityEngine.GUILayoutOption[] options) (at <5e780e565d3b4b63836c767b4e8e9d7f>:0)
PWCommon5.EditorUtils.Panel (UnityEngine.GUIContent panelLabel, System.String helpKey, System.Action`1[T] contentMethod, System.Boolean ignoreGuiChange, System.Boolean defaultStatus, System.Boolean showVersionNumber, UnityEngine.GUILayoutOption[] options) (at <5e780e565d3b4b63836c767b4e8e9d7f>:0)
PWCommon5.EditorUtils.Panel (System.String nameKey, System.Action`1[T] contentMethod, System.Boolean defaultStatus, UnityEngine.GUILayoutOption[] options) (at <5e780e565d3b4b63836c767b4e8e9d7f>:0)
ProceduralWorlds.GTS.GTSManagerEditor.OnInspectorGUI () (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomEditors/GTSManagerEditor.cs:61)
ProceduralWorlds.GTS.GTSManagerEditorWindow.OnGUI () (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomWindows/GTSManagerEditorWindow.cs:72)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at <63965ae56af7489797f355b7c1211ab2>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect dockAreaRect) (at <63965ae56af7489797f355b7c1211ab2>:0)
UnityEditor.DockArea.OldOnGUI () (at <63965ae56af7489797f355b7c1211ab2>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <43b8187fb18447918f21fa5a5862732e>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <5d16470ce3bd47028b26ad1771a0de88>:0)

 

Link to comment
Share on other sites

I tried again, wiped out the GTS User Data folder again. Created a new profile. Noticed something strange.

The Texture Layers are populated already:

image.png?width=251&height=587

Link to comment
Share on other sites

I hit Clear Layers, and the list cleared out. I then hit Refresh Layers, and the UI does not respond (same as pressing Apply Profile) and I get this in console.

 

NullReferenceException: Object reference not set to an instance of an object
ProceduralWorlds.GTS.GTSProfile.RefreshTerrainLayers (ProceduralWorlds.GTS.GTSTerrain gtsTerrain, System.Boolean updateExisting) (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:778)
ProceduralWorlds.GTS.GTSProfile.RefreshTerrainLayers (UnityEngine.Terrain[] terrains, System.Boolean updateExisting) (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:722)
ProceduralWorlds.GTS.GTSProfile.Reset () (at Assets/Procedural Worlds/GTS/Scripts/Core/ScriptableObjects/GTSProfile.cs:600)
UnityEngine.ScriptableObject:CreateInstance()
ProceduralWorlds.GTS.GTSEditorUtility:CreateNewProfile() (at Assets/Procedural Worlds/GTS/Scripts/Editor/Utilities/GTSEditorUtility.cs:16)
ProceduralWorlds.GTS.GTSManagerEditor:MainPanel(Boolean) (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomEditors/GTSManagerEditor.cs:119)
PWCommon5.EditorUtils:Panel(GUIContent, String, Action`1, GUIStyle, Boolean, Boolean, Boolean, GUILayoutOption[])
PWCommon5.EditorUtils:Panel(GUIContent, String, Action`1, Boolean, Boolean, Boolean, GUILayoutOption[])
PWCommon5.EditorUtils:Panel(String, Action`1, Boolean, GUILayoutOption[])
ProceduralWorlds.GTS.GTSManagerEditor:OnInspectorGUI() (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomEditors/GTSManagerEditor.cs:61)
ProceduralWorlds.GTS.GTSManagerEditorWindow:OnGUI() (at Assets/Procedural Worlds/GTS/Scripts/Editor/CustomWindows/GTSManagerEditorWindow.cs:72)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

 

Link to comment
Share on other sites

I nuked out the entirety of GTS from my project and re-added it, making sure to remove the GTS Terrain components from my terrains, and the issues persist the same exact way.

It is now clear to me that the behavior is changing between attempts because something is being saved somewhere outside of GTS User Data, so when I wiped that out it wasn't enough. Whenever I hit NEW profile it instantly is populated with these Texture Layers from, presumably, the very first attempt.

When I make a new profile in a different scene in which GTS was not yet applied, Texture Layers is empty as expected.

It seems that, somewhere (embedded in the scene?) there is garbage Texture Layer data leftover that GTS cannot seem to clear out and move past.

Link to comment
Share on other sites

Hi @neurodr0me, sorry to hear that you are experiencing this issue. 

When a new GTS profile is created, the editor window calls a function that searches all terrains in the scene to gather the terrain layers (even if the profile hasn't been applied yet). This means that if no profiles were currently applied, then you added a new terrain layer into one of the terrains, then created a new GTS profile, it should be populated with all those terrain layers, including the new one you added, before the profile has even been applied. 

I have sent you a private message with a patch may help in the process of debugging this issue. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...