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

Add new color wheel for normal maps #1377

Merged
merged 1 commit into from Mar 12, 2018

Conversation

Projects
None yet
2 participants
@robinjam
Contributor

robinjam commented Jan 2, 2017

This PR adds a new type of colour wheel for creating/editing tangent-space normal maps (similar to the Angle brush in SpriteIlluminator).

I realise this is a bit of a niche feature, but I figured I'd open this PR anyway in case this is useful to anyone else.

This could be expanded upon by adding a lighting preview to the preview window, which would allow the user to test out their hand-drawn normal map from within Aseprite rather than having to export it first.

Screenshot

screen shot 2017-01-03 at 12 48 58

@dacap

I like the idea of a color map wheel but only if we add a "preview" or a "color map" layer/mask in a near future.

if (m_colorModel == ColorModel::NORMAL_MAP) {
float x = float(u) / float(m_wheelBounds.w / 2);
float y = -float(v) / float(m_wheelBounds.h / 2);
float z = std::sqrt(1 - x*x - y*y);

This comment has been minimized.

@dacap

dacap Jan 3, 2017

Member

I think here we should use the distance d (distance with the center of the wheel), and the angle a (which is already calculated below as double a = std::atan2(-v, u)) instead of x and y (as it's now it looks like a box instead of a wheel)

return app::Color::fromRgb(128, 128, 255);
}
}
// Pick from the wheel
if (d < m_wheelRadius+2*guiscale()) {
double a = std::atan2(-v, u);

This comment has been minimized.

@dacap

dacap Jan 3, 2017

Member

Inside this condition we should be calculating the normal map color depending on d and a.

case Harmony::TRIADIC: triadic.setSelected(true); break;
case Harmony::TETRADIC: tetradic.setSelected(true); break;
case Harmony::SQUARE: square.setSelected(true); break;
if (m_colorModel == ColorModel::NORMAL_MAP) {

This comment has been minimized.

@dacap

dacap Jan 3, 2017

Member

If the color model is NORMAL_MAP, we could just avoid adding none, complementary, monochromatic, etc. menu items inside menu variable.

@dacap dacap self-assigned this Jan 3, 2017

@dacap dacap added the enhancement label Mar 12, 2018

@dacap dacap added this to the v1.2 milestone Mar 12, 2018

@dacap dacap merged commit 88d1165 into aseprite:master Mar 12, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@dacap

This comment has been minimized.

Member

dacap commented Mar 12, 2018

Thanks @robinjam, I've just merged this PR. Made some changes in the formula to calculate the colors in the wheel and added an indicator to show the picked color in the wheel.

@dacap

This comment has been minimized.

Member

dacap commented Mar 12, 2018

Before:

before

After:

after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment