Hello Creators,
We are excited to announce a new API – DrawImageProjected
– that allows you to add decals and images to assets, including avatar bodies. This is the next step for our EditableMesh
and EditableImage
APIs, expanding the creative possibilities for in-experience creation.
New DrawImageProjected
API
The new DrawImageProjected
API acts very similarly to the existing EditableImage:DrawImage
API, but now it properly projects the drawn image if the EditableImage
instance is being used with a MeshPart
.
The following image shows a side-by-side comparison of the new DrawImageProjected
API on the left and the existing DrawImage
on the right.
Left star drawn using DrawImageProjected
API. Right star drawn using DrawImage
API
DrawImageProjected
allows the entire target image to be nicely painted onto the shirt, taking into account the seams and edges of the shirt. Drawing an image directly onto the texture does not account for those same seams and edges. You can see this more clearly when looking at the resulting texture after drawing the stars on both sides of the shirt below.
The following code snippet shows a simple example of using the new DrawImageProjected
API. It first sets up ProjectionParams
and a BrushConfig
that are then passed into the DrawImageProjected
API
local editableImage: EditableImage = nil -- The result for this projection
local decalImage: EditableImage = nil -- The decal for projection
local targetMesh: EditableMesh = nil -- This will be the mesh you want to project to
local relativePos = meshPart.CFrame:PointToWorldSpace(raycastHitPos)
local direction = (game.Workspace.CurrentCamera.CFrame.Position - relativePos).Unit
local projectionParams: ProjectionParams = {
Direction = meshPart.CFrame:VectorToObjectSpace(direction),
Position = meshPart.CFrame:PointToObjectSpace(relativePos),
Size = Vector3.new(1, 1, 1),
Up = meshPart.CFrame:VectorToObjectSpace(Vector3.new(0, 1, 0)),
}
local localBrushConfig: BrushConfig = {
Decal = decalImage,
ColorBlendType = Enum.ImageCombineType.BlendSourceOver,
AlphaBlendType = Enum.ImageAlphaType.Default,
BlendIntensity = 1,
FadeAngle = 90.0
}
editableImage:DrawImageProjected(targetMesh, projectionParams, localBrushConfig)
Find more information about the Mesh & Image APIs and what’s next for the tooling in our recent Client Beta DevForum post.
Please let us know in the comments if you have any questions or concerns. We can’t wait to see what you create!
Thanks,
@TheBabananaMilk @L3Norm, @TheGamer101, @ContextLost, @FarazTheGreat, @syntezoid, @portenio, @FGmm_r2, @timetopretend8, @LowDiscrepancy, @neutrinostack