Jump to content
ClausKleber

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×