#Help me fix my vorobroken

44 messages · Page 1 of 1 (latest)

crude kayak
#

Sry, I'm trying to understand what's wrong with my voronoi, I managed to narrow it down and I'm quite sure it's a stupid error somewhere. The issue lies somewhere in how I get points distance.
For each pixel I wish to have the position of the first and second closest points in the point cloud. Any other math comes from there.
The code is entirely C++ since I'm using cuda. My "vecNT" classes are similar to GLSL vec2, vec3, uvec2, uvec3 etcc
All the relevant math is done in this class

#

If I remove the randomization, it's always the bottom-right quarter of a point that's wrong, and I'm not understanding how/why

#

randomized

#

unrandomized

odd anchor
#

For my voronoi it didnt take nearly that much code

#

you can start by returning a sqrt value if your recieving end isnt already doing that

#

and if its 3D voronoi noise, i recommend having a starting distance of a large number

#

and if you need, i can send some code, its your choice on what type of code i send, one that makes sense and is in python, c++ or the hellish attempt on scratch

ebon juniper
# crude kayak

ah I see, the randomized points are centered on the corner of the tile
so you need to subtract 0.5 to it so that its centered on the tile

#

or actually you can just make your random offset be in the range [0, 1] instead of [-0.5, 0.5], same thing

crude kayak
#

but logically is the reasoning right? look at the points in the nearby "regions" and take the 2 closest?

odd anchor
odd anchor
#

But you just want to take the closest 1 point

#

Actually, I can just use pseudo code or smth

#

That's easier to do rn

crude kayak
#

and to know that I need the distance from the 2nd closest point, don't i?

odd anchor
#

I'm so confused on what you're trying to do...

crude kayak
#

for a given pixel know how far it is from the center of its cell and the edge

odd anchor
#

My voronoi noise is a grid of points which are translated by random numbers and then the distance is calculated between the nearest 27 points

crude kayak
#

i'm just taking the 2nd closest too because I can't know the edge distance without it

odd anchor
#

I'm just confused by what you mean edge

crude kayak
#

i want orange and yellow, not just yellow
just realized my math for orange was wrong regardless

odd anchor
#

I feel like the edge is calculated by the average of those 2 points

#

Not the sample

#

But you can always have a random value corresponding to the closest point

crude kayak
#

the edge calculation is a "later" issue

odd anchor
#

Alright

#

Well, I have a grid of pixels let's say

#

And scale it to 0.01 or so to see the noise

#

Then I simply repeat for x, y, z values 3 times each

#

Based on the floor of the sample point

crude kayak
#

That's my
repeat_distance * (utils::math::floor(position / repeat_distance), where repeat_distance is your 0.01 and position is the sample point

odd anchor
#

Repeat distance?

crude kayak
#

the base distance of the points from each other (without randomization)

odd anchor
#

Hm

crude kayak
#

ok found out what was wrong: I assumed that the 2nd closest point must be within a 3x3 grid around the sample point. However in some cases it isn't.
Here the sampel point's (cyan) closest point is blue and second closest point (which i used to calculate distance from edge) isn't within a 3x3 grid

#

so... is there any better way to find the % of the sample point between cell center and edge?

#

cause scaled to 3 dimensions this goes from 3*3*3 checks to (3*3*3 /*core*/) + ((3*3 /*face "bulge"*/) * 6 /*faces*/)