Jump to content

[SOLVED] getProceduralTextureImage


photo

Recommended Posts

Posted

hi, i try using getProceduralTextureImage function for generation 3D interface on Widgets in ObjectGuiMesh

 

i`m using Unigine example "Objects/gui_04"

 

i want get content image of widgets and apply displacement shader with this texture with some filtering

 

my code in update:

 

Material material = object_gui_mesh.getMaterial(0);
int id = material.findTexture("color");

if(id != -1) {
   Image img = new Image();
   if(material.getProceduralTextureImage(id, img)) { //Allways 0
      img.save(file_path);
   }
}
 

getProceduralTextureImage always return 0, what to do?

Posted

Hi there, Sergey!

 

First of all, you have to pass an Image instance first via setProceduralTextureImage call. After that you're able to get procedural images. You can find all this stuff in samples/shaders/particles_01 sample.

 

Gui is kind of specific case here as it's rendering outside engine's rendering sequence so it just skips all post-processing effects as well as procedural textures so there's no way you can get gui textures in the script.

 

However, you can write C++ which will render a gui texture for you, just use TextureRender and GUI classes.

×
×
  • Create New...