steve3d Posted November 15, 2013 Share Posted November 15, 2013 While I'm trying to integrate the substance engine into unigine. I found there is no way to create a virtual texture in memory with C++. I don't know if I'm correct with these: unigine can only create managed textures from files on disk. using dynamic textures will make this texture exists both on system memory and video memory. system memory is a Image instance, and video memory is actual api depended texture. dynamic texture is usefull when we want to create some procedual texture from script. but with substance engine, it can directly generate api texture format and this texture can be used directly into video memory's texture. So when we use substance materials to create it's texture, of course I don't want to make this texture as dynamic texture to keep a copy in system memory. we just want it directly into video memory. when some substance input parameter changes, then update the video memory's texture to new generated texture. by using dynamic textures with int Material::setImageTextureImage(int num,const Image ℑ,int dynamic) function, I'm using that function to set new generated texture, if dynmaic=0, then all textures of this material's parents will be the same new texture, so I can only use dynmaic=1. If I have 20 substance material and they all create 1024x1024 texture, then system memory will use up to 20*4M*3=240M(diffuse and normal and spec texture) to store these textures. This is not acceptable when I just want to use substance's as texture only. because there is no need to access these texture and modify it using script or other method. So I want to make a suggest: add a feature to unigine so we can use engine.renders->createTextureManaged to create a managed virtual texture from a Image instance based on it's unique virtual texture name. I'm asking this for C++ part, and I don't think this would benifit the script engine. and I believe with this new engine functionality, we can integrate more virtual texture techs into unigine. Link to comment
steve3d Posted November 15, 2013 Author Share Posted November 15, 2013 well, in another word of this suggestion, create another function like dynamic texture but this texture don't have a system memory copy. Link to comment
frustum Posted December 25, 2013 Share Posted December 25, 2013 System memory copy is required for correct video mode changes. All video textures will be destroyed on video mode change. So you should handle "destroy" plugin callback manually in that case. I will add sugestion regarding dynamic textures into todo list. Link to comment
steve3d Posted December 26, 2013 Author Share Posted December 26, 2013 thanks for the information, for substance air integration, there is not possible to create a plugin. it must be directly integrated into the engine. Link to comment
Recommended Posts