Author Topic: World-wrapping on terrain maps  (Read 182 times)

Dromo

  • Newbie
  • *
  • Posts: 9
    • View Profile
World-wrapping on terrain maps
« on: April 22, 2021, 09:37:15 PM »
Hello,

This a great asset, and it is very useful.

One feature that would make it even better for my project would be having the world-wrapping feature on maps made from Unity terrains.

I know this is probably very difficult to do. Do you think it will ever be possible in the WMSK asset? Are there any plans to do it?

Do you know of any guides or examples elsewhere that could help me integrate it into the WMSK?

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: World-wrapping on terrain maps
« Reply #1 on: April 27, 2021, 08:32:22 AM »
World-wrapping works because you can pan the world in the viewport mode so the world scrolls inside that viewport wrapping around edges.

In viewport mode, without world-wrapping option, the asset uses this setup:


When world-wrapping option is enabled, there're two mapper cam side by side. So the surface captured is twice big (horizontally) and both cameras render to a different part of a render texture which is used in the viewport gameobject.

In terrain mode, the viewport gameobject is the Unity terrain and there's still a mapper cam which captures the map features into a render texture used by the terrain shader. In this case, the map features could scroll but since the Unity terrain is a static object (with its mountains, trees, grass, etc.), it cannot pan around or scroll. An approach to implement world-wrapping could make use of two main cameras which implement the same mecanism as with viewport mode: place one next to another, make them render to a render texture and use a special shader which combines them and display them into a UI image or something like that but then you will lose any interactivity with the terrain. I'm not sure if this can be done properly with Unity terrain this way but the above outlines how it's implemented using the viewport mode. Hope it helps.