Jump to content

WrinkleysRule

Wrinkley
  • Posts

    245
  • Joined

  • Last visited

  • Days Won

    56

Posts posted by WrinkleysRule

  1. Yes a python script is required to open the csv file in Blender, there is a link to the download in the tutorial for the only version currently available which only works in Blender 2.93

    https://blenderartists.org/t/a-script-to-import-a-csv-file-and-create-meshes-for-blender-2-5x-or-later/501410

    If you have a created a python script that does the same in Blender 3.2 and above  that would be great.

    I did look into creating a mesh fom the CSV data in lua  so the spline could be exported as an obj mesh but decided to go with the CSV conversion instead (easy option)

     

     

     

  2. Glad you like it, it does give another dimension to terrain textures, as always use a blank map to experiment on with the all scripts before using on a WIP map and make a note of any settings that you like for reference.

    Just a little reminder, if you save the map the attributes and values entered are saved for each individual spline so when opening a map for a fresh session the attributes and values are still there.

  3. Given the interest shown in the pothole example and the problems when textures are aligned to terrain sections (North/South, East/West) I have redone the Terrain Paint Scripts to include a separate section
    which allows the painting of a texture at random distances around/either side of a spline which can simulate a pothole effect or just add a random texture to others i.e path texture GRAVEL random texture GRAVELGRASS

    The new scripts Terrain Paint R Set Up and Terrain Paint_R are described below and are available in the Terrain Paint R zip at the end of this tutorial to install just copy/ paste the scripts directly into

    C:\Users\YOUR COMPUTER NAME\AppData\Local\GIANTS Editor 64bit 9.0.3\scripts             (or whatever GIANTS Editor 64bit version you are using)

    They can replace the exsisting Terrain Paint and Terrain Paint Set Up scripts if desired.

    The TERRAIN PAINT section of the new script works in the same way as the original terrain paint script all thats been added is an extra RANDOM PAINT section.
    To use the TERRAIN PAINT on its own leave the 'Select Random Paint' attribute deselected if this attribute is selected ONLY the RANDOM PAINT section will be executed
    when the 'Terrain Paint_R' script is selected

    Create a spline in Giants Editor and align the spline along the terrain to whatever area you are intending to paint,
    the spline does not have to be accurately aligned painting will only occur at the terrain height.

    Then with the spline selected, 

     Select –Scripts--' Terrain Paint R Set Up'

    This will create the User Attributes  necessary for the Terrain Paint_R script

    User Attributes panel after executing the  'Terrain Paint R Set Up' script

    roQDw4U.png

    A print out in the Console log of the terrain layer textures in the following format will also be created

    Texture No :93:Texture Name : shingle01
    Texture No :94:Texture Name : shingle02
    Texture No :95:Texture Name : shingle03
    Texture No :96:Texture Name : ANIMALMUD
    Texture No :97:Texture Name : AS
    Texture No :98:Texture Name : ASPHALT
    Texture No :99:Texture Name : CONCRETE
    Texture No :100:Texture Name : DIRT

    Both sections TERRAIN PAINT and RANDOM PAINT are executed independently using the Terrain Paint_R script.
    If the 'Select Random Paint' attribute is selected only the RANDOM PAINT section is executed and
    conversley if deselected only the TERRAIN PAINT section is executed

    Description of settings in TERRAIN PAINT Attributes section

    Set Centre Texture Width         ---Width of the Centre Texture in metres
    Set Edge Texture Width           ---Width of the Edge Textures in metres (Value set is applied to both left and right edges)
    Set Edge Texture Left            ---Enter required left edge texture number from Consol log.
    Set Centre Texture               ---Enter required Centre texture number from Console log
    Set Edge Texture Right           ---Enter required Right edge texture number from Consol log.
    Set Distance Between Textures    ---How far apart the textures are painted along the spline (default 0.5)

    Once set up then select the 'Terrain Paint_R' script to execute, ensuring  'Select Random Paint' attribute is deselected,

    A print out in the GE console log will detail the following TERRAIN PAINT attribute settings for reference

    Spline name:
    Texture Left:  no, name
    Texture Centre:  no, name
    Texture Right:   no, name
    Centre Width :(m), Edge Width: (m), Texture Distance: (m)

    If the Set Edge Width Texture is set to zero (0) only the following will be shown in the log

    Spline Name,
    Texture Centre no,
    Centre Width
    Texture Distance

    Should you require only the Centre Texture then Set Edge Width Texture to zero (0) and adjust your Centre Width settings accordingly

    Description of settings in RANDOM PAINT Attributes section

    Select Random Paint            --- When selected and the 'Terrain Paint R' script executed only allows RANDOM PAINT attributes to be used for painting.
                                                     Must be deselected to allow the normal Terrain Paint Script Operation
    Random Width                     --- Value sets the maximum the texture is painted around the spline
                                                     e.g a value of 16m will paint the texture a maximum of 8m around/either side of the spline
    Random Texture                   --- Texture Layer number from Console log
    Distance Between Textures    --- Sets the distance between textures, the larger the distance the less textures
                                                       the smaller the distance more textures and sometimes greater size due to close proximity of textures.

    Once the RANDOM PAINT User Attributes have been set then,

    With the spline selected   Select ---Scripts--- 'Terrain Paint_R' the chosen texture will then be painted according to the RANDOM PAINT User Attribute settings

    A print out in the GE console log will detail the following RANDOM PAINT attribute settings for reference

    Spline Name
    Random Texture: no, name
    Random Width: (m)
    Texture Distance: (m)

    If you are not satisfied with the random texture result then simply deselect the 'Select Random Paint' attribute and execute the Terrain Paint_R script which will then repaint the original TERRAIN PAINT settings
    overpainting the unwanted random texture which can then be repainted by reselecting the 'Select Random Paint' attribute and after adjusting any attributes as necessarry select the Terrain Paint_R script again.
    Note: Because the texture is painted randomly around the spline there will be some textures painted before and after the spline ends, which can easily be cleaned up by using the normal terrain brush.

    The images below show the results painting with the TERRAIN PAINT section and then with the RANDOM PAINT section to give a more natural pathway effect
    with a print out of the attribute settings in the console log on the right of the pictures.

    Image 1
    Settings
    Set Centre Texture Width         --- 8m
    Set Edge Texture Width           --- 4m (Value set is applied to both left and right edges)
    Set Edge Texture Left            --- 109 GRAVELGRASS.
    Set Centre Texture               --- 113 PATHWAYGRAVEL
    Set Edge Texture Right           --- 107 GRAVELDIRT
    Set Distance Between Textures    --- 0.2
    'Terrain Paint_R' script executed

    A 16m wide pathway has been painted with different textures either side of the path

    8mnhr2X.png

     

    Image 2
    Settings
    TERRAIN PAINT settings left as before

    RANDOM PAINT Settings
    Select Random Paint            --- Selected
    Random Width                     --- 16m  (from TERRAIN PAINT Settings 8m = two 4m edges = 16m)                                
    Random Texture                   --- 109 GRAVELGRASS
    Distance Between Textures        --- 1
    'Terrain Paint_R' script executed

    A random GRAVELGRASS texture has been painted over the 16m TERRAIN PAINT textures

    ODl4LW0.png

     

    Image 3
    Settings
    TERRAIN PAINT settings left as before

    RANDOM PAINT Settings
    Select Random Paint            --- Selected
    Random Width                     --- 16m  (from TERRAIN PAINT Settings 8m = two 4m edges = 16m)                                
    Random Texture                   --- 91 waterPuddle
    Distance Between Textures        --- 2
    'Terrain Paint_R' script executed

    A random waterPuddle texture has been painted over both the previous script executions giving the impression of potholes

    VnhPNZT.png

     

    The above images are just an example, always experiment and try out the various script settings on a blank map before using on a WIP first

     

    Terrain Paint R scripts.zip

  4.  No problems here with the either Random Object Distance/Random Object Placement settings , though I've just noticed the descriptions in the tutorial above have not been updated to the new labels. Now corrected with some additional information.

    For Random Object Distance to work it must first be selected then a Set Random Object Distance Seed value inserted , higher number greater variation in distance

     

  5. Unfortunately there doesn't seem to be any commands within the Giants Editor Lua set up that will allow painting of foliage or terrain detail by spline, unlike the textures which have the 'setTerrainLayerAtWorldPos' command

    Why don't you just use the spline to create the field border, then using the Limit to Texture box in the FoliageLayer Painting panel  to paint the chosen Terrain Detail without overpainting the spline paint texture.

    for example spline paint -- grass

    foilage Layer --Terrain detail --Ground TYpe --Cultivated

    Limit to Texture -- dirt  or whatever the terrain texture  is inside the  spline grass border area

    Because of the way the terrain is painted you will only be able to get precise edges by painting in a North/South or East/West direction following the terrain sections.

    You can also use the new field spline to place hedges/trees etc around your field, (removing sections for gateways manually of course)

    The image below shows the result of the above settings although I have substituted the dirt texture for Rough Sand to give a clearer indication of the painting--- centre texture is the Terrain Detail ---Cultivated

     

    OG11Dlp.png

  6. To overcome this problem change the following in the Terrain Paint script  at  line 99    "for i = 0, mSideCount, 1 do" to --- "for i = 0, mSideCount, mSplinePiece do" this will set the texture paint distance to the "(s).Set Distance Between Textures" value

    I will do some further tests before updating the main scripts to this new setting

     

  7. In the User attributes there is a setting for adjusting the distance between textures when painting "(s).Set Distance Between Textures" which is set by default at 0.5, try lowering this figure to say 0.25 and see what result you get.

    Your image is almost the same as the example image in the tutorial of a setting of 1.5 in the "(s).Set Distance Between Textures" attribute.

  8. Added Updated scripts due to a couple of errors in Spline Placement script.

    Line 62 should read ---   local monitor = getNumUserAttribute(splPl)       not   ---local monitor = getNumUserAttribute(mSplineID)

    Line 74 should read --- local scaleHigh= getUserAttribute(splPl, "(h).Set Scale High ")           not  --- local scaleHigh= getUserAttribute(splPl, "(h.)Set Scale High ")

    Apologies for errors

     

  9. Slightly confused with your problem, were you editing in game or with Giants Editor

    Quote

    I clicked to save the game

    , if in game then you can check your saveGameBackup folder to see if you have a more recent automatic save.

    However if you were editing in Giants Editor when the crash occurred then I'm afraid you have lost your changes, try opening the map again in Giants Editor and check the editor_log.txt file (C:\Users\Your Computer Names\AppData\Local\GIANTS Editor 64bit 9.0.3\editor_log.txt) to see what errors (if any are listed) and correct them, it maybe just an map.i3d corrupted text problem which happens sometimes with normal saves.

  10. The scripts have now all been updated (28/10/22.)
    The man difference is in the Spline CSV Creator and Spline CSV Creator Set Up scripts, these have now been changed so that all inputs are done from the User Attribute Panel in Giants Editor.
    There is no longer any need to copy/paste the spline.i3d or spline__CSV data from the Giants Editor log.txt this is now down automatically by creating a new folder (CSVdata) in your map root folder and creating a new spline_CSV.i3d and spline _CSVdata.txt in that folder.

    Brief view operating the Spline CSV Creator and Spline CSV Creator Set Up scripts,


    Open Map in Giants Editor,


    Create a spline and align it to the road/rail network you wish to model, naming it accordingly.
    The spline can be called any name as long as it has the word spline in it i.e. road01_spline,  spline_2 etc,
    the name chosen will also be the name of the spline.i3d and spline_CSVdata.txt  created in the CSVdata folder in your map root folder.


    Select --Scripts --Spline CSV Creator Set Up
    Insert map name in the (b).Map Name attribute --Full name must be entered note also the entry is case sensitive.
    Enter required value in the (c).CSV Distance attribute.


    With the spline selected, Select -- Scripts --Spline CSV Creator .
    A new Spline.i3d  with your chosen Spline name will be placed in a newly created CSVdata folder in the map root folder along with a Spline_CSVdata.txt file.

    (For this example a spline name of road01_spline and a map name of Manor Farm has been used)
    The message ‘New Spline: road01_spline_CSV.i3d and  road01_CSVdata.txt created in Manor Farm / CSVdata Folder’ will also appear in the consol log


    The new road01_spline.i3d can be imported directly into the map in GE by selecting File-Import and navigating to the CSVdata folder in the map root folder and selecting the road01_spline_CSV.i3d which will then appear at the correct location in your map.
    The road01_CSVdata .txt  is for use with the csv_importer script in Blender 2.79(only at the moment) and can be referenced in Blender directly from the CSVdata folder.

    All the other scripts and tutorials have been updated to reflect this new change.
     

    • Thanks 1
  11. Apologies, I have just noticed an incorrect instruction in the Spline Placement Transform script printed in the Console log, the last line should read,

    Set Attribute Values then Select 'Spline Placement' script to Execute

    and not

    Set Attribute Values then Select 'Place Objects 2' script to Execute

    I have altered it and included  the corrected version in the Updated Spline Scripts at the bottom of the tutorial.

     

  12.  

    So, have you with the splinePlacement transform group selected then filled in the relevant User Attributes and with the splinePlacement transform group still selected, selected the Spline Placement script to place the objects.

     

    The splinePlacement transform group has to be selected when entering the User Attributes and also when the  Spline Placement script is run.

  13. Whilst I cannot comment on any other tutorial as it may not use the script versions posted here, I suggest when placing a transform group with objects inside it you first select the transform group and freeze transform translate/scale/rotation settings before adding it to the objectsToPlace transform.

    I appear to have missed putting this in the tutorial so I will update the tutorial to include this note