Voronoi Edges Explained Part 2
Вставка
- Опубліковано 29 сер 2024
- If you already understand the basic voronoi algorithm you can start here. Part one explains why I dont use fract(). Otherwise feel free to check out part 1: • Voronoi Edges Explained
In this video:
More vector diagrams and code for the voronoi edges algorithm. I discuss other versions you might find and explain why although they might seem different on the surface, algebraicly they are the same. Then I walk through the process of creating the artwork I show in the thumbnail.
In the introductory video:
I do vector diagrams and show the code for a version of the basic voronoi algorithm that doesn't use the fract function. This isn't strictly nessessary for the voronoi edges algorithm. I chose to show this version because it might help people see the math better.
Here is the final code for this project running live on shadertoy:
www.shadertoy....
Resources:
Inigo Quilez's origional article on the algorithm
iquilezles.org...
tomkh's shader which also has links to a diagram he wrote that helped it make sense for me
www.shadertoy....
Shane's Rounded border shader inspired the lighting/art style:
www.shadertoy....
Resource on the smooth minumum function:
• Function Smoothing Exp...
floating point image was by Stannered from wikipedia commons:
commons.wikime...
it's about half a year since last playing with voronoi, One of my favourite things to do is normalise the values from centre of cell to edge, I do this by dividing dist of closest point by dist of second closest. I also like to normalise the normal map or slope and multiply that my my norm dist. this gives me a perfect polar uv map of each cell. doing this before or after smooth function makes a difference. really nice tutorial
Excellent idea. Another commenter also asked about normalizing cells so I'll point them to this comment!
Quick note. 16:00 The true colour of the apple is not white. That is instead the colour of the light itself. Unless you have a metallic surface, Specular reflections are in most cases the colour of the light. The reason is weird and quantum mechanical and has to do with the fact that metals are conductors but apples aren't.
Edit: Also. As a suggestion for a future video, I have always wanted to know how one would get a normalized voronoi texture such that the central point of the cell has a value of 0, And the edge of the cell has a value of 1.
Thanks for your comment. Yes I meant to say the color that we see is white so if I said the apple's color that was a mistake. Very good point about metallic surfaces being conductors also. Interesting question about normalized voronoi cell values. Off the top of my head I can only imagine that for every cell you would have to run a separate calculation comparing distances from each edge to the center of the cell, store the longest distance and use that to find a normalized distance. I'm not sure if this is even the way it would be done though.
Also you can find the comment by truefiasco2637 on this video who described the method they use for normalization!
This is very nice, thank you! ❤
Glad you enjoyed!
really good video
I'm glad to hear it!
hey, i was curious what would happen if we used a tan function insead of sin function...
Good question. If you look at the graph for the tan(angle) function you'll see that as the angle moves towards pi/2 (+ any multple of 2pi) tan(angle) goes to towards infinity. Although it's undefined at exactly the above angles. This is because internally tan(a) is actually sin(a)/cos(a) so as the angle moves towards pi/2 etc it causes division by very small numbers and then 0. After this though the function comes back in from negative infinity. To answer your question I imagine it would mean the "points" or cells would quickly move out of view but also come back into view. (I cheated and tried this out myself). It actually makes for an interesting effect!
Goated video great work! Any good places on where to start learning to animate with python?? This looks like a lot of fun!
I'm glad to hear you enjoyed the video. I've only used GLSL to make these sorts of animations and thebookofshaders would be a good start. I'm not sure about python.
I would explore using software like TouchDesigner, that uses Vulkan as a render engine but allows you to program variables using python.
@@truefiasco2637 Hey I saw this reply in my feed but then couldn't find it until now. Yes I have played around with touch designer a bit already but this is a great suggestion. Especially since the shader used in my upcoming video would lend itself well to art installations. I mention that in the video but I didn't have time to get the effect running in touch. I'll keep this idea in mind for the future!