shader-park / shader-park-core

A JavaScript library for creating real-time 2D and 3D shaders. JS -> Shader. https://shaderpark.com/ https://twitter.com/shaderpark

Home Page:https://shaderpark.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

input has argument of a shape

Cdriko opened this issue · comments

I made a shape like that :

var AlB2=shape((R)=>{
  var t=R*0.667;
  var Z=sqrt((R*R)+ (2*R*t)-3* (t*t));
  
	displace(3*t,t*Racine3,Z);
  sphere(R);
}

If I call it with a numerical argument it's ok, but if I use an input, it fails and don't render.

Take a look at https://shaderpark.com/sculpture/-N0_-mG9uWF-OuYurpSx for the complete code

Hey, thanks for reporting this!
The reason that's happing is a missing feature/bug on our end. @torinmb and I are working on a fix.
The issue is actually line 45:

displace(-t,t*Racine3,0.);

With our current setup, you can't directly negate yet a non-primitive variable with -. Subtraction works fine, but the negative can't go in front by itself.
Fortunately there is an easy work around you can use before the fix is out, just do -1*variable instead of -variable.
So if you change line 45 to:

displace(-1*t,t*Racine3,0.);

It will work!