Generating Images from 3D models or 2D image collages at runtime

I have a modular crafting system where players select icons/images to build their weapons.

Currently the icon for the new weapon is just an icon the user selects from a library of icons.

I’d like the icon to be generated either by somehow taking a screenshot of the 3D composite mesh with all the parts the user has selected, or by combining image of all the weapon parts together and saving that as a new image that would be used as the icon for the new weapon.

This all has to happen during runtime/playtime.

Any ideas?

Greetings Aininia, thank you for posting this question.

I would consider using a ScenecaptureComponent2D for your weapon building blueprint. In the texture target value, I would then create a render target. Then I would right click the render target in the content browser and ‘Create Material’ from it. I will include an image.

In my example, I am using an eight sided die with a ScenecaptureComponent2D aimed at it. This is where you may want your weapon (or something to that effect.) I put a plane there because I needed quick results. I then set the ‘Capture Every Frame’ and Capture Movement’ values to false.

In the content browser, right click the render target you made earlier and create a material for it.
Back in your BP, I used a Create Dynamic Material Instance node and set the material I just made. Then I set the material for the plane.

I hope this helps.

Thanks! I’m assuming this happens inside the viewport of the bp and doesn’t require the player to be in the scene to capture a snapshot.

There may be an issue with overwriting the texture as I see the capture component is set to overwrite and writes only to a specific file.

Hey there Aininia, thank you for the reply.

I would consider creating a new material instance and adding that value to an array.

I hope this helps a bit.