[Solved] Change the texture in a ImageTextureNode between renders

The desired workflow is Render1 -> change texture -> Render2

Now render 1 works perfectly but render 2 has the same texture (cameras have been moved correctly and so)

it seems that ((ccl::ImageTextureNode*)cyclesTex)->filename = ccl::string(getTexturePath()) + ccl::string(matTrans->mDiffuse->mName); is ignored

I tried scene->image_manager->need_update = true; and lots others too

Regards, Víctor

A bit more ellaborated failing test:

ccl::ImageMetaData metadata;
scene->image_manager->add_image(newPath, ((ccl::ImageTextureNode*)cyclesTex)->builtin_data, false, 0, ((ccl::ImageTextureNode*)cyclesTex)->interpolation, ((ccl::ImageTextureNode*)cyclesTex)->extension, ((ccl::ImageTextureNode*)cyclesTex)->alpha_type, ccl::u_colorspace_auto, metadata);

ccl::Progress p;
scene->image_manager->device_update(scene->device, scene, p);
scene->image_manager->need_update = true;
((ccl::ImageTextureNode*)cyclesTex)->filename = newPath;

shader->need_update = true;
shader->tag_update(scene);
scene->shader_manager->need_update = true;

for future readers ImageTextureNode->is_float = -1; did the work!

1 Like