Jump to content

Howto: Mesh Terrains properly? (needed for terraforming) - [solved]


Haxel0rd
Go to solution Solved by Bryan,

Recommended Posts

Hi,

Setup:
I'm on Unity 2021.2.11f, (tested also in 2021.2.12), GaiaPro 2021 with HDRP Renderpipeline and using the default
grass Spawner "Gaia Pro Sample-Grass".

i want to implement realtime terraforming into my game and so i need a mesh terrain. The terrains generated by
Gaia are not based on mesh, so i used the "Export Terrain Mesh" feature from Gaia tools. After export, i had the
mesh, png textures and a material. Importing this into caused my high-end pc to run on 4 fps.

Question 1: low fps
is this because the exported terrain mesh (medium map size) has too many details? Do i have to convert the exported
mesh to low poly maybe? But then i loose terrain details? Compared to what map size i have in mind for my game,
the medium map size is still tiny. (looking to go big, as described here: https://canopy.procedural-worlds.com/forums/topic/471-howto-multi-terrain-world-streaming-support-big-maps/#comment-2172

Question 2: exported map textures and material
The exported textures and material are missing all the textures, i only have basemap that looks like in world spawner.
How to preserve the terrain textures when switching/converting to mesh?

Question 3: how to actually switch to mesh?
This connects to Q2,- i tried to apply all settings from the current terrain, over to the mesh terrain. But i do not know
how to move over/apply textures, trees, etc. from the old (non-mesh) terrain, onto the new one.

Question 4: how to programmatically access ... for example the current texture where mouse points at
For terraforming, i need to "read" the texture that is currently at the mouse position and fetch its name- but when
trying to code this today, i noticed i can't access this the regular way- in the end i found no way to do this. Any tips
on that are appreciated - i am not looking for a code example (well if, then nice, but not asking for) - i am rather
looking for "the way" on how to do this.

And any other tips in regards to Gaia & Terraforming would be very welcome.

Thanks and regards.

Link to comment
Share on other sites

  • Solution
On 2/19/2022 at 5:27 AM, Haxel0rd said:

Question 1: low fps
is this because the exported terrain mesh (medium map size) has too many details? Do i have to convert the exported
mesh to low poly maybe? But then i loose terrain details? Compared to what map size i have in mind for my game,
the medium map size is still tiny. (looking to go big, as described here: https://canopy.procedural-worlds.com/forums/topic/471-howto-multi-terrain-world-streaming-support-big-maps/#comment-2172

Low FPS could be due to everything is now a mesh, along with the game objects, trees, and terrain. 
This is typically not done because of performance unless you are culling and lod'ing properly. 

I do recommend to use something like the PW Tool kit. 
This would help save performance - its a mesh combine system and culling system. 
Its included in the pro subscription, or you could use something similar. 

On 2/19/2022 at 5:27 AM, Haxel0rd said:

Question 2: exported map textures and material
The exported textures and material are missing all the textures, i only have basemap that looks like in world spawner.
How to preserve the terrain textures when switching/converting to mesh?

Textures are not technically missing they just may not appear like you are use to seeing the textures on the terrain. The reason for this is because the terrain shader was made to support it so that you can paint on multiple textures in a splat map fashion, and then have them blend in each other and nicely scaled etc, when you are up close. 

The meshes use the Unity standard shader that support the same style of splat map-based texturing similar to the Unity terrain shader. The CTS replacement should be able to support this at some point but its not ready at the moment. 

The mesh does not support tree rendering the same way a normal unity terrain would, but its possible to copy all the trees over as individual game objects while exporting. The issue with this is the same issue that you are facing with FPS issues. Although this again could be solved with the PW Tool Kit. 

 

On 2/19/2022 at 5:27 AM, Haxel0rd said:

Question 4: how to programmatically access ... for example the current texture where mouse points at
For terraforming, i need to "read" the texture that is currently at the mouse position and fetch its name- but when
trying to code this today, i noticed i can't access this the regular way- in the end i found no way to do this. Any tips
on that are appreciated - i am not looking for a code example (well if, then nice, but not asking for) - i am rather
looking for "the way" on how to do this.

 this would be relatively easy on the original unity terrain because there is something built in in unity for that, on the mesh terrain it would depend how the shader would work - if it is splat map based they would need to find out where they are on the mesh, sample the splat map at that position to figure out which texture dominates in that spot. But if the shader works differently, it is not possible to tell.

  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...

Hi Bryan,

thank you very much for your detailed answer, it helped me solve the situation! (i saw it 2 days after you posted).

From what you wrote i understood that mesh was not the way to, so i had abandoned mesh for terrain and now work with unity terrain type again. As you suggested, texture detection could be solved easily and that is working now, also as terraforming 👍

Thank you for your advice, marking this as solved.

Cheers!

  • Like 1
Link to comment
Share on other sites

  • Haxel0rd changed the title to Howto: Mesh Terrains properly? (needed for terraforming) - [solved]
  • Ben Black locked this topic
Guest
This topic is now closed to further replies.
  • 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...