- Home /
How should I generate an image of a model?
I'm making a loot-hunting rpg. I have models for every item in the game. In the GUI, I want icons to show images of those item models. I'd like to generate images of the models at runtime for this (item appearances are modifiable in-game).
I could just instantiate the actual 3D models and position them on their icons, but while that may have better aesthetic potential, it'd be quite an unnecessary performance hit, so I'd prefer to actually render them to an image asset instead.
I googled but didn't find much. Any ideas? I have absolutely no clue how to go about doing this..
Yeah, basically taking a screenshot of just a model, nothing else, and saving it as an image asset.
Here's the screener page. $$anonymous$$aybe you can do something with that, using a <1 supersize factor. Really though you are probably going to want to learn how to generate a procedural texture and save it.
$$anonymous$$aybe a second camera could line up with the model's bounding box and take the screener, cropping at a certain radius/distance (Basically combine the screener with a mask and save it off on to a fresh canvas).
What is the rough poly count on your models that you wish to display?
I'll look further into that capturescreenshot function, but that doesnt look like something I can use.
Poly count is currently undecided, there's no final assets in the game yet so we can still decide on lower poly counts before our modellers make anything, but I figure, in general, if I can replace model rendering with image rendering, it'd allow for higher polycounts elsewhere. It's just an unnecessary performance hit regardless of polycount. I mean these aren't gonna be N64 looking models or anything, definitely higher than that, it should look fairly modern.
All I know is that the gui alone could have up to ~48 item icons rendering on screen at a time.
Answer by Kittymonkey · Jan 14, 2016 at 10:36 AM
1: create a render texture 2: insert the model and a cam to the scene, and apply the render textures to the cam 3: repeat this over and over again until you have all the needed render textures and use them.
hint: using this way, it is possible to apply scripts to the models to make them rotate or such.