Jump to content

Terrain not loading in build but showing in play mode in editor. Help would be much appreciated


hurbivore
Go to solution Solved by Peter,

Recommended Posts

Hi all!

  I've been running into some issues with Gaia terrain. I've tried looking through the forums and online and couldn't find a solution. Essentially, I have a terrain I generated with Gaia, and it appears fine in the scene as shown here:

image.thumb.png.f1f75b649c5b9c66410d21ea3511913d.png

And in play mode within the editor it looks like this (not a huge issue at the moment that there's no grass):

image.png.9ca1012dc913767742d5dd4a0c94eb6c.png

And finally in the build it looks like this:

Editor.png.0c8b77d35e328e425af9ebcc561b654c.png

 

Within project settings -> Graphics I'm using "UPRenderPipelineAsset PWS UP 10.0.0 (Universal Render Pipeline Asset)"

Within Project Settings -> Quality, the render pipeline asset is also  "UPRenderPipelineAsset PWS UP 10.0.0 (Universal Render Pipeline Asset)"

Within the scene hierarchy, in Gaia Runtime -> Terrain Loader Manager, it does have the terrain loader manager script and my camera does have a "Terrain Loader" script that is set to runtime always (I saw this mentioned in another forum post). Any help would be much appreciated!

These are the renderer settings:
image.thumb.png.9e0fdba54119fe836612d51405f76961.png

 

 

 

Link to comment
Share on other sites

  • hurbivore changed the title to Terrain not loading in build but showing in play mode in editor. Help would be much appreciated

Hi, thanks for the response! At the moment, I'm not using any player, I just have a camera setup in the scene view. I'm not too familiar with what Gaia world streaming is. Is that the terrain loader manager? If so, I am currently using it and these are the settings in inspector. I have also added the terrain loader script onto the camera.
image.png.5fbc6a677ca3fd84a00668bc6a6e9ab4.png

Even within the scene, if you inspect the camera manager, the terrain isn't loaded:

image.png.00c2bd045ee0ae3a63f959dad1563c38.png

Link to comment
Share on other sites

You would need to have a Gaia player in order for this to work. 
It can be the Gaia custom player if you are using your own or one of the other preset characters from the standard assets. 

Link to comment
Share on other sites

Oh okay thanks! To clarify, for the terrain to render in a build, I need to use the Gaia custom character or one of the presets? Why is that? What's the requirements to set up a Gaia custom player?

Link to comment
Share on other sites

From the looks of it, you are using a multi-terrain scene through Gaia which requires the terrain loader. 
This enabled world streaming. 

The Gaia player is needed for skies, water, world streaming, and basically anything other than just world creation. 
Any system will require Gaia to be in it. 

The Gaia Custom Player allows you to use your own controller or another controller from the Unity asset store. 
All you need to do is set the player to player tag, and the Camera to main Camera. 
Then assign that to the Gaia Custom Player. 

Or you can use one of the Standard Asset Controllers. 
 

Link to comment
Share on other sites

Okay thanks! How do I disable a multi terrain scene to make sure that is the issue? Do I just remove the terrain loader and terrain loader manager?

Link to comment
Share on other sites

You can try to sure. 

The thing is like I stated before it really depends on what you are using from the Gaia system. 
How many terrains do you have? 
 

Link to comment
Share on other sites

For testing purposes can you change your character to the Gaia Flycam and make a build? 
Will this allow the terrain to be seen? 
 

Link to comment
Share on other sites

Sorry for the late reply. I've just tested it with the Gaia Flycam and the terrain is not rendering in the build but it's fine within play mode in editor.

Link to comment
Share on other sites

Hi @hurbivore, since you are using just one micro terrain, we can rule out terrain loading as the culprit - terrain loading would only be part of the equation if there were multiple terrains involved that are loaded in and out from Gaia during runtime (See the Terrain Loading Article in the canopy library) for more.
If the terrain is there during design time / play mode, but disappears in the build this can be caused by shaders not being included in the build correctly. Do you run any custom terrain shader?
If not, it might help to include a shader variant collection in the project graphics settings. It allows you to "record" the shaders that are being used in a scene during design time and those exact shader variants are being included in the build then, this has helped with issues with terrains disappearing in the past.
If this does not help either, you can add the URP Terrain Lit shader in the list of "Always included shaders" in the graphics settings. It could also not hurt to run a development build to see if you can get any error messages in the build console or in the player logfile.

@hurbivore @jokers44life Both of you mention terrain details that disappear when playing the scene - the first thing to check would be the Flora configuration on the terrain:

image.png

Flora works by swapping out the existing terrain details with GPU instanced terrain details. For each item (grass, flower, etc.) that Flora displays a Flora renderer needs to be set up in the Flora component. If the renderer seem to be missing or are misconfigured, please try to remove the Flora component from the terrain and re-spawn the grass from the grass spawner of your biome.
The grass spawner should normally set up the Flora component and should fill the "Flora Renderer" list with the correct configuration. 
Alternatively you can also opt to not use Flora at all and deactivate it from the Grass spawner in the resource settings:


image.png

This will then keep the grass as it is displayed during design time in the editor.

 

Link to comment
Share on other sites

Hey @Peter, sorry for the late reply. I don't believe I have any custom terrain shader. When I looked at the terrain material it's just using the URP Terrain lit material. I've added the shader variant collection but so far it's only added the Nature/Terrain/Standard shader.

 image.png.6fc183c7c8840a3d19b654aed13c26ca.png

I have also added the UniveralRenderPipeline/Terrain/Lit shader in the graphics settings:image.png.bfada483f6df223576efa5e9070c62bd.png

I've also tried a development build. The only error I can see is in regards to the input system I am using. 

 

 

 

Link to comment
Share on other sites

I've just tried creating a new Gaia terrain and the issue remains. However, the player log has an issue in regards to Gena now:

Mono path[0] = 'C:/Users/Hurbivore/BladeborneBuild/Bladeborne_Data/Managed'
Mono config path = 'C:/Users/Hurbivore/BladeborneBuild/MonoBleedingEdge/etc'
Found 1 interfaces on host : 0) 192.168.2.16
Multi-casting "[IP] 192.168.2.16 [Port] 55000 [Flags] 2 [Guid] 837919383 [EditorId] 2231494622 [Version] 1048832 [Id] WindowsPlayer(2,HurbivoreRazer) [Debug] 0 [PackageName] WindowsPlayer [ProjectName] Bladeborne" to [225.0.0.222:54997]...
Initialize engine version: 2022.3.6f1 (b9e6e7e9fa2d)
[Subsystems] Discovering subsystems at path C:/Users/Hurbivore/BladeborneBuild/Bladeborne_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1; jobified=1
Direct3D:
    Version:  Direct3D 11.0 [level 11.1]
    Renderer: NVIDIA GeForce RTX 3070 Laptop GPU (ID=0x249d)
    Vendor:   NVIDIA
    VRAM:     8033 MB
    Driver:   31.0.15.3667
Begin MonoManager ReloadAssembly
- Loaded All Assemblies, in  6.172 seconds
- Finished resetting the current domain, in  0.001 seconds
<RI> Initializing input.
New input system (experimental) initialized
Using Windows.Gaming.Input
<RI> Initialized touch support.
UnloadTime: 11.615100 ms
ArgumentNullException: Value cannot be null.
Parameter name: source
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0000d] in <de4a1a1490a74771a34fee0d1d586658>:0 
  at GeNa.Core.GeNaManager.Initialize () [0x001ec] in <83b00e10eb4743eea9387013926eaa18>:0 
  at GeNa.Core.GeNaManager.OnEnable () [0x00000] in <83b00e10eb4743eea9387013926eaa18>:0 

Link to comment
Share on other sites

  • Solution

Hi @hurbivore, we would need to take a look at that GeNa error as a separate issue. This should however not have anything to do with the terrain rendering, the trees being visible in the scene confirms that the terrain was loaded but is simply not rendering, for whatever reason that might be.
Here are two more things that you could check to track down the issue:

 

  • Could you please try to disable the "Draw Instanced" setting on the terrain before building?


image.png

This setting has influence on how the terrain is being rendered and instancing can be problematic on some target platforms / graphics APIs so it might be worth to check.

  • Could you please also try to just make a "default" terrain in an empty scene from the scene hierarchy "Create" menu? (Create > 3D Object > Terrain)
    Gaia creates those Unity terrains as well, it would be interesting to see if that renders correctly, then we would know if it is a project wide issue or appears on terrains created by Gaia only.

 

 

Link to comment
Share on other sites

@Peter Looks like unticking "Draw Instanced" worked! Thank you!

What are the pros and cons of having it instanced? What would I need to change so that "Draw Instanced" works?

Would you like me to still test with a Unity default terrain?

Link to comment
Share on other sites

You would want to keep Draw Instance enabled when using Gaia to do any terrain modifications. 
Otherwise, it would cause some issues with the spawning and texturing. 
Disabling it after shouldn't have any real issues no. 

Draw instance moves things to the GPU instead of the CPU is all it means. 
It just changes the rendering of it. 

Link to comment
Share on other sites

Thanks! I understand that I need it enabled for it to work. But that seems to be the issue at the moment, when I enable it the terrain disappears in the build. What can I do, or what is the next step to try and fix it?

Link to comment
Share on other sites

@hurbivore It is a bit difficult to answer, as there is only little information available how the "Draw Instanced" feature of the terrain works exactly and what the prerequisites are for it to work. Here is how it was announced back then when it was introduced:
https://blog.unity.com/technology/2018-3-terrain-update-getting-started

If instancing does not work, this is usually a target platform / Graphics API issue. In earlier versions of Unity, there was information on the GPU instancing page in the manual that would list incompatible platforms or graphics API where instancing does not work:
https://docs.unity3d.com/Manual/GPUInstancing.html
(Flip through the unity versions in the top left corner to look at earlier unity versions, you can see how this has changed over time)
However it is not clear if this information translates 1:1 to the instanced terrain rendering feature. Are you using WebGL as target platform? This might explain it, as this is the only platform that is listed there as not being compatible with instanced rendering.

If you are not using WebGL and the terrain does not show up in a build with "draw instanced" being checked, I would assume it is an unity bug. You would need to isolate this e.g. in an empty project where you just put a default terrain into the scene, and report this as a bug to unity then.

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...