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

help on blend node #192

Open
Cdriko opened this issue Jun 15, 2018 · 5 comments
Open

help on blend node #192

Cdriko opened this issue Jun 15, 2018 · 5 comments
Labels

Comments

@Cdriko
Copy link

Cdriko commented Jun 15, 2018

hello
I try to use the blend node, to get the same result than this
with shape.js

but it seems to do anything totaly different.
I'm right ?

wich parameter can I set to get the same result?

@mkeeter
Copy link
Owner

mkeeter commented Jun 15, 2018

Can you share your Antimony code?

@Cdriko
Copy link
Author

Cdriko commented Jun 15, 2018

I would like to reproduce the blending function used by shapejs

the source is here

in /MathUtil.java line 1668

blendMin and Max

The result is the rounding of edges, wich its nicer and easyer to print.

not a morph kind like I see in antimony
gyro.Variable1.zip

@Cdriko
Copy link
Author

Cdriko commented Jun 15, 2018

sorry it's line 1728 : public static final double blendQuadric

@Cdriko
Copy link
Author

Cdriko commented Jun 15, 2018

I've tried to transpose the GLSL code, but I don't no exactly what put in the "output" function (follow doesn't work)

import fab

title('BlendQ')
input('a', fab.types.Shape)
input('b', fab.types.Shape)
input('q', float)

def blendQuadratic(x):
	return (1.0-x)*(1.0-x)*0.25

def blendMax(a,b,w):
	dd=max(a,b)
	if (w<=0.0):
		return dd
	d=abs(a-b)
	if(d<w):
		return dd+w*blendQuadratic(d/w)
	else:
		return dd




output('shape', 0.5*blendMax(a,b,q))

@Cdriko
Copy link
Author

Cdriko commented Jun 19, 2018

in fact, I want to create the blend function defined in libfive examples :

(define (blend a b m)
  (min a b (+ (sqrt (abs a))
              (sqrt (abs b))
              (- m)) ))

(the result is rounding joint edges)
but I fail to write it in correct F-rep syntax

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

No branches or pull requests

2 participants