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 & Textures in the Renderer #38

Open
turbo opened this issue Jun 2, 2019 · 5 comments
Open

Gradients & Textures in the Renderer #38

turbo opened this issue Jun 2, 2019 · 5 comments
Labels
feature request New feature or request

Comments

@turbo
Copy link

turbo commented Jun 2, 2019

I've had a look through both renderer implementations and the interface seems to only handle stroke and fill so far. Are there any plans to implement more intricate fills, like gradients and textures (https://codepen.io/allenchum/pen/yqVvEa)?

This could be useful for a number of things, like character creation (skin tones, clothes, ...) and 2.5 tricks (e.g. faking ambient occlusion).

@turbo
Copy link
Author

turbo commented Jun 2, 2019

A good interface would be something along the lines of SVG.js' DrawGradient: https://svgjs.com/docs/2.7/elements/#gradient-constructor

@desandro
Copy link
Member

desandro commented Jun 3, 2019

Add a 👍 reaction to this issue if you would like to see this feature added. Do not add +1 comments — They will be deleted.


Thanks for this feature request. No, no current plans for gradient or texture fills. The implementation differs significantly between canvas and SVG, so this would be a substantial feature. Zdog uses flat colors by design as its easy to support for me and easy to developers to use. Once you add in gradients, the next ask is for lighting and shadows. At which point you're better off using Three.js. I'm not completely against gradients and texture fills, but I do feel its not a good fit for how I see the project.

@turbo
Copy link
Author

turbo commented Jun 3, 2019

@desandro That's not the intended direction of my request. You seem to understand my request for "textures" as textures in the 3D engine sense. I mean literal textures, patterns (whatever) applied to the actual 2D shape. Adding grunge, a gradient etc. to character elements to make it visually more interesting, not to make it more "3D" (because we already have that for canvas: http://www.kevs3d.co.uk/dev/phoria/).

@desandro desandro added the feature request New feature or request label Jun 4, 2019
@shm-sl
Copy link

shm-sl commented Jul 3, 2019

@turbo If you use SVG, you can already set the color attribute to url("#gradientID"). https://codepen.io/anon/pen/RzJGJx

@blurymind
Copy link

@shm-sl its a cool demo, but the gradient is 2d and completely flat. What if we want a gradient that is relative to the camera position or one that is radial/ emphasizing whatever shape it renders in.
I guess the real question is how do we do pseudo3d materials :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Development

No branches or pull requests

4 participants