Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for texel size as input parameter #1

Open
reduz opened this issue Aug 8, 2019 · 11 comments
Open

Support for texel size as input parameter #1

reduz opened this issue Aug 8, 2019 · 11 comments

Comments

@reduz
Copy link

reduz commented Aug 8, 2019

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.

@huxingyi
Copy link
Owner

huxingyi commented Aug 8, 2019

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).

@reduz
Copy link
Author

reduz commented Aug 8, 2019

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.

@huxingyi
Copy link
Owner

huxingyi commented Aug 8, 2019

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.

@huxingyi
Copy link
Owner

The texel size api is ready:

void setTexelSize(float texelSize);

I also removed the Qt dependence.

@reduz
Copy link
Author

reduz commented Aug 10, 2019

@huxingyi Amazing, thanks!

@JFonS since you are working on the new Lightmapper in Godot, want to give this a spin?

@reduz
Copy link
Author

reduz commented Aug 10, 2019

@huxingyi btw I see you allow setting texel size, but how do you actually obtain the texture size back?

@huxingyi
Copy link
Owner

float getTextureSize() const;

This can be used to fetch the actual square size, width and height are the same.

@reduz
Copy link
Author

reduz commented Aug 13, 2019

oh i see, looks great

@FSSRepo
Copy link

FSSRepo commented Apr 12, 2020

Hello, may you help to use this library please, some example please. I want to contact with you.

@huxingyi
Copy link
Owner

@FSSRepo
Copy link

FSSRepo commented Apr 12, 2020

Thank you, :), I hope it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants