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

Gradients Node #1544

Merged
merged 8 commits into from
Feb 14, 2023
Merged

Gradients Node #1544

merged 8 commits into from
Feb 14, 2023

Conversation

adodge
Copy link
Contributor

@adodge adodge commented Feb 9, 2023

A node that creates a variety of gradients.

image

- 1, 3, 4 channels (color picker widget would be nice)
- horizontal, vertical, diagonal, radial, conic
- up to three color levels per gradient (UI is awkward)
set channels in output type
@joeyballentine
Copy link
Member

This has made me realize how badly we need a color picker input lol

@theflyingzamboni
Copy link
Collaborator

theflyingzamboni commented Feb 9, 2023

Before we add a gradient node, we should really finally implement a proper color picker (as a separate PR prior to this one). We need this for multiple other nodes, and this node is just too much without it. My suggestion remains to implement a color picker as a Popover (https://chakra-ui.com/docs/components/popover) that activates when selecting the singular color input.

Perhaps we could pick from and use one of these pre-designed React color pickers: https://casesandberg.github.io/react-color/. Even if we don't use one of these, it still offers an API for building our own.

As a side note, the color and position could be implemented as a group, allowing people to add additional color inputs (like how Text Append works).

@joeyballentine
Copy link
Member

Yeah I was thinking the exact same thing

@adodge
Copy link
Contributor Author

adodge commented Feb 9, 2023

How about a version of this that doesn't offer any color options, and just produces a gradient from [0,1] grayscale with whatever shape options? The rest could be done with a LUT if needed. That's maybe the more modular, node-y approach anyway.

@joeyballentine
Copy link
Member

That definitely could work

- More modular
- Can use a LUT to map colors if needed
- Punts on the need for a color picker widget
- NOTE: did this on my laptop without testing, so this might not actually run
@adodge
Copy link
Contributor Author

adodge commented Feb 10, 2023

Okay. Here's what that looks like:

image

@theflyingzamboni
Copy link
Collaborator

That could work as a stopgap, but I think that's all that should be seen as. With a proper color picker and groups, I think we can manage something much fuller featured.

@adodge
Copy link
Contributor Author

adodge commented Feb 10, 2023

We could have a node for turning greys to a color gradient, with specialized color picker widgets. It would be useful for the output of this and also other images. As inspiration: Blender's color ramp node

image

@theflyingzamboni
Copy link
Collaborator

theflyingzamboni commented Feb 10, 2023

Something color ramp-like would be cool, but I'm not sure how we could best implement it in the most chaiNNer-esque way. It would be nice to make it so users could input a colors via connection so we could have a Color Input node that could be connected to other nodes. Time for a crappy mockup (I'm so sorry):

node mockup

The colors swatches would be clickable to bring up the color picker. In an ideal world, the preview would have the movable squares like blender or GIMP as well so that their positions could be adjusted manually or by number input (Ignore that I drew it as output lol). There would also be dimensions and a Gradient Style dropdown like in the initial version (I was too lazy to add it to the mockup).

joeyballentine
joeyballentine previously approved these changes Feb 12, 2023
Copy link
Member

@joeyballentine joeyballentine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, and even though the overall way of creating colored gradients is limited right now i think this is a great starting point. Anyone disagree?

@theflyingzamboni
Copy link
Collaborator

Could we at least add some directionality controls to horizontal, vertical, and diagonal? With that, I think it would be an okay starting step until we can get the fundamentals necessary for a more advanced gradient node implemented.

@adodge
Copy link
Contributor Author

adodge commented Feb 12, 2023

How about this? I added a "reverse" input to all the styles, and redid diagonal to have an angle and width control.

image

- add "reverse" checkbox
- "angle" and "width" controls for diagonal
@theflyingzamboni
Copy link
Collaborator

Sounds good for now. 👍

@joeyballentine joeyballentine merged commit d1b275d into chaiNNer-org:main Feb 14, 2023
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

Successfully merging this pull request may close these issues.

3 participants