3
$\begingroup$

Trying to get a smooth modulo texture based on nodes only, is this possible? The modulo function produces hard edges.

Similar to the following wave example: $$\frac{1}{t}\arctan\left(\frac{t\sin\left(x\right)}{1-t\ \cos\left(x\right)}\right)$$

enter image description here

Which can be ran here: https://www.desmos.com/calculator

$\endgroup$
6
  • $\begingroup$ I literally provided the formula in basic mathematics. Lol My issues is getting this in blender with nodes. $\endgroup$ Mar 10, 2022 at 23:19
  • $\begingroup$ You can curve the inner lines pretty easily, or at least fake it, but curving the peaks is a bit more tricky. Blender has all the math nodes you need to recreate that formula- the Math node has Arctangent, Sin, Division, and Cosine. You have everything you need, you just have to recreate it $\endgroup$ Mar 10, 2022 at 23:47
  • $\begingroup$ Exactly that. But I would need that knowledge of trig to understand how to port that to linear nodes. I do not have the necessary mathematics to do that. I also have dyscalculia terribly. It's hard to even carry the same integer in my mind while calculating without it spontaneously becoming another. Lol $\endgroup$ Mar 11, 2022 at 1:24
  • $\begingroup$ Do you want this in Geometry Nodes or Shader Nodes? The solution is slightly different in each case. $\endgroup$ Mar 11, 2022 at 1:31
  • 1
    $\begingroup$ @WASasquatch,I have update the answer,I made it by nodes,and the only thing you should do is input the formular.When you have many formular to show,you don't need to create different nodes anymore! $\endgroup$
    – NatureK
    Mar 11, 2022 at 3:38

2 Answers 2

5
$\begingroup$

The Math node part of what you're looking for is very straightforward:

Math nodes to generate desired equation

An Value node allows you to set T. The math is built up one node at a time from left to right. It takes 8 math nodes, set to various math functions, to build up the full equation but it is the one you specified as you can see by following the titles of the panels.

The bit that differs depending on whether you want this for geometry nodes or shader nodes consists of how you generate the values for X and what you do with the result.

I have left out the 'what to do with it'; but on the far left I've shown how to generate the X values using a gradient texture in the a shader. The gradient will generate the values from 0 - 1 based on the texture coordinate. That feeds a mapping node which converts the value, in this case, from $-\pi$ to $\pi$ because the math trig nodes what their input in radians and I picked the range arbitarily.

One way to produce the X values in Geometry nodes is to use a Points node to drive a Set Position Node and to do math to calculate the position. If you need that I can add such an example.

$\endgroup$
2
  • $\begingroup$ Is X a range of -Pi to Pi? I'm trying to understand the range thing. $\endgroup$ Mar 11, 2022 at 2:03
  • 1
    $\begingroup$ Yes. The gradient returns a range from 0 to 1 but the mapping node converts that range to -pi to pi $\endgroup$ Mar 11, 2022 at 14:44
1
$\begingroup$

enter image description here Here's the way with Animation Nodes:

  1. create a mesh,no matter what it is.
  2. go to AN,set the node the same as the picture.You can set the start/end/steps as you want.
  3. only one time setting, and then you can generate any lines you want just by input the formular.
  4. when generating,keep the Auto Execution on,when you finish the input of formular,turn it off.
  5. enter edit mode,select all points, merge them by distance,then you can get a perfect line.

enter image description here

enter image description here

$\endgroup$
2
  • $\begingroup$ That's a really helpful feature. Wasn't aware that existed. However, I do need it via nodes. $\endgroup$ Mar 11, 2022 at 1:22
  • $\begingroup$ Reason I need nodes is I need to also recreate this in another app which is very rudimentary when it comes to this. No special helpers like wave texture, etc. $\endgroup$ Mar 11, 2022 at 1:27

You must log in to answer this question.

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