Resolution of pre-distorted textures
-
Hi,
I'm working on a model exporter plugin (to AC3D format) and I'm wondering whether there is a way to increase the resolution of pre-distorted texture files that are written by the TextureWriter for faces which have their texture distorted in such a way that the distortion can't be represented simply by UV coordinates. The problem is that the pre-distorted textures have very low resolution and look very grainy.
Update: the problem is mostly with small tilable textures, because the TextureWriter apparently uses the original texture size when writing the pre-distorted texture. So when there's a small texture that has been tiled and distorted the written texture is pre-distorted and also pre-tiled but has the same pixel size as the original small texture.
I think it would make more sense to increase the written texture size by the same factor with which the original texture has been tiled on a face.Here is an example:
Thanks
Ralf -
The API does not provide any controls for this.
What you can do (if your application supports distorted texture coordinates) is to export the original texture image (create a temporary group, apply the material and write it through TextureWriter).
Or you export the original texture image and apply the distortion with an external image processing library (like imagemagick), according to settings of your choice )like double the image resolution).
The problem is not trivial. I once tried to do a better "Make texture unique", but it's hard to determine the best texture size because the resolution of a distorted texture in the model varies a lot. For example one could sample the texture resolution in the center of the face, but then the upper right corner in your example would have too high resolution whereas the lower left corner would still be blurry.
-
Thanks for the suggestions! You're right, there's no single "tiling factor" in a distorted texture. I think I'll ignore this problem for now and solve more important issues first.
By the way, is there perhaps some kind of exporter plugin template that does all the complicated stuff of getting the needed model information out of SketchUp? Something that's only missing the actual writing of the target file format.
Advertisement