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

Extrusions - add depth to shape #15

Open
adamgreenough opened this issue May 29, 2019 · 6 comments

Comments

@adamgreenough
Copy link

commented May 29, 2019

Is there a way to add depth to a custom shape like there is with the box? Would love this!

I have drawn out my shape in 2D. I have tried cloning in to z space and joining up points but there seems to be some buggy seethrough faces behaviour with this method.

https://codepen.io/xadz/pen/BeObVO

@desandro desandro changed the title Add depth to shape? Extrusions May 30, 2019

@desandro

This comment has been minimized.

Copy link
Member

commented May 30, 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.


No, Zdog does not currently support extrusions. This could be a good add-on feature

@desandro desandro changed the title Extrusions Extrusions - add depth to shape May 30, 2019

@natemoo-re

This comment has been minimized.

Copy link

commented Jun 11, 2019

I’ve been looking into this. Any thoughts on how curved faces could be handled?

One implementation could use polygonal triangulation, but that seems out of sync with Zdog’s philosophy.

Zdog is round. All circular shapes are rendered as proper circles with rounded edges. No polygonal jaggies.

I wonder if there's a way to fake it like Cylinder cleverly renders a stroke. Finding a solution here would probably cover #25 as well.

@desandro

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

In my head, a Zdog extrusion would take a naive approach and extrude shapes point-by-point. This would cover angular polygons, but not curved faces. Zdog is not well-suited for for curved faces.

I do know that finding contours on bezier paths is mathematically possible, but its over my head. It involves calculus and derivatives. If anyone with proper calc skills wants to help here, that'd be fantastic.

@turbo

This comment has been minimized.

Copy link

commented Jun 11, 2019

Bezier extrusion could be done point by point. For example, in the Love2D engine, Bezier curves are not graphics primitives but are paths (polygons) constructed from control points (n-degree). The curve is "rendered" by subdividing (De Casteljau) it into segments by a given granularity. Follow links to see the implementation.

@ryanrossiter

This comment has been minimized.

Copy link

commented Jul 26, 2019

I created a shape extrusion proof-of-concept using the react-zdog bindings: https://ryanrossiter.com/shape-extrusion-zdog/ (repo)

It's accomplished by stacking shapes on top of each other in a group, so fairly naive but it's a start!

@wuliTTo

This comment has been minimized.

Copy link

commented Jul 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
6 participants
You can’t perform that action at this time.