Jump to content

Multiple terrain texture spawner


Asset Glue
Go to solution Solved by Peter,

Recommended Posts

While creating a "smallish" world with very high resolution I quickly ran into problems with spawning textures. This world is only 4x4 terrain tiles, 512 meter sq size each. So after doing a little head scratching, I came up with a 2k world which shouldn't be a texturing problem. However.... each tile has a 4k heightmap and 4k control texture. (Control texture defines the size of the splat map that the texturing is applied to.) So a little more head scratching later and I discovered that GaiaPro generates the entire splat map for all of the terrains as a render texture. No big deal, I was thinking that a 16k texture (4x4k) shouldn't be too big if the hardware supports it. 

Information regarding the solution was not readily available so I decided to dig into what I could see. I started with the Unity Console in the editor and found an error : UnityEngine.RenderTexture:GetTemporary (int,int,int,UnityEngine.RenderTextureFormat,UnityEngine.RenderTextureReadWrite)  

Ill post a more in depth solution that doesn't require spawning every scene independently. 

Edited by Asset Glue
Link to comment
Share on other sites

Hi just to be sure: Did you use the "spawn local" or the "spawn world" button in the spawner? There are indeed limitations for the render texture sizes, but for larger worlds you should be able to use "Spawn World" and Gaia should automatically do the entire scene in multiple iterations until it is done.
If that is not the issue, could you please share a bit more what the exact problem is & maybe post a screenshot please?

Link to comment
Share on other sites

@Peter I did use both spawn local, and spawn world. Ill give you all of the details regardless. Unity 2020.3.4f1 Built in pipeline. 

Local So if I use spawn local, I have to iterate through each terrain and set the spawner world position to match the tile locations. It has artifacts, diagonal lines that do not seem to match the tiles, and do not seem to affect every texture/terrain layer. This method does not throw any errors.

World: RenderTexture.Create failed: requested size is too large. This will only apply the top most terrain layer, and I am not sure why. So when I dig into it, the first error is thrown in.  public void GetHeightmap() method inside of GaiaMultiTerrainOperation.cs, when I log the width and height, they are 16385 each. 
The second error thrown is in the public void GetNormalmap() method. Same width and height passed into the method.

Not sure if I screwed up something.

Link to comment
Share on other sites

  • Solution

I checked with your values, and I was able to reproduce the issue. The problem is that the resolution for the heightmap and control texture is unusually high for such small terrains. When Gaia iterates over the world, it uses a range / radius of 1024 by default, this means it would capture all 4 by 4 terrains at the same time, which leads to this high render texture resolution. If I remember correctly, the control texture was limited to 2048 originally in unity, which made this scenario also less likely to happen when the logic for that was written. We need to adjust the logic for this to automatically reduce the range / radius in such a case.
Could you please for now try to open the Gaia settings and reduce the world spawn range manually to 512 in here?


image.png

This should allow the spawn to process without the render texture size issue (worked in my case).

  • Like 1
Link to comment
Share on other sites

@Peter You are a gentleman and a very astute scholar. Thank you for the answer because this worked as prescribed. This does spawn the world now, however I still have the artifacts that I was getting when I spawned each scene manually.

The spawning does not throw errors now and actually applies the textures now.

So this is a second part, after being able to iterate through spawning rules, these diagonal lines appear. And why I mention this is that they all appear in 45 degree angles. The image shows the tile orientation and the artifact. This is the same result that I had when spawning each terrain manually. This happens everywhere.

Artifacts1.thumb.jpg.0280e31c50042c362ef59a817e841027.jpg

Edited by Asset Glue
Link to comment
Share on other sites

Another image, I may not be correct about 45 degree angles because this one has a curve. I don't want to steer you in your magic making discovery process. The same results are replicated in the spawner visualization where the compute shader shows exactly what will be textured, if that helps. 

Artifact2.jpg

Edited by Asset Glue
Link to comment
Share on other sites

Great to hear that the workaround fixed it, I can also confirm that with the next Gaia update this will be handled better by the spawner, and if the current terrain resolution value in the underlying area would exceed the render texture limitations it will automatically reduce the size for the world spawn.
The 45 degree angle is quite suspicious, the spawner does not rotate by itself, but I assume it could be one of the masks inside the spawner causing this. Do you use one of the biomes that came with Gaia, or are you building your own spawner / biome?
If the visualization is showing the issue as well, could you please check what happens if you visualize the green grass texture spawn rule, and then deactivate the masks for that one after another? If there is no mask being applied, the visualization should fill the whole square of the spawner range to 100%. I would assume that when enabling one of those masks the artifact should become visible, depending on what masks that is we can then analyze further.

Link to comment
Share on other sites

Not using the default biomes, I am suspicious as well that I have something wrong with masks. I will see if I fiddle around and make it work. Just a slopemask. I disabled the other two texture rules that apply on top of this layer.Mask.thumb.jpg.0fa3acae4869c7ecb98b4fb574e94297.jpg

Edited by Asset Glue
Link to comment
Share on other sites

I was not able to solve the texturing artifacts. I did however decide to create the biome on a smaller world with only 4 terrain tiles because there is a D3DSwapChain error which I would get. That part I was able to solve by manually iterating through the tiles and spawning them that way. But I will save that part until I am satisfied with my biome. 

On a separate note, if I use slope + concave/convex + shrink/grow I will always get the swapchain error. I think I can resolve that in windows settings. 

I am still coming up with ideas on how to solve the texturing problem. Increasing the slope makes a difference, but there will still be a sudden difference in the splat map weight at that point. 

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