2
$\begingroup$

Hi There Blender Peeps and Lovers... I need some help.

I tried to draw Quadratic Bezier curve SDF using Blender's node editor. In order to complete this challenge, I referred to the code from Inigo Quilez, and tried to implement it in Blender with nodes, but as you can see, Although the final effect showed some rudiments of curves(The red dot is the control point), it failed overall.

Quadratic_Bezier_SDF_failure

I have checked the nodes several times and confirmed that the failure should not be caused by the connection error of the node. Finally, I compared the output of each line of code in the shader of Godot one by one, and found that the problem may be the square root operation, negative values in Blender The square root result is 0, but Godot is not. It seems that Godot's shader can perform operations on complex numbers, but I'm not sure.

Besides, I don't understand the mathematical principles of Quadratic Bezier curve SDF, but I don’t want to give up. Is it possible to calculate complex numbers using Blender shader or is there another way to implement Quadratic Bezier curve SDF?

And here is my .blend file.

$\endgroup$
1
  • 1
    $\begingroup$ Interesting post... I note that the linked bezier code has a condition for if h>=0.0 and so doesn’t attempt the sqrt when less than 0 - it would be useful to share your nodes as an image so that people could view it without having to download the blend file. $\endgroup$ Jan 7, 2021 at 11:46

1 Answer 1

2
$\begingroup$

I have found the reason. The problem is in my node tree. You only need to change the multiply node to the division node in the image below. I was so careless and made such a stupid mistake. Thank you for your attention to my problem. Also, Blender can indeed handle complex numbers.

change

And here is the expected effect.

res

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .