Jump to content

How to load a IMG_FileTTMap (Tile Texture Map)?


Recommended Posts

Hi,

 

has someone an idea how to use the IMG_FileTTMap class (Tiled Texture Map)? I just want to load a texture, sample the color by UVs and i want to filter the image. The IMG_File class doesnt provide that and i cannot open the texture like this:

IMG_FileTTMap* tex = IMG_FileTTMap::open(filename);

So how can i use this class?

Link to comment
Share on other sites

  • 1 month later...

I have the same problem. 

 

I came up with this. It is not very good, cumbersome and stupid but maybe it helps a little:

//load image
IMG_File *file = IMG_File::open("/data/app/sci6_x86_64/Houdini/13.0.399/hfs/houdini/pic/DOSCH_SKIESV2_01SN_lowres.rat");
UT_PtrArray<PXL_Raster *> images;
file->readImages(images);


// get res
int xRes = file->getStat().getXres();
int yRes = file->getStat().getYres();


// test uvs
float u = 0.4297;
float v = 0.4824;

float xu = u*(xRes-1);
float yv = v*(yRes-1);


// get pixel values
float vals[3];
images[0]->getPixelValue(xu,yv,vals);
for (int k=0;k<3;++k) cout << "Pixelval at " << xu << ", " << yv << " = " << vals[k] << endl;


file->close();
Edited by Macha
Link to comment
Share on other sites

Thank you Macha.

 

in this way i already have implemented it.

I had hoped that there is a possibility to use the IMG_FileTTMap or the TIL_TextureMap classes as it has been proposed in your subject topic.

 

Now i have written my own colorLookup() function to get the bi-linear interpolated texel color. It works well but it is a little bit redundant cause such a function already exists in the TIL_TextureMap class.

Edited by ClausKleber
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...