Targeting uv sets via the api?


(Shaderbytes) #1

how do you target the different uv sets for updating/adding textures via the api ?? If a material has more than one UV set, how do i target the different UV sets?


#2

I’m not sure it’s possible at the moment. I suspect it will use whatever UV set is already on that channel.


(Shaderbytes) #3

ah thanks james , well for now i will test it like that… but please add it on the feature list then, since sometimes you dont want to have to set this up in the editor to use it via the api. I do it for some channels that dont have a texture set…

in the api then it simply has no texture object , so i create one for it :wink: this works well. Anyway thanks again


(Paul Sketch) #4

Hi, Could you please provide a model sample, and in ideal a simple demo code using it so that we can check ?


(Shaderbytes) #5

i dont mean i do uv channel selection options if you thought this is what i mean , i mean i do texture objects for channels that dont have a texture object. This is when no texture is assigned to the channel in the editor , then the returned materials dont have a texture object for that channel. I create a texture object like this ( but notice i also have an optional argument in my function “textureObjectDefaults” which can provide any changes to this default set up should you need them mostly for internalFormat and sometimes texCoordUnit :

texob = {};
texob.internalFormat = "RGB";
texob.magFilter = "LINEAR";
texob.minFilter = "LINEAR_MIPMAP_LINEAR";
texob.texCoordUnit = 0;
texob.textureTarget = "TEXTURE_2D";
texob.uid = 0; // not actual value , the uid still needs to be returned from a succcessful texture upload.
texob.wrapS = "REPEAT";
texob.wrapT = "REPEAT";

 // default properties for a newly created texture object are not always as coded above
 //when needed, pass in an object with any alternate specified properities and they will be used
  if (textureObjectDefaults !== null) {
     for (prop in textureObjectDefaults) {                           
        texob[prop] = textureObjectDefaults[prop];                           
      }
  }