Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Terrain Composer2 a next generation GPU powered terrain tool.

Discussion in 'Assets and Asset Store' started by eagle555, Sep 16, 2012.

  1. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello Shwa and Kdagsjm,

    As Kdagsjm says you can use the Unity terrain brushes on the heightmap and also if you would generate again it will be reset to default. However for the heightmap you can also export the new heightmaps and then import them again so you keep the manually changes (in TerrainComposer). With heightmap output button and export output button activated you can export.

    As for trees if you change them manually and regenerate them again you will loose the manual placed trees. I'm making a new update where you can export and import trees/grass. So any manual changes are saved. I'm finished with the trees and only have to do the grass, now I'm busy with moving house but at the end of this week the new update will be there. So you can save and import tree maps (multiple on top of each other) globaly. And then set the density, scale and tree type of each tree in the imported tree maps.
     
    Last edited: Oct 1, 2013
  2. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    461
    Thanks Eagle and Kdagsjm!
     
  3. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Hey eagle555,

    I just got terraincomposer (as I said above, gonna try to do something similar to the civilization maps) , and I'm trying to find how to paint the terrain with a texture pretty much like we can do with Unity Terrain.
    How can we do this ? Painting a texture freely, not dependent of the height of the terrain.

    Thanks,
     
  4. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    That's a good question. There are some options here. You can use the manual terrain tool for this as TerrainComposer is an automatic texture tool, why create manual painting if it is already in Unity?. If you want to keep the data when regenerating then you can export the splatmap and reimport it in TC splat layer with filter on image and in settings enable 'splatmap'.

    There's many input and mixing options in filters, you can set it to steepness. What you can also do is paint your splats on an image , like splat 0 -> Red, splat 1 -> Green, 2 -> Blue, etc. You can pick your own colors, and then use that in a filter.
     
    Last edited: Oct 4, 2013
  5. shoo

    shoo

    Joined:
    Nov 19, 2012
    Posts:
    67
    Hello, Nathaniel.
    I can't find, is there option in TC that allows generate object rotated about terrain normal? I think it will be clear in the image:

    $Снимок экрана (93).png
     
  6. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello Shoo,

    Yes sure you can do this, you can set many setting in an object. You need to unfold the object in the layer -> Transform -> Enable Include Terrain Rotation.

    $terrain_rotation.jpg
     
    Last edited: Oct 6, 2013
  7. shoo

    shoo

    Joined:
    Nov 19, 2012
    Posts:
    67
    Unfortunately in my case it isn't working properly. What could be the reason?
     

    Attached Files:

    Last edited: Oct 6, 2013
  8. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
  9. kaamos

    kaamos

    Joined:
    Aug 6, 2013
    Posts:
    48
    Hi

    First of all, I finally got around to using this tool after quite a while and I have to say that it is pretty awesome... the quality of the output and speed of workflow are very impressive.

    I have a small problem though, with terrain detail objects not populating the landscape correctly. If I set the density high on any given detail object, it will generate in stripes across the middle of the world. reducing density very heavily fixes the problem, but of course less dense grass doesn't look as good. Any ideas what this might be caused by? The log shows no problems at least.
     
  10. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello Kaamos,

    That's a good question. Somehow Unity terrain creates those stripes when the density is too high. So you have to reduce it like you do. But if you want more density you can set the detail resolution higher in the terrain list -> resolutions.
     
  11. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    I purchase World Composer the other day, and just wanted to say well done and I'm very pleased with it.

    Thank you :)
     
    DesertRaven likes this.
  12. Phantasmus

    Phantasmus

    Joined:
    Oct 1, 2013
    Posts:
    4
    Sorry for double-posting...
    There is a problem while trying to generate a terrain from my previously saved
    Terraincomposer_Save prefab.
    When I'm later instantiating this prefab, terrain doesn't appear.
    What must I do to generate a terrain with all saved settings from
    terraincomposer prefab? What am I doing wrong?

    I didn't find any examples in docs or youtube :(
     
  13. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello,

    You can use the TerrainComposer menu -> File -> Save/Load for this. You don't have to make or instantiate prefabs yourself.

    Let me know if that helps ;)
     
  14. Phantasmus

    Phantasmus

    Joined:
    Oct 1, 2013
    Posts:
    4
    Unfortunately it didn't help :) I want to generate the terrain procedurally while the game is already running. So I made some pre-setup of terrain parameters and saved them to prefab. And after the game was started I cannot create the terrain. :( Is that possible?
     
  15. kaamos

    kaamos

    Joined:
    Aug 6, 2013
    Posts:
    48
    I managed to sort out the problem by shrinking the detail per patch and increase the detail resolution. It all seems to work beautifully, thanks!

    One last question... and apologies if it is answered in some very obvious place, but how would I go about adding meshes as details? Right now I can only use planes via Terrain Composer. Is planting detail meshes as trees the only way?
     
  16. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    I thought you meant in Editor mode. Yes this is possible but you have to use the runtime package for it:
    http://www.terraincomposer.com/runtime/

    It's not that you can just place a prefab and it automatically generates procedurally, you have to call functions for this. It is all explained in the runtime package.
     
  17. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    I just made an update for this as it wasn't in the Unity documentation how to do this. But I asked them and they told me how to do it, so I will put it online in a few hours. You can toggle mesh then and rendering in settings has to be on vertex-lit.
     
  18. kaamos

    kaamos

    Joined:
    Aug 6, 2013
    Posts:
    48
    How do I toggle to meshes? It only seems to accept a texture in the add grass/detail interface

    -- Edit, oops, sorry, I misunderstood what you meant. So there is an update coming that will allow meshes as details? Awesome! And just in time for me, too! Thanks.
     
    Last edited: Oct 8, 2013
  19. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    You can download the new version from the Asset Store, it's 1.15 and you can also export/import tree and grassmaps now. So manual changes to trees and grass can be saved.
     
    Last edited: Oct 8, 2013
  20. kaamos

    kaamos

    Joined:
    Aug 6, 2013
    Posts:
    48
    Will do. Thanks again!
     
  21. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    There's a change in the Unity menu in TerrainComposer 1.15, because Unity 4.2 has the Terrain Tab removed, it has to be placed in another menu tab. Now TerrainComposer is in the Window tab.
     
  22. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Nevermind, found the rtp button
     
    Last edited: Oct 9, 2013
  23. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    There's a new WorldComposer 0.98 update available. This version works correctly with TC 1.15. TC needs to be upgraded first from the Asset Store. I'm also doing a update to TC 1.16 tommorow and will put it on the Automatic Update Server.

    WorldComposer is also in the Window tab of the Unity Menu in version 0.98
     
  24. lmtm

    lmtm

    Joined:
    Sep 9, 2013
    Posts:
    32
    Hi,

    I'm new in UNITY. I started to use TC and my problem is that I need to make terrain with two textures : OUTSIDE area, INSIDE area.

    I prepared splatmap TGA - RGB - alpha channel.

    $splatmap.jpg

    In TC, I made two splats layers.
    - Outside area, with filter (two textures random) and subfilter (image - color range BLUE)
    $out.jpg
    - Inside area, with filter (two textures random) and subfilter (image - color range RED)
    $in.jpg

    Then I started Generate - Splatmap and I received result which is not good for me.

    On my terrain i have black borders between textures.

    My issue :
    $issue.jpg

    What can I do to fix it ?

    I need to have no black borders around textures. Please help me.

    Thank You for Your help in advance.

    Milos.
     
  25. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    It looks like your color ranges only include the solid colors and not the anti-aliased portion at the edge of the circle. Try including a little bit of red into your background range.
     
  26. lmtm

    lmtm

    Joined:
    Sep 9, 2013
    Posts:
    32
    I add new layer in different color with shadows - no change.
     
  27. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello Milos,

    The color range should be from red to blue, and the other from blue to red. You don't use black in the image...

    Best Regards,
    Nathaniel
     
  28. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Hi Nathaniel,

    Do you have any recommendations on the best way to create a splat map when using multi tiled terrains.
    I have a large terrain from Worldcomposser imported with satellite images.
    Now I would like to have a go at recreating the textures for the terrain using terraincomposer and rtp3.
    But not sure what is the best way to get the positions for the colours on the splat map to match the positions of mountains forests etc
    What workflow do you use to acheive this.
     
  29. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello John,

    I'm just working on this with the UnityFS+WorldComposer+TerrainComposer+RTP3 demo.

    What I do is have 4 splat textures. grass, sand, rock1, rock2.
    1). I make a splat layer with rock1 and rock2, with filter on steepness (can add some random curve).
    2). Then for the sand I add another layer with only the sand.
    3). Filter input on always, ouput to 'change' and mode on 'layer'.
    4). Then add a subfilter with input on 'Image', then add the first satellite image, set auto search right, enable 'load on generate' (this can take a while as all images are set to read/write). Mode on 'terrain'.
    5). And then you can choose a color range for the sand like light brown to brown.
    6). You can use the Image Filter Tool to select a good color range. You can copy the color range by alt clicking 'S' and paste in the subfilter by alt clicking '+'.
    7). And I did the same for grass with another layer. But then with a more green color range.

    $splat_texturing.jpg $image_filter_tool.jpg
     
    Last edited: Oct 12, 2013
  30. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Brilliant Nathaniel, I really appreciate that. Was totally lost were to go in this matter, while its great to have the satellite Imagery - it would not be suitable as a final texture. And trying to recreate similar results to the real thing using textures is something I want to achieve.
    Will you be doing any video tutorials on how you achieve your result in the demo from start to finish.
    I would imagine they would be most sought after, what with the steep learning curve to learn this fantastic and powerful terrain system.

    Any update on release date for version 2.0?
     
  31. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    I'm planning to release the UnityFS Demo and then submit WorldComposer to the Asset Store. Yes I can do a video tutorial for this, once RTP3 is released.

    As for TC2 I will work on this after submitting WorldComposer, so next week I will be on it again :). I think it will be ready in about 2-3 months. Maybe quicker.

    P.s. Something to keep in mind, the less terrain tiles you use the better, so it's better to use higher resolution satellite images with less terrains. I just found that out. With 16x16 1k images I got 80fps, and with 8x8 2k I got 180fps...
     
    Last edited: Oct 12, 2013
  32. lmtm

    lmtm

    Joined:
    Sep 9, 2013
    Posts:
    32
    Hi Nathaniel,

    thanks, it is working now.

    Regards, Milos.
     
  33. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Thanks Nathaniel, something indeed to look forward too.
     
  34. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Next week I will submit WorldComposer to the Asset Store. I will also release a demo with 280 km satellite terrain I made with WorldComposer, TerrainComposer, RTP3 and UnityFS, The framerate is very good. I have 220 fps on my PC.

    Special thanks to Peter from WingSuitFlyer who helped tweaking the graphics, his artist input made it to look this good. And not to forget Tom from RTP3 that made terrain rendering go behond anything and Chris from UnityFS that did an awesome job on making realistic flight physics for Unity. The plane is also from UnityFS. I highly recommend RTP3 and UnityFS.

    This demo is to show the flight simulator perspective posibilities. Peter, Tom and me helping a little are working on a RTP3 demo that shows first person perspective posibilities.

    The terrain consists of 3 layers of detail.
    1 -> Very high detail 14 km 9x9 terrains 2k satellite images.
    2 -> 70 km 5x5 terrains 2k satellite images.
    3 -> 280 km 5x5 terrains 1k satellite images.

    $Demo1.jpg
    $demo2.jpg
    $demo3.jpg
    $demo5.jpg
     
    Last edited: Oct 13, 2013
  35. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    First can I say, that looks absolutely amazing. I am really struggling with TerrainComposser and WorldComposser with Unity at the moment getting constant crashes due to hitting the 3GB limit of Unity3D and 32bit memory constraints.
    I Guess I'm doing something seriously wrong with satellite texture's or something.

    Trying my best to learn this but the learning cure is really steep. So sorry if I keep asking stupid questions.

    I didn't realise you could switch out terrains resolutions using TerrainComposser. Can you explain how you do this?

    I'm taking your figures above and testing the sizes and grids for each level in WorlComposser to see if I get what your doing correct in my head.
    So I take it you first create a Low resolution Terrain using your example of a 5X5 Terrain at 1024 resolution, that would mean an Image zoom level of 12 to get a 280KM sized terrain.

    Ok then for the next level what do you mean by 70 km 5x5? does this mean you are actually doing 20 sets of 5X5 tiles.
    Meaning a closer in zoom of say 11 and resizing to 5X5 - if so how to you line up each group so not to have overlap of gaps?
    (280/70 = 4) so 4 sets of 5x5

    Also if the above is correct for the close up levels do I do the same again.

    This Time using a resolution of 2048 and a Image zoom of 17 so now I have 20 sets of 9X9 to fit the same area.
    (280/14 = 20) so 20 sets of 9x9

    If this is correct: How do you work out the correct coordinates for the smaller sets to be positioned.

    For the middle resolution you would 3 sets of coordinates for the 2nd, 3rd and 4th set of groups you have the 1st set from initial Low resolution set.

    As for the High resolution also you need the coordinates for the 2nd up to 20th set of groups. So again exact coordinates for each Upper left corner are needed, How are these calculated.

    Really want to attemp to do something like you have done above.

    Its mouth watering. :D

    Edit:
    Also what are your Image export settings are they PNG or JPG and what compression do you use for each resolution change?
     
    Last edited: Oct 14, 2013
  36. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello John,

    If you are hitting the 3gb memory limit, yes then Unity becomes instable and you get crashes. You just use too high total resolution then. I will make a tutorial video on how I did the demo as soon as RTP3 is released.

    I think it would be easier to Skype my account is Nathaniel.Doldersum, there you can ask questions directly and if behind PC I will answer them instantly, I also do screenshares. As for the learning curve, TC and especially WC are easy but sometimes users don't get the basic of how it works, then it is difficult to understand and learn. I completely resolved this 'gap' in TC2, as it has the node view and the visual of every layer/filter/subfilter.

    As for export I use Jpg and then 100% quality, I recommend using Jpg as they take less space and you can make bigger terrain. As for the positioning, I started with the high detail terrain of 9x9 = 81 tiles. Then the first outer terrain 5x5 = 25 tiles. To exactly fit I used the center for it. So I first go to the center of detail terrain area, by clicking 'Go' button, and then select the outer area and shift click <Set> next to go, this will set the center at the same position. That's all for allignment...

    I also used the image editor in WC to make the shadows brighter, and then together with Peter created a photoshop action to get the fading out of the images, and let it run over all images. So I export all areas and heightmaps. Then first create the high quality terrain, remove the colormap in TC as I use RTP3, add 4 splat textures, then shift click <Set All>, add the <RTP> then there assign the satellite images. Then I created layers for the splat texturing in TC. Then after setting up RTP3. Then created the first outer terrain from WC, disabled the middle tile. And did the same setup, and then the 280km terrain. It has a little overlap, but I place the outer terrain a little lower.

    $Terrain1.jpg
    $terrain2.jpg
    $terrain3.jpg
     
    Last edited: Oct 14, 2013
  37. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Do you have a vague ETA of TC2? The TC2/RTP3/WC workflow looks really amazing.
     
  38. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Thanks :), the eta for TC2 is 2-3 months. I hope to get it finished quicker. What you see is TC 1.13, I didn't show anything of TC2 yet, only some screenshots of the node view.
     
  39. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Thanks Nathaniel,

    Those Pics make it clear what you are doing, I has it backwards in my Head. Thanks for Skypee Address, I'll add it to my contacts but will try to have another go at it with the above information to see if I can figure it out for myself first.

    Found Myself a Very nice scenic Airport to teach myself your techniques:

    $7214256180_7519ab2347_z.jpg

    One thing I might ask. If i do similar but keep the grouping even That is:

    Level 1: 4096kb Images at Zoom 18 for 8x8 Tiles (Terrain size = 10.44 SqKm)
    Level 2: 2048kb Images at Zoom 15 for 8x8 Tiles (Terrain size = 41.76 SqKm)
    Level 3: 1024kb Images at Zoom 11 for 5x5 Tiles (Terrain size = 208.82 SqKm)

    So each Resolution Level (Zoom) fits exactly into each other, that is the full Level 1 set of tiles fits exactly into the middle tile of Level 2.
    And the full set of Level 2 tiles fits into the center tile of Level 3.

    No If I use different levels for the Height map with the highest resolution at level 1 and the lowest at level 3.
    How to I get the tile seams to match up. Will the Stitch feature in TerrainComposser match these up if the middle tile of the Level 2 is disabled so that the 8 seams of the tiles surrounding tiles of the disables center tile, are touching the 68 outer tiles of Level 1.

    Or do you do like you said above and leave the full set of tiles enabled, and just slightly drop each level down so the Level below is not touching the level above.





     
    Last edited: Oct 14, 2013
  40. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello John,

    Yes I did it kind like this. Yours is very good and exactly fitting. As for the stitching, I will have to make something for this. I just disable the middle terrain from the outer terrains, and put them a little lower. So if you keep inside the high resolution terrain, you won't see it.
     
    Last edited: Oct 14, 2013
  41. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Thanks Nathaniel, Stitching between different resolution Heightmaps would be handy indeed for smaller play areas with still good quality surrounding areas with no visible gaps between.

    Now just need to sort my Issue when creating Terrains from Worldcomposser to Terraincomposser.
    Still getting extreme lockups on generating Terrain. I believe it happens if I remake the terrain, that is first time around it generates ok, but if I need to change something and regenerate from worldcomposser It seems to get stuck once terraincomposser starts to create the heightmaps onto the tiles that were created.

    (EDIT: It looks like the reason for taking so long is it appears to be re-importing/downloading the images again, rather than using the originals in the folder. I'm getting a image import progress bar coming up about every 5min or so).

    I believe this may be on my end, so I plan to re-install windows and see if that sorts out the issue. I notice that my 3dsmax seems to be acting up lately too, so I say its processor related.
    A fresh install should sort out the Issue hopefully. Then I can start to learn to get AAA terrains.
     
    Last edited: Oct 14, 2013
  42. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello John,

    I'm not sure what you are exactly doing here. But once exported terrains (with the 'create terrain' button) from WC to TC, and you would create terrains again from WC, it creates them double. As you have to delete the old ones from the hierarchy first. That's why it might get so slow. But once in TC you have to make the changes for example in the heightmap from TC not WC. Fresh install wouldn't help I think.

    What really slows it down is that WorldComposer sets the image import settings right for all images. Changing image import settings takes some time in Unity, the higher your image resolution, the longer it takes. The second time creating terrain though, WC doesn't change them anymore.

    The progress bar every 5 minutes is auto saving global settings from TC and WC, and it will save all rest of Assets in memory. You can change the time in TC Menu -> Generate Settings -> Auto Save Global Settings.

    We can do a screenshare on Skype and see what the issue is.
     
    Last edited: Oct 14, 2013
  43. lmtm

    lmtm

    Joined:
    Sep 9, 2013
    Posts:
    32
    Hi Nathaniel,

    what is simplest way to copy 8 filters controlled by different splatmaps ?

    Let me explain :

    I have 8192x8192 splatmap, which is splited to 4 (2x2 - 2048x2048pixels) pieces and 4 terrains (2x2 - 1024x1024m) .

    Whole splatmap includes 8 colors, it means each quater of splatmat has same colors.

    In 1st terrain and made 8 filters with 8 subfilters "controled" by 1st quarter of splatmap - it means by splatmap 1of4.

    For next 3 terrains I need to make same 8 filters with same 8 subfilters and color ranges but "controled" by next picture - by splatmap 2of4, 3of4, 4of4.

    How can I copy all 8 filters with all subfilters and color ranges and only change reference to splatmap?

    Maybe for 4 terrains I can do it manually, but I would like to split splatmat and terrain to 16 pieces and it would be great to have some quick solution how to do it.

    Or maybe it exist same better solution to solve this situation ?



    Thanks,

    Milos.
     
    Last edited: Oct 15, 2013
  44. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello Milos,

    I think you might be doing something here that can be done much more simple, but the best would be to do a screenshare on Skype and show you the best solution for it. My account is Nathaniel.Doldersum. Now it's late over here, but will be there in 8-9 hours.
     
  45. lmtm

    lmtm

    Joined:
    Sep 9, 2013
    Posts:
    32
    Ok, thank You for contact. Before calling You I will try to prepare some pictures.

    Milos.
     
  46. Phantasmus

    Phantasmus

    Joined:
    Oct 1, 2013
    Posts:
    4
    Hello

    We've got an issue with Terrain Composer runtime generation. I did everything according to your documentation and as a result I see that the terrain height map was generated right (from the image I used in import heightmap layer setup). But a splatmap is not generated well: I see only 1 texture on the terrain but I used 3 in splatmap layer setup. When I generate a terrain using Generate button it generates 3-textures terrain as expected. But with the same setup I do not see expected result after runtime generation. I tried to generate the height map and the splatmap step by step by setting tc_script.heightmap_output = true/false;
    tc_script.splat_output = true/false;
    variables but the result is the same. What could be wrong? Or maybe you have the new version of runtime generation scripts/docs? Because those on the website are very poor.
     
  47. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello,

    I think that is because you generate the heightmap and splat textures in 1 thread (call). Because the heightmap isn't there yet, a filter can't read the input height and steepness. So what you have to do is enable heightmap output first, call generate. Then activate splat output and call generate again.

     
  48. Tight-Tie

    Tight-Tie

    Joined:
    Oct 6, 2013
    Posts:
    13
    Hello

    I tried the method you described above but still without any success - only 1 texture is drawn (the first from the list of splatmap textures). It seems the generator do not use splat layers at all or do not start running splatmap generation. Please try to reproduce it:

    1) create a new scene
    2) add heghtmap layer and import some heighmap from an image
    3) add 2 splat textures
    4) add splat layer with these 2 textures
    5) add script below as a script component to Main Camera game object
    6) run the scene and you will see that only 1 texture is on the generated terrain

    After this you can try to create a terrain from terrain composer menu and click generate heightmap and then splatmap. You will see that in this case there will be 2 textures on the terrain without any pregeneration setup changes.

    Here is my C# code:

    using UnityEngine;
    using System.Collections;
    public class TerrainComposerRuntime : MonoBehaviour
    {
    GameObject TerrainComposer;
    object tc_script;
    GameObject TerrainComposerClone;
    object tc_script2;
    bool command_splatmap = false;
    void createClone()
    {
    // if (tc_script2 != null) { return; }
    TerrainComposerClone = (GameObject)Instantiate(TerrainComposer);
    tc_script2 = TerrainComposerClone.GetComponent("terraincomposer_save");
    }
    void generateStart()
    {
    tc_script2.CallMethod("generate_begin");
    tc_script2.GetType().GetField("generate").SetValue(tc_script2, true);
    }
    void Update()
    {
    if (tc_script2 != null)
    {
    if ((bool)tc_script2.GetFieldValue("generate"))
    {
    tc_script2.CallMethod("generate_output", tc_script2.GetFieldValue("prelayers").CallMethod("get_Item", 0));
    }
    else
    {
    //Destroy(TerrainComposerClone);
    if (!command_splatmap)
    {
    command_splatmap = true;
    createClone();
    tc_script2.GetType().GetField("heightmap_output").SetValue(tc_script2, true);
    generateStart();
    }
    }
    }
    }
    void Start()
    {
    TerrainComposer = GameObject.Find("TerrainComposer_Save");
    tc_script = TerrainComposer.GetComponent("terraincomposer_save");
    tc_script.GetType().GetField("heightmap_output").SetValue(tc_script, false);
    tc_script.GetType().GetField("splat_output").SetValue(tc_script, false);
    //generating plain terrain
    object ter = tc_script.GetFieldValue("terrains").CallMethod("get_Item", 0);
    tc_script.CallMethod("create_terrain", ter, 1, 1);
    //starting heightmap generation
    createClone();
    tc_script2.GetType().GetField("heightmap_output").SetValue(tc_script2, true);
    generateStart();
    }
    }
     
  49. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    Hello,

    Can you send me your complete C# code to my email address Nathaniel_Doldersum@hotmail.com?, as it doesn't compile here because object doesn't contain a defination for CallMethod.

    The issue here is that you create a terrain on the fly in runtime in the Start function, but then no splat textures are assigned to it, and even doing so it wouldn't work as TerrainComposer directly needs to access the splat alpha maps which are assigned to the terrainData, this I made to save memory in the Editor mode as no large Arrays are needed then. So from what I can see here from you code you will have a white terrain with no texturing. To create terrain at runtime I didn't finish that part and would have to put the SetAlphaMaps with array back into it.

    So what you have to do now is create your terrain with assigned splat textures from TerrainComposer in Editor. And then do the runtime generation using this terrain, then it should work fine. I will add and complete the runtime create terrain for TerrainComposer 2 after releasing it. If you really want to create them in runtime I can make this for you.
     
    Last edited: Oct 18, 2013
  50. Tight-Tie

    Tight-Tie

    Joined:
    Oct 6, 2013
    Posts:
    13
    Hm... It's strange that you don't have CallMethod for object class in Unity... But okay - seems that the problem is as you described.
    It's not comfortable for us to store several terrains in the project. We need to generate them on-fly - it was one of the main reasons why we've bought Terrain Composer. There were some words in your advert that you can save all the data and reproduce terrain generation. So we decided that this is exactly what we need.
    With the code I sent to you the terrain is generated not white only but with first texture from splat textures list but doesn't take into account the textures in splat layer list.
    What is your forecast when you'll be available to provide us with full on-fly generation code? It's really important for us.
    Thanks