Jump to content

setAlbedoTextureImage()/setAlbedoTextureName() interplay


photo

Recommended Posts

On Unigine 2.3.1, I've edited data\samples\objects\terrain_00.cpp as attached. First using setLayerEnabled(i, false) to remove all the layers, then setAlbedoTextureName("") to remove the albedo texture, then creating an in-memory Image and applying it with setAlbedoTextureImage().

Unfortunately when I run the sample, the setAlbedoTextureImage() call does nothing. However, if I uncomment the second call to setAlbedoTextureName() which feeds it a nonsense value, the subsequent setAlbedoTextureImage() call suddenly works. So my question is whether (and why) setting the Name to "" should prevent setting the Image?

(This might seem contrived, but in our real application we never load an on-disk texture so it acts as if the Name is "" from the outset. The workaround gives us the result we want, but obviously we're getting an error message from it so don't have faith that it's the right way to go.)

terrain_00.cpp

Link to comment

Hi Greg,

That's interesting behavior. I've successfully reproduced this in current 2.6 developer branch. Right now I can't say what exactly cause such behavior, but  if I recieve more information from dev team I will surely let you know.

Right now I think you should be safe to use this method to set the terrain texture (there will be error in console, as you already mentioned).

Thanks for the bug report!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • 4 weeks later...

Faced similar issue and observed that there is a check before albedo texture is set

int ObjectTerrainMaterial::setAlbedoTextureImage(const Image &image) const {
if(albedo_texture_name.empty()) return 0;
Image temp = image;
return albedo_texture_ptr->setImage(temp);
}
Link to comment
×
×
  • Create New...