antimony icon indicating copy to clipboard operation
antimony copied to clipboard

help on blend node

Open Cdriko opened this issue 7 years ago • 5 comments
trafficstars

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?

Cdriko avatar Jun 15 '18 12:06 Cdriko

Can you share your Antimony code?

mkeeter avatar Jun 15 '18 12:06 mkeeter

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 avatar Jun 15 '18 12:06 Cdriko

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

Cdriko avatar Jun 15 '18 12:06 Cdriko

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 avatar Jun 15 '18 15:06 Cdriko

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

Cdriko avatar Jun 19 '18 08:06 Cdriko