title: Procedural Landscape Generation from Data (BP, C++)
body: <p>in UE4 we want to create procedural landscapes from freely available geological and height data. We've been following the book "Unreal Engine 4 Scripting with C++ Cookbook", which is a little older. The code adapted accordingly also works well, until it comes to updating the landscape. It crashes at:</p>
  
  <pre><code>int32 numHeights = (rect.Width()+1)*(rect.Height()+1);
  TArray&lt;uint16&gt; Data;
  Data.Init( 0, numHeights );
  for( int i = 0; i &lt; Data.Num(); i++ ) {
  float nx = (i % cols) / cols; // normalized x value
  float ny = (i / cols) / rows; // normalized y value
  Data[i] = GeoHeightData( nx, ny, 16, 4, 4 );
  }
  LandscapeEditorUtils::SetHeightmapData( landscape, Data );
  </code></pre>
  
  <p>The function</p>
  
  <pre><code>LandscapeEditorUtils::SetHeightmapData( landscape, Data );
  </code></pre>
  
  <p>no longer exists. In LandscapeEdit.h you can find the</p>
  
  <pre><code>LandscapeEdit::SetHeightData
  </code></pre>
  
  <p>This is defined by</p>
  
  <pre><code>SetHeightData(InMinX, InMinY, InMaxX, InMaxY, (uint16*)ImportHeightData-&gt;GetData(), 0, false, nullptr);
  </code></pre>
  
  <p>is this function the equivalent to SetHeightmapData? The engine crushes with this approach too.</p>
  
  <p>Do you have any suggestions or workarounds for creating procedural landscapes, either from blueprint or code? We also checked out the approach of Christian Sparks (<a href="https://hippowombat.tumblr.com/post/...-ue4-420#notes" rel="nofollow noreferrer">https://hippowombat.tumblr.com/post/...-ue4-420#notes</a>), which is cool, but we need the landscape for runtime applications.
  Thx!</p>
  
  <p>reiti </p>