I’ve been tying all day and I just didnt found a way to do this, so let me explain.
I’m doing a triangle terrain plugin and I need a custom heightmap option, which will generate (by setting how big the map is) the terrain.
I’m stuck here so currently I have: the image size (x,y), the image string, but not a way to see a pixel’s color and place a part based to that color
I upload this on the plugin, then the plugin needs to generate some points (distanced by a value) where the triangle needs to connect. So it scans every (some value) pixels and places a part.
What I’ve tried so far?
Still this couldnt help, but if that may work tell me!
Any help is appreciated!
After you made that you’re able to edit that mesh? But still part size limits dont permit the thing I want to achieve. I just need to find a pixel’s color, and then I’m done
You can use AssetService:CreateEditableImageAsync(Image_ID), from there you can use EditableImage:ReadPixels() to get the color of the pixels at certain location
Thank you so much!
(for who is interested here’s the function)
local imageFile = game:GetService("StudioService"):PromptImportFile({"jpg","png"})
local imageID = imageFile:GetTemporaryId()
local editableImage = AssetService:CreateEditableImageAsync(imageID)
local function GetPixel(x, y)
local Pixel = editableImage:ReadPixels(Vector2.new(x,y),Vector2.new(1,1))
local height = Pixel[3]*HeightMultipler
return height
end