Attempting to make an icon of an asset in-game

Hi, I’m trying to get an icon of a model in-game. I think the best way is to upload it as an asset somehow, then take the asset’s ID and use that to get the thumbnail, giving me an image of the model.

Is there any way to do this currently? I remember years ago you could do this by creating places and using the icon, but now the default icon on newly created places no longer shows what’s actually in-game, and there’s no API to change it from in-game.

Any ideas? I’m looking to avoid any expensive solutions like rendering the model myself or using ViewportFrames.

Please note this needs to happen in-game, automatically. Players will be creating thousands of assets and this needs to happen using Roblox’s APIs. ViewportFrames would cause explosive memory issues as the models can have thousands of parts, which is why I want a lightweight image instead.

edit: I’ve turned this into a feature request: Create custom images/icons in-game

8 Likes

Hello,

ViewportFrames are the best way to do it, but there is a way to do it using Thumbnail Cameras

If you are wanting to do it from a game, I have no other solution

You can also screenshot the icon and resize the dimensions

1 Like

Couldn’t you take a screenshot of the model?

I don’t really understand what you’re trying to do.

Viewport frames. I’ve done it before and gives you more control and detail of the icon.

Please read the full post before replying, as I mention multiple times that ViewportFrames are not an option. They take up tons of memory for my use-case, which is why I just want an icon. Fetching thousands of parts for hundreds of models to insert into each ViewportFrames would take massive bandwidth (fetching all that info through datastores) compared to just an image. It just doesn’t scale well for hundreds of models.

3 Likes

What exactly are you trying to do?

I know that but likely your best bet would to just use viewport frames (it’s all I could think up of atm). I’m on mobile too and battery is low (unable to recharge) so I had to make a quick answer. I have to go now.

I don’t think there’s a Roblox API available, since the removal of generated place thumbnails, that can do this easily. The best way I can think of (that isn’t ViewportFrames) is having a NodeJS bot upload a model with a set ThumbnailCamera to the catalog using data sent through HTTPService, although you’d probably get rate-limited and the data sent over might be huge.

This would work very well for smaller projects but I doubt it could handle thousands of parts per request with many thousands of models.

5 Likes

Thank you for actually reading my post! You might be right, it’s a shame that roblox removed that functionality :frowning:

2 Likes

I’ll see if I can find anything that might help, but I have a strong feeling that it’s close to impossible without the use of ViewportFrames.

Maybe a good feature request for Roblox would be adding a property called “RenderMode” to ViewportFrames, where the two options are Dynamic and Static. When set to Static the image rendered is only rendered once instead of each frame, until a descendant changes.

Or just the ability to generate a temporary image ID from models, without having to keep the model in place memory. (Would be better for your use case, as the problem is memory not framerate.)
Maybe something like: “AssetService:GenerateModelThumbnail(model, [camera]) → String image ID

For any Roblox staff reading this…

9 Likes

Hey,

I read the post already, I just told you it is the best option to do.

Great idea! I just uploaded a feature request here: Create custom images/icons in-game

3 Likes

Awesome! I’d have made it into a feature request or replied to yours if I had the permissions :sweat_smile:. Still stuck with member rank after 2.5 years.

For a temporary solution however, it might be possible to generate the ViewportFrames as they come into view with a small loading animation, maybe in sets of 10. As you scroll down it’d load in more items and remove ones that aren’t visible anymore. This might reduce memory but it’d come at the cost of efficiency, hence the loading animation to let people know the data is being loaded and processed.

1 Like

The best option like you also said is to upload it as an asset. By serializing the model we can get the XML format. Once we have this it’s basically just a matter of uploading it.

When the model has been uploaded, using an api such as https://assetgame.roblox.com/Thumbs/Asset.ashx?width=110&height=110&assetId=1818 would work just fine.

This might be of some help when it comes to serializing, it is a bit outdated but seems to work fine. Just make sure you change this:

if not hmm:find("%[") then props[name] = realTyp(typ) end

to

if (hmm) then
	if not hmm:find("%[") then props[name] = realTyp(typ) end
end

Example:

local m = require(script.MainModule)
print(m.Serialize(workspace.Baseplate))

image

For more information on uploading a model, this endpoint seems ideal.

7 Likes

Wow this is an excellent idea, thank you! I’m a bit of a noob when it comes to website APIs and such, would it be possible to do all of this from in-game? I’m trying to avoid having to set up my own servers as much as possible.

1 Like

Roblox web APIs can’t be used from within the game, hence the NodeJS bot I mentioned before, basically he just explained it better lol.

You’d have to setup a server with a web endpoint (REST or something) to send over the serialised data and make the upload request from there.

The serialization is done purely in-game but you will sadly have to spin up a webserver to handle proxying requests to roblox.

Step by step it could look like this:

  1. Serialize the model into XML
  2. Send a POST request containing that xml to your webserver
  3. Webserver sends another request to the /upload endpoint with the contents
  4. Send the asset id back to the Roblox server

You might also have to take the image Roblox returns and upload a separate decal of that. But only if you are unable to get an asset thumbnail using some sort of in-game api.

2 Likes

Do you mean something like this, i mean you could just make it model and publish it, You just have right click model and press save image as


(the image that right beside the sales is me moving icon with the mouse)

To clarify, are you trying to generate a thumbnail for something that was user-generated at run-time, or are these just static models that exist in the game when you publish it?

This is another fun case of Roblox’s tooling being insufficient for scenarios like this, requiring 3rd party software to accomplish. Even if you do get something like this working, you have to keep in mind there’s a potential risk of being moderated since the auto-generated thumbnails have to be looked over by someone now, and you won’t get an immediate thumbnail as a result.

I do understand the frustration with ViewportFrames and the amount of memory they consume, we’ve struggled with that problem in our game too. Would certainly be nice if we could capture a ViewportFrame into an image once and then free it from memory.

5 Likes

User-generated models at runtime, every minute or so. I want players to be able to cheaply preview a potentially massive asset without having to download it, which is why Thumbnails appear to be the only option.

2 Likes