Copy link to clipboard
Copied
Hello, for now I am creating the tiny veins (or you can deem it as the smallest venation level of leaf) of the Japanese Maple by using the FX-Map node. The reason I choose this node instead of the general Voronoi node and cells node is that I am not satisfied with the result generated by them.
Based on my observation of the actual leaf of Japanese Maple, I discovered that its tiny veins look like the combination of the “Y” shape. One “Y” ‘s middle branch connects to another “Y” ’s left or right branch and repeat this process until a net structure is formed.
For now, I come up with two ideas to achieve this effect. I attached images bellow to illustrate them. The basic logic of the first one is that I separate the “Y” shape into 3 branches and only focus on generating branches on one side at first and set some conditions to generate another side later. The problem is that I must set a counter variable for each “Y” shape ‘s connecting point to judge whether the number of lines connecting to each point is less than 3. However, I did not find any way to dynamically generate and set variables.
Another one is to generate three branches from the center in the first loop. After that, two branches are generated from the end points of each branch generated in the first step. Rest is just repeat the second step. However, the problem is the same, I need to set variables dynamically for each new end points in each loop.
I hope I can receive assistance from someone because I have already worked on it for a relatively long time and don’t want to give up.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hello officer,
Thanks for your reply.
Here are some questions towards your solution:
1. How to use the pixel processor to calculate the end position?
Based on my understanding, the function wrote in the function graph of pixel processor node takes effect on all pixels of an image. The $pos variable will get all pixels' coordinates invloving both what I need and what I don't need. I came up with an idea like check whether the pixels' color are white. If that is true, those coordiantes will be kept. However, pixels between the start positon and the end position are still what I don't need. Didn't find any ways to seperate them yet.
2. How to use the FX-Map to draw a line?
I guess the logic behind your way to draw a line is similar to drawing a line on a canvas using JAVA, Python or other languages. For example, set two coordiantes in advance and then call the draw() function. It is reasonable and make more sense. However, I am new to FX-Map and the only way I find to draw a line is to use a narrow square, which is also a shared solution mentioned in many tutorials on youtube. Beside that, I didn't find any other ways to do so.
Copy link to clipboard
Copied
Hello!
1
Your understanding is correct. You need a Pixel Processor that generates an arbitrary starting point, then a series of Pixel Processors that generate 2 points for every point in the input.
This is much easier if you create a function that converts a pixel position to a pixel index (I.e. the number of the pixel if we were to count them from left to right and top to bottom) and another function that makes the reverse operation (index to position).
Then you can check at which index you are currently at based on $pos, check a specific pixel index in the input, and compute the output color accordingly. If the pixel in the input is black, output black.
Input
Output
2
The most straightforward way to draw a line in an FX-Map is indeed to draw a narrow rectangle. For placing the lines, you need to take into account the following:
Use an Iterate node to go through each pixel in the Pixel Processor's output one by one to add lines.
Compute everything you need in the Color/Luminosity parameter function of the Quadrant node, to ensure it is computed first. Use the $number variable to know which iteration you are at, which tells you which pixel index you should use in the Pixel Prcocessor output. Then store the results of your computations in variables that you use to set the values of Pattern Offset, Pattern Size and Pattern Rotation.
Again, this is a complex project. I hope it provides a valuable opportunity to learn about these two very powerful nodes!
Best regards.