ClausKleber Posted May 16, 2014 Share Posted May 16, 2014 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? Quote Link to comment Share on other sites More sharing options...
Macha Posted July 8, 2014 Share Posted July 8, 2014 (edited) 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 July 8, 2014 by Macha Quote Link to comment Share on other sites More sharing options...
ClausKleber Posted July 10, 2014 Author Share Posted July 10, 2014 (edited) 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 July 10, 2014 by ClausKleber Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.