Introducing in-experience Mesh & Image APIs [Studio Beta]

those are very nice new changes, but if this already can happen then you should make meshes union-able as well then (csg)

4 Likes

I tried making my own lighting system. But I didnā€™t think it would look this good. This update is definitely a game changer. Iā€™m afraid to imagine what will happen if they complete this update.

MeshCustomLighting.rbxl (59,8 ŠšŠ‘)

22 Likes

A nicer Raycast API here would be nice (or rather integration with the existing Raycast interface). The one provided kind of breaks down if you have multiple EditableMeshes, and you arenā€™t certain which is going to be hit first.

2 Likes

I am wondering how itā€™s getting the reflection, unless youā€™re just talking about the texture with options

if itā€™s all write pixels then itā€™s very cool

2 Likes

I use Raycast for every pixel then i get the color of the instance that the Raycast hits and just set the pixel color to color of the Instance. I also use Multithreading to make it even faster. After raycasting and getting Colors for all pixels, i just use the WritePixel() function on EditableImage.
I donā€™t use raycasts to check for shadows because it would be laggier but that would make it look even better.

2 Likes

I am developing a plugin that makes use of this API, but no images display in studio because they are only shown during runtime. Is this going to change in the future?

3 Likes

I am making my own Grass System, and i need to say, it looks really good. (On the left side is mine, on the right itā€™s roblox)


It will have pseudo collision with players but right now i am focusing on Random Generation.

15 Likes

Is this a bug? I made a 2 triangles at the base of the EditableMesh, but when you view it at the bottom you can see it, but there is a face down there. Also why is the shading weird?

https://gyazo.com/def72de294937c6543eabd04bef8587e.mp4

Code

local EM = Instance.new("EditableMesh",workspace.MeshPart)


local v1 = EM:AddVertex(Vector3.new(0,0,0))
local v2 = EM:AddVertex(Vector3.new(0,0,1))
local v3 = EM:AddVertex(Vector3.new(1,0,0))
local v4 = EM:AddVertex(Vector3.new(1,0,1))

local v5 = EM:AddVertex(Vector3.new(0,-1,0))
local v6 = EM:AddVertex(Vector3.new(0,-1,1))
local v7 = EM:AddVertex(Vector3.new(1,-1,0))
local v8 = EM:AddVertex(Vector3.new(1,-1,1))

local t1 = EM:AddTriangle(v1,v2,v3)
local t2 = EM:AddTriangle(v4,v3,v2)

local t3 = EM:AddTriangle(v5,v6,v7)
local t4 = EM:AddTriangle(v8,v7,v6)

local t5 = EM:AddTriangle(v1,v5,v6)
local t6 = EM:AddTriangle(v1,v6,v2)

local t5 = EM:AddTriangle(v1,v3,v7)
local t6 = EM:AddTriangle(v1,v7,v5)

local t7 = EM:AddTriangle(v3,v4,v8)
local t8 = EM:AddTriangle(v3,v8,v7)

local t9 = EM:AddTriangle(v2,v6,v8)
local t10 = EM:AddTriangle(v2,v8,v4)

local verticies = EM:GetVertices()

for i,v in pairs(verticies) do
	local Attach = Instance.new("Attachment", workspace.MeshPart)
	Attach.Name = "v"..i
	Attach.CFrame = CFrame.new(EM:GetPosition(v))
	
	Attach:GetPropertyChangedSignal("CFrame"):Connect(function() 
		EM:SetPosition(v, Attach.CFrame.Position)
	end)
end

Iā€™m concerned about this paragraph as well, admittedly for probably-worse reasons. If it applies retroactively to decals and stuff, thatā€™s going to be a huge issue for me - several of the most ā€œiconicā€ NPC faces in my games are free decals from like 2010 that are owned by people who also quit the platform before any such permission systems were in place (put another way, when the standard was assuming everyone could use anything). Even if I have permission from these people, I have no way to contact them to ensure they press the ā€œyes, Alex can use this decalā€ button or what-have- you. I really hope it doesnā€™t apply to existing instances that use these asset types.

Also, will the image ones include colour filtering and whatnot? I have several use cases for monochrome versions of a texture, that being to then recolour it using decal/specialmesh/etc properties and whatnot without it being biased towards the imageā€™s original colour.

1 Like

gif/png renderer, using bad apple as example

3 Likes

Iā€™m trying to create an EditableMesh which duplicates the triangles of a specified region (projection) to then overlay an image over the top.

Iā€™m trying to get adjacent triangles to a specified triangleId and itā€™s just returning all of them as 0,0,0

image

Any ideas?

Seriously, I need this. I use meshparts for my terrain for a number of reasons.

Being able to generate (and paint) grass on something like the above would be next level!

6 Likes

Interesting, very interesting.

Another thing I noticed. If you create a meshpart and then an editablemesh, culling for it seems to be as expected. If you then destroy the editablemesh, and readd a new one, the culling behavior seems to change and the whole mesh will be culled when the meshpart itself (which might be smaller than the mesh) leaves the screen.

1 Like

Roblox needs to support a vast amounts of device configurations, i wouldnā€™t hold your breath for gpu support.

This is such an incredible update!


18 Likes

Lord have mercy, I like this when I upload something. Having to use the same mesh to limit lag.

1 Like

What in the world. How do you get that menu like your in blender? Do you just put that in a script then it will appear?

1 Like

Hello!
Is this the most efficient way to do this?

Iā€™ve love to be able to dump the contents of a mesh with less API calls than this, the overhead is brutal.


		local editableMesh = game.AssetService:CreateEditableMeshFromPartAsync(meshPart)
		local res = editableMesh:GetTriangles()
				
		for key,value in res do
			local startTimeTris = tick()
			local a,b,c = editableMesh:GetTriangleVertices(value)

			local tri = {}
		
			tri.a = editableMesh:GetPosition(a)
			tri.b = editableMesh:GetPosition(b)
			tri.c = editableMesh:GetPosition(c)
			
			tri.na = editableMesh:GetVertexNormal(a)
			tri.nb = editableMesh:GetVertexNormal(b)
			tri.nc = editableMesh:GetVertexNormal(c)

			table.insert(cachedMeshRec.sourceTris, tri)
		end
		editableMesh:Destroy()

A 6000 triangle mesh extracted this way is over 36,000 api callsā€¦
(and it just gets worse if I needed color, alpha and uvsā€¦)

I donā€™t mind storing my own representation of meshes for my mesh operations, but getting the initial data is very slow.

Maybe we can get an :UnpackData() method that just returns us a beautiful fat structure?

11 Likes

This is so much more performant than the old wedge approach itā€™s actually kind of ridiculous. You guys have no idea what youā€™ve just enabled. This is going to be awesome.