#UV mapping issue, recreating shadertoy

9 messages · Page 1 of 1 (latest)

worthy roost
#

Show the entire script please

#

the portion where you instance the part

#

too

livid peak
#

Yes gimme a sec

#
function pallete(t)
    local a = Vector3.new(.5, .5, .5)
    local b = Vector3.new(.5, .5, .5)
    local c = Vector3.new(math.cos(1), math.cos(1), math.cos(1))
    local d = Vector3.new(math.cos(.263), math.cos(.416), math.cos(.557))
    
    return a + b * math.cos(6.28318) * (c * math.cos(t) + d)
end

for x = 0, XY_SIZE.X, INCREMENT do
    for y = 0, XY_SIZE.Y, INCREMENT do
        local fragCoord = Vector2.new(x * CENTER.Size.X, y * CENTER.Size.X)
        local UV = (fragCoord * 2 - VIEWFRAME_SIZE) / VIEWFRAME_SIZE.Y

        local clampedUV = Vector2.new(math.max(UV.X, 0), math.max(UV.Y, 0))
        
        local d = length(UV)
        d = math.sin(d * 8.)/8. -- math.sin(d*8.)/8.
        d = math.abs(d)
        d = math.clamp(.02 / d, 0, 1)

        local NEW_PIXEL = CENTER:Clone()
        NEW_PIXEL.Parent = script.Parent.Changeable
        NEW_PIXEL.Position = Vector3.new(START_POSITION.X + (x * CENTER.Size.X), START_POSITION.Y, START_POSITION.Z + (y * CENTER.Size.Z))
        NEW_PIXEL.Color = Color3.new(pallete(d).X - .5, pallete(d).Y - .5, pallete(d).Z - .5)
        NEW_PIXEL.Name = x .. ' ' .. y

        table.insert(PIXEL_TABLE, NEW_PIXEL)
    end
end
#

@worthy roost ^

worthy roost
#

one second lmao

livid peak
#

No rush

worthy roost
#

okay i am confused aswell, sorry i suck at math