Jump to content

[CLOSED] Texture from file


photo

Recommended Posts

Hi everyone, I`m currently trying to figure out a way to load up a png as a texture for futher usage in materials, but after I tried multiple combinations of conversations, for example, loading png to Image, then passing it to texture, and then passing it to the material gave me no results.

Link to comment

Hi Ilya,

One of the solution is to find a material where you need to change texture and do the following (note: UnigineScript ahead):

ObjectMeshStatic mesh = add_editor(new ObjectMeshStatic("samples/common/meshes/box.mesh"));
Material material = mesh.getMaterialInherit(0);
int texture = material.findTexture("albedo");
material.setTexturePath(texture,"core/textures/common/white.dds");

We do not recommend to use non-runtime texture formats (png, jpg, tga and so on) due to lack of mipmapping, larger memory footprint and possible spikes while decoding this texture.

If you can convert it via editor to dds it will be much better.

Also you can create bunch of materials using the Editor2 with different textures and later just switch between materials in runtime, rather than changing the texture itself.

Thanks!

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

Link to comment
  • fedorov.ilya changed the title to [CLOSED] Texture from file
×
×
  • Create New...