David Roberson |
I'm not entirely sure what I've done with this script. I was trying for a script that would do distance mapping of an arbitrary shape, using the function I created for my Spherical Worley Noise. The problem is, it doesn't respond to a binary mask at all. What I got instead was a kind of split distance mapping of the bevel of an arbitrary shape. Whimsically, I turned that into a little heart scrippet, but I'm really curious about how I got the result I did. Here's the code:
Distance Heart Scrippet.ffxml |
|||
Posted: January 18, 2021 10:27 pm | ||||
David Roberson |
I suppose the question I should be asking is, how do you reference the x and y components of a sampled image. In the example above, I stuck v in for x and y on a whim and was surprised to get any kind of result. I had tried doing vx, vy = get_sample_grayscale(x, y, Source) but got an error saying dy was a nil value when I provided vy in my function call with vx. I can't recall another script I've seen that features a reference to the x and y from a sample image.
|
|||
Posted: January 18, 2021 10:59 pm | ||||
Indigo Ray
![]() |
David, I also have trouble with scripting in FF, but don't you need to specify a step size for your loops?
The function get sample iterates over x and y (pixels) When you call get_sample_grayscale(x, y, SOURCE) it gives you the brightness at each sample point - there's only one output You can input something other than "x" and "y" to do a transformation Distance Transform is iterative a.k.a. slow. See our efforts here. But these were not scripting methods. |
|||
Posted: January 19, 2021 7:40 pm | ||||
David Roberson |
Indigo, I modeled my script after the API Worley Noise script, so my loops follow its example. I didn't really think about step size, and wonder if you have an example where it is used properly I could see?
Good point about how get_sample iterates over an image. Unfortunately, most examples of distance mapping I've seen (in various scripting languages) iterate over x and y per pixel (which I do) and have access to the x and y coordinates you sample the distance from. I'm not sure I'm getting that part entirely right. I'm still learning about transformations in Lua, so I don't quite know what you mean in your fourth point. Can you elaborate? Thanks for the link! I'll check it out! |
|||
Posted: January 20, 2021 6:05 pm | ||||
David Roberson |
Just to clarify my objectives in this script, I am trying to map distance from the current x,y in my nested loop and the closest pixel of value 1. I'm getting distance from both 0 and 1 with distance mapping in between, centered around the 0.5 value. I'm clearly not identifying those white pixels (or sample points) in an effective way. So, yes, I am getting distance mapping, but in a useless context of an existing bevel.
Please tell me someone gets what I'm obviously missing here? |
|||
Posted: January 20, 2021 7:11 pm | ||||
David Roberson |
Okay, looking at it again, the problem I am running into is tied to the get_sample_grayscale() part, which gives me the value (brightness) of the current sample, but my distance calculations are designed to compare the position of the current sample and the nearest "brightest" point. Without a way of getting the coordinates for that I'm not providing the equation what it needs. Worley noise was working inside a cell grid in some way I'm not understanding very well, but which was defined in x and y coordinates.
I still can't figure out how I get the results I'm getting from a bevel, but I'm guessing it's the result of feeding a value between 0 and 1 as if that was a coordinate. I really wish there were more documentation for Lua graphics scripting. I may eventually sort this out, but it's not going to be easy. |
|||
Posted: January 20, 2021 8:06 pm |
Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!
33,712 Registered Users
+19 new in 30 days!
153,537 Posts
+6 new in 7 days!
15,348 Topics
+72 new in year!
171 unregistered users.