[Update] Projecting decals to EditableMesh!

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

175 Likes

This topic was automatically opened after 10 minutes.

This is amazing! This opens up so many possibilities for environment design and texture editing in-studio. Thank you so much for this

15 Likes

wow thats pretty cool thanks for this awesome update!

13 Likes

Amazing feature but just noticed the preview code shows localBrushConfig being created for the new method but isn’t used.
It’s instead replaced with self.brushConfig.
Is this intentional?

Edit: Also just noticed self.brushStamp has no reference

16 Likes

you are quick!
replace self.brushConfig with localBrushConfig and you will be golden!

23 Likes

Thanks! Great ideas are being implemented here.

15 Likes

Yippeeeee! This is going to make paintball and zombie shooter games and whatnot so fun.

There’s also the potential for bakes lighting or using it to artistically stylize a game in a way if you use it just right.

17 Likes

Will this work with transparency? Being able to make a Decal Projection System like the Source Engine Decal Projection System would be really nice.

15 Likes

This is awesome! Any chance projection tech will be built into regular Decal / Texture instances without needing a EditableMesh workaround?

18 Likes

We do support different alpha blending type!

You can learn more about here by playing around with AlphaBlendType!

12 Likes

I’m referring to the black parts in the examples shown. Can the black be turned transparent?

8 Likes

i think it somehow allows creating more realistic dynamic fluid surfaces

7 Likes

Oh that just the base texture of the tshirt i used.
It can be anything you want, even another editableimage!

11 Likes

Thank you for clearing that up, that’s very powerful then!

7 Likes

I wish this is possible for select hats! I really want to make custom textures for hats I own.

7 Likes

Hiya,

We are looking into using these APIs, and wondering how moderation would work.
We know that roblox moderates anything the user creates with it, but if anything slips through then who would be liable in this regard? Would you expect the game to moderate the assets themselves too?

EDIT:
Is there a way to also currently ‘upload’ an editable image so it can be passed through moderation? I don’t seem to be able to find a method to do this

8 Likes

Adding onto this, we should really have moderation support as a whole from Roblox on user-creater EditableImages and EditableMeshes.

I know it hasn’t got the best track record but it would be nice to have Roblox handle abuse reports on selected objects, as its one less thing we need to worry about.

8 Likes

This is a horrible idea :sob:
moderation after this is gonna be crazy

6 Likes

I mean, hey, it IS better than nothing at all. Just like how moderated chat is better than no chat at all.

8 Likes