ThreeDee
![]() |
||||
Posted: May 27, 2014 7:29 am | ||||
Skybase
![]() |
Can you explain the magic in pseudo code?
|
|||
Posted: May 27, 2014 8:02 am | ||||
ThreeDee
![]() |
Sure. (Actually, I'll just explain it in English.)
I start with a straight square grid, the white points are initially on the crossing points. The x- and y-offsets of the white points of the grid are derived fr om perlin noise values, but they still remain within their own squares, ie. no point can go past another one vertically or horizontally. Then I draw the connecting lines, and alternating diagonal connecting lines (every other line is flipped). The clearest explanation would be this image wh ere I turned the perlin contrast down: ![]() |
|||
Posted: May 27, 2014 9:19 am | ||||
ThreeDee
![]() |
||||
Posted: May 27, 2014 9:25 am | ||||
ThreeDee
![]() |
Once I get the check-whether-a-point-is-inside-a-triangle part of the code working, I can get rid of the overlaps and start doing various fills between the lines.
|
|||
Posted: May 27, 2014 9:27 am | ||||
Crapadilla
![]() |
http://totologic.blogspot.fr/2014/01/...-test.html Would this be of any help? I've used the barycentric method for a custom "Free Triangle" component. Worked like a charm. ![]() --- Crapadilla says: "Damn you, stupid redundant feature requests!" ;) |
|||
Posted: May 27, 2014 4:39 pm | ||||
ThreeDee
![]() |
Hi Crapadilla,
Thanks. Yes, that's the method I'm using. For some reason didn't get it to work properly yet, probably just something simple I've missed. TD |
|||
Posted: May 27, 2014 4:57 pm | ||||
ThreeDee
![]() |
||||
Posted: May 28, 2014 8:51 am | ||||
ThreeDee
![]() |
||||
Posted: May 28, 2014 9:42 am | ||||
ThreeDee
![]() |
Tempted to do this with a table instead. Would give more freedom in placing the points. Probably be way faster too, especially when the point count is relatively low.
|
|||
Posted: May 28, 2014 10:11 am | ||||
ThreeDee
![]() |
||||
Posted: May 28, 2014 3:48 pm | ||||
ThreeDee
![]() |
One significant advantage in keeping the dots constrained inside their respective grid "cells" is that you know exactly what dot is in which area and don't have to iterate through all dots to find the closest one to a given point. This makes rendering pretty efficient. So far, at least.
|
|||
Posted: May 28, 2014 3:53 pm | ||||
Crapadilla
![]() |
Nice! Barycentric gradient shading in the works? ![]() --- Crapadilla says: "Damn you, stupid redundant feature requests!" ;) |
|||
Posted: May 29, 2014 4:18 am | ||||
ThreeDee
![]() |
Naturally ![]() |
|||
Posted: May 29, 2014 4:38 am | ||||
ThreeDee
![]() |
Speaking of "naturally", I just realized that the direction in which the rectangular shapes should be divided should be based on the Delaunay method, ie. splitting the rectangle into two triangles by cutting it between those two opposite corners the angles of which total more than 180 degrees. Naturally.
Resulting in a sort of semi-Delaunay triangulation. |
|||
Posted: May 29, 2014 4:44 am | ||||
Crapadilla
![]() |
To avoid those very long/thin triangles, I gather?
--- Crapadilla says: "Damn you, stupid redundant feature requests!" ;) |
|||
Posted: May 29, 2014 4:49 am | ||||
ThreeDee
![]() |
Come to think of it, the current version (before splitting the rectangles into triangles) is already a good basis for a new noise type of "Rectangulation". With suitable shading, it would be a new basic noise type that is different from the built-in noises.
|
|||
Posted: May 29, 2014 4:52 am | ||||
ThreeDee
![]() |
Well, the method pretty much already takes care of that, since no point moves outside its own square domain, but essentially yes, it would always be the "fatter" triangulation of the two options. Also, the Delaunay condition ensures that no concave rectangles are split in the wrong direction -- the wrong direction results in lines outside the shape rather than two triangles, like those that can be seen in my first image. ![]() |
|||
Posted: May 29, 2014 5:01 am | ||||
CFandM
![]() |
Looking very, very interesting...
![]() ![]() Stupid things happen to computers for stupid reasons at stupid times! |
|||
Posted: May 29, 2014 2:22 pm | ||||
Sphinx.
![]() |
||||
Posted: June 3, 2014 4:32 am |
Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!
33,711 Registered Users
+18 new in 30 days!
153,533 Posts
+38 new in 30 days!
15,348 Topics
+73 new in year!
34 unregistered users.