Jump to content

[SOLVED] Build Object Terrain with Unigine script


photo

Recommended Posts

Hi,

 

after my successful implementation of libnoise I try to integrate the information into Unigine. I create a new ObjectTerrain and two Images, one for my Heightrmap and one for a basic diffuse map. Next I fill the Height- and Diffusemap with my libnoise-information, which seems to be working fine.

The ObjectTerrain gets the Heightmap-Image and creates my terrain. Next I want to set the diffusemap to my Object, but without any success . I use setDiffuseTextureImage() to do that, but in my world the Terrain is still invisible (the function return a 0). Should I create a new Material for that? I try ObjectTerrain.addMaterial() to create an empty one (which Documentation says it is okay without any arguments) but the interpreter give me an error. So any hints for that?

 

Link to comment

Please look into the core/editor/plugins/landscape/landscape.cpp file on 1133 line.

This function creates terrain object dynamically.

"terrain_base" material must be assigned to the newly created terrain object.

 

setDiffuseTextureImage() function can't be used directly.

A precede calling of setDiffuseTextureName() function is required.

This function is designed for real-time assigned texture modification.

Link to comment

But for setDiffuseTextureName() a diffusemap for an separate image is required, isn't it? But I want to create my diffuse map on the fly with libnoise. So I create a new image-class in Unigine-script and simply parse the color information from my plugin to the newly created image.

I used Diffusemap.create2D(256,256,IMAGE_FORMAT_RGBA8,,,) to create my diffuse map.

Link to comment

You can create temporary buffered file in the file system addBufferFile(); Save an image into the file. And use it name as setDiffuseTextureName() argument.

This file will be located in the memory only.

Link to comment
×
×
  • Create New...