Open reduz opened 5 years ago
Hi @reduz Currently the packing is pack to a square area, which means the same size with with and height, and the final texture coords is normalized to 0.0 ~ 1.0; So I guess you can multiply to what size you want. Unless you want specify the ratio of texture width and height. Maybe need a new api such as setPackRatio(float ratio).
The problem with this is the padding between the elements. If you know the right texel size, you can do proper padding in the packer (since the actual sizes are known). Otherwise I may scale the texture but padding will be wrong.
Ok, after I read the code in xatlas, I got what you mean. I will add this parameter for specify the texel size in the following days.
The texel size api is ready: https://github.com/huxingyi/simpleuv/blob/8375bb416a8a8bba9ef7fca65635ceaed0c19b72/simpleuv/uvunwrapper.h#L16
I also removed the Qt dependence.
@huxingyi Amazing, thanks!
@JFonS since you are working on the new Lightmapper in Godot, want to give this a spin?
@huxingyi btw I see you allow setting texel size, but how do you actually obtain the texture size back?
This can be used to fetch the actual square size, width and height are the same.
oh i see, looks great
Hello, may you help to use this library please, some example please. I want to contact with you.
Hi @FSSRepo Please see the example here: https://github.com/huxingyi/dust3d/blob/610bc978a8021ee34be33ca45ff90fb14ef444de/src/uvunwrap.cpp#L58
Thank you, :), I hope it works
For game engines, you often need to specify what a texel size will be in world coordinates (as in, meters or centimeters), then the unwrapper not only unwraps but decides what the texture size should be in order to make sure texels are the specified size.