Author Topic: Use with procedurally generated mesh  (Read 1137 times)

krnlpanick

  • Newbie
  • *
  • Posts: 2
    • View Profile
Use with procedurally generated mesh
« on: December 11, 2017, 05:04:00 PM »
I bought this asset thinking it would be a drop-in for my prototype, however I was disappointed when I learned that while it works with Unity Terrain objects; it doesn't in fact work with mesh objects. I have an endless procedural world build using chunks of meshes and want to drop in a grid system over the top of my mesh based terrain objects. I'm happy to dig in to the code and make this work because it feels like I should be able to reuse a lot of the terrain specific calculations to make it do what I want and I already spent the money on it. Can you guys point me at some resources or give me some code pointers on where I can extend this package to map the grid on meshes instead of just terrain objects?

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Use with procedurally generated mesh
« Reply #1 on: December 12, 2017, 04:20:06 AM »
Yes, Terrain Grid System only works with Unity terrain or 2D grids. No custom mesh-based terrain.

You could start looking into TGSPrivate.cs script file. The "_terrain" field is used across the script to get the terrain height data and also sample specific positions. Do a search for "_terrain" and see if you can fetch the same info from your terrain mesh.




krnlpanick

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Use with procedurally generated mesh
« Reply #2 on: December 13, 2017, 11:28:48 AM »
I'm working on migrating my procedural terrain generation engine to generate terrain objects as opposed to meshes right now. Just trying to figure out now how to assign the terrain to the TGS at runtime; when I set it using tgs.terrain = xxx the TerrainGridSystem destroys itself in the scene for some reason. But I'm digging in now, if it looks like a bug in the scripts I'll post here about it.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Use with procedurally generated mesh
« Reply #3 on: December 13, 2017, 11:32:12 AM »
Hi!

Once you assign TGS to the terrain, it self attach to it as a children object.

Regards.

Yan

  • Guest
Re: Use with procedurally generated mesh
« Reply #4 on: June 21, 2018, 12:17:55 PM »
Would you consider implementing support for mesh-based terrain? I think a large number of people would find that very useful.

Great work by the way!
Much appreciated!
« Last Edit: June 21, 2018, 02:31:37 PM by Kronnect »

yan

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Use with procedurally generated mesh
« Reply #5 on: April 25, 2019, 02:07:38 AM »
amazing work implementing this in the new update! I really appreciate this. I haven't had the chance to try it yet, but would it possible to make irregular topography work on globe/sphere meshes as well?

Best regards
« Last Edit: April 25, 2019, 02:10:54 AM by yan »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Use with procedurally generated mesh
« Reply #6 on: April 25, 2019, 04:20:45 AM »
Hi yan,
You can use it on a sphere, yes. But the grid will be laid on the top hemisphere of the sphere like shown in this video:
https://youtu.be/ksI7Z5UUzsI



yan

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Use with procedurally generated mesh
« Reply #7 on: April 25, 2019, 07:23:32 AM »
I see. Thanks for the quick reply. Would it be a big leap to get it to work with a homogeneous projection on the entire sphere the way it is with the Hexasphere System? I would be very interested in this for the near future.

Best regards

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Use with procedurally generated mesh
« Reply #8 on: April 25, 2019, 08:25:41 AM »
Nope. Terrain Grid System works internally with a heightmap so it would require a major rewrite which on the other hand would make the asset very similar to Hexasphere Grid System.