AssetGen - Create a game asset in a single click

add-ons

(Linko) #1

AssetGen is a free addon addon (MIT License) that automates the tasks to get a game assets ready for video games from an High Poly model. While it takes several hours to get an asset ready from an high poly, this addon does that in a matter of few clicks. It is ideal for all your static assets.

== Download AssetGen addon ==

AssetGen (for Blender 2.79 only): https://github.com/Linko-3D/AssetGen
It is developed by Srdan Ignjatovic aka zero025 ([email protected]) and surpervised by Danyl Bekhoucha aka Linko ([email protected]).

Bonus Unity realistic startup scene: https://github.com/Linko-3D/Realistic-Unity-Project
A version with the best looking scene I was able to create in Unity.

== Installation ==

Go to “File > User Preferences…”, open the Add-ons tab at the bottom and click on “Install Add-on from File…”.
Import the whole .zip. In the search bar search for AssetGen and enable it. Don’t forget to click on “Save User Settings”.

== Introduction ==

This addon is very useful for generating all your static meshes. For meshes that have to be deformed like characters you should use your own LP.
Sometimes the addon doesn’t work very well on models with a lot of tiny parts, in which case you must adjust your high poly by keeping the decimation in mind to use the addon. Even if you use your own low poly you can still use this addon to bake the maps and generate your textures. AssetGen provides tools to help you generate your albedo map, everything will be explained here.

Model from the Mobile game character tutorial of Pluralsight with 24.5 millions decimated to 20k tris and generated all the textures in few clicks and minutes:

[ATTACH=CONFIG]506028[/ATTACH]

[ATTACH=CONFIG]506029[/ATTACH]

What AssetGen does for you automatically:

  • you have access to surface details to add micro details on your high poly’s shader, ex. rock effect, wood, etc. The details will be visible on your textures.
  • the addon generates your low poly including all your LODs at the desired polycount. It will try to remove all intersecting meshes to improve the low poly quality and UV’s texels.
  • it will unfold your UVs, it can unfold half or your low poly for symmetrical models. You can set the cage, edge padding, etc. The best settings are set by default.
  • it will bake all your textures, you can choose which texture to bake. The most important ones are enabled by default. You can choose the texture resolution.
  • it will save your texture to allow to continue your work later. It will use the name you have entered for your asset and will add the _LOD# suffix for each.
  • it creates a Blender Render shader and nodes for Blender Cycles and creates the lighting to see what the low poly looks like directly after it is generated.
  • it helps you to create your albedo texture by providing settings to generate a grayscale texture and help you create your gradients. Results are shown directly in the viewport.
  • you can add texture effects like dust deposition and grunge very easily and adjust the amount and color.
  • you have access to a tool called “Export asset” which will export your LODs and reset their locations at the path you have specified. It will also export your albedo, normal and AO map in the same folder or in a subfolder (called “Materials” by default to match Unity).

The addon also provides a set of tools allowing you to make a tileable texture, create the silhouette of a weapon and more.

== How to use it ==

Note: Hovering the mouse on a setting displays a dialog box with an explanation.

Game Asset Generator panel:

Requirement:
You need a high poly mesh.
The script can convert multiple high polys into one low poly, you just have to select all the meshes you want to include in your low poly. Don’t worry your high polys wont be touched, you will keep them separated with their names and modifiers.

Important note: your high polys must be in layer 0 when generating the script. Also the script will delete everything in the layer 1 (this layer is used to display your low poly and to bake the textures).

Texture resolution:
The first setting is the texture resolution, the settings are indicated in a square (1K = 10241024). To work with it, I suggest to use at least a resolution of 2K (20482048). Modern games use this resolution aswell when display their textures.

Selected to active:
Enable this option to use your own low poly. You must select your high poly first and then your low poly (active selection) to use it. If your low poly has no UVs the addon will do use the Smart UVs settings in the advanced settings menu. You can generate a LOD1 and LOD2 from your low poly.

LODs polycount:
Those settings are very important, it is the LODs’ polycount in triangles. The LOD0 is the game asset that will be displayed at a close range from the camera. Each new LOD is the model shown further from the camera. You can keep the other LODs at 0 triangles to not generate them.
You have to test and see how the asset looks with a low texture resolution, if it’s too deformed and black spots appear (it could also be the cage size too low or intersecting in concave shapes) you can increase the polycount. If a lot of details are captured you could try to reduce the polycount and see how it looks to optimize your game. Generating a game asset takes in average 10 seconds with an 1K texture (ideal for tests) and 1 minute in 2K.

Bellow you have access to the Advanced settings and Texture settings. Their default settings should work with most assets.

Advanced settings:
Those options will allow to have more control for baking and textures. By default the settings work on almost all assets.
The settings are:

  • Cage size: this option increase the size of the low poly during the baking to capture every detail. A value too high could generate intersections with concave shapes resulting in black spots.
  • Edge padding: also known as margin, it is the number of pixels that goes above your UV seams. This allow to not reveal (otherwise lines will appear).
  • UV margin: it is the space between the UV islands. If the UVs are too close the edge padding wont be able to extend enough, this could reveal the seams.
  • UV angle: because the addon uses Smart UVs, it allows to define at which angle of the mesh to add a seam. Lower value = more chunks (bad performances), higher value = potential overlapping and lose in texel space.
  • Samples: this value is only used for the Ambient Occlusion, other maps use 1 sample. More sample will remove the noise but will take longer to bake.
  • Create envelop: with this option enabled the script will perform an Union boolean between each meshes by loosing parts, in other words most of your intersecting parts of your low poly should be removed. This will allow to get more triangle for the visible parts of your asset and also to not waste UV space. Caution however, this options doesn’t work on models with a lot of tiny meshes and meshes that doesn’t intersect enough to allow the Union boolean to work correctly.
  • Unfold half: use it if you have a symmetrical asset, this will generate the UVs for half of your texture to double the texel of it. It is particularly good on a mobile game with limited texture resolution.
  • Ground AO: this option will generate ambient occlusion for the grid, it is useful for static assets that lays on the ground in your game.
  • Remove undergound: it will remove the parts under the grid before doing the decimation in order to get more details from the visible parts.

Texture settings:

  • Mask: this option will allow you to later apply the gradient on areas that have the same color baked. You must define the colors with the diffuse color of your model. Use saturated colors and and hue far from one another to make sure that the masks read correctly (two colors close will be interpreted as the same color mask).
  • Albedo: enable this option if you already have a texture on your high poly. It is better to generate it on your low poly, but this can be useful if you had a texture from a 3D scanned object.
  • Normal: the normal is used to capture the details of your high poly. If you don’t want to use it for a mobile game with hand painted texture you should still enable it to generate a curvature map from it.
  • Ambient Occlusion: generates shadows on parts close to each other so it will work on any lighting condition. In a PBR game the ambient occlusion is added separatly in an Ambient Occlusion slot in order to make the AO on the parts that doesn’t receive lighting in the game scene.
  • Curvature: the curvature is a map generated from the normal map (so you need to bake it). It will highlight in white the convex parts (peeks) and darken in black the concave parts. The rest will use a middle grey color. It will be used as a base for your albedo texture. This effect gives a slight hand painted look to your texture. You have two options: width for the width of the lines and blur to remove aliasing.
  • Pointiness: it is a vertex based curvature map that is generated from the geometry. The details of this map will depend on the amount of vetices on your high poly.
  • Bent: this map will look at your faces orientation compared to the world’s scene, this will allow to use effects like dust and snow deposition on your mesh for your albedo.
  • Gradient: this map is used on stylized games and especially on MOBA with characters seen from above. It will generate a ramp with dark values at the bottom and bright at the bottom.
  • Opacity: most game engines can use the alpha of your albedo but if it’s not supported you can use this map. It will show in white the visible parts and in black the fully transparent parts of your asset

(Safetyman) #2

This looks really interesting… I’m going to have to play with this. Thanks.


(AnadinX) #3

Quite intriguing, nice job, will also have a play


(Linko) #4

I hope it will be useful, personally it helped me a lot during game jams. :slight_smile:

In a future update the generated albedo map will be improved a lot. Currently it is only based on the curvature map and you can use optionnally an AO and shadow (normal map’s B channel) for the grayscale. In the update the addon will use a generate smooth curvature map from the normal map and a slightly more detailled curvature map node setup to get the grayscale, then applies the gradient and at the end apply a thickness map for blood as an option. And you will still have the dirt, grunge and snow in post-effects.

Current albedo:


New albedo:


Albedo node setup:


I have posted tutorials on how the maps have been created:
New Curvature node setup: https://blender.stackexchange.com/a/72602/23134
Curvature smooth node setup: https://blender.stackexchange.com/a/100637/23134
Thickness map: https://blender.stackexchange.com/a/100725/23134
Fake hand painted texture (stylized albedo: https://blender.stackexchange.com/a/90153/23134

I have also created a node setup to make a fake hand drawn lines effect (borderlands), we could include it in the addon:
Without curvature smooth: https://i.stack.imgur.com/gUp7W.png
With curvature smooth: https://i.stack.imgur.com/st4xQ.jpg


(abody2100) #5

is bevel shader work with this addon ?


(Linko) #6

Yes it works, the addon will bake a normal map from the node setup you have created. It will also generate a curvature map and a roughness map (inverted curvature) from the bevel and displacement effect.

Remember to set the bevel sample at 16 and to apply an edge split modifier for you high poly hard surface models. The normal map is always baked at 16 samples to capture the details of the bevel effect.

Demo on a cube with another used as boolean to make a crack and the bevel shader. I just clicked on generate asset and used the Dota Rock crafted preset.


I get some lines on the edges, if someone has an idea on how to fix this, tell me. :slight_smile:


(Mutantgenepool) #7

So I’ll just uninstall xNormal huh. That is amazing work. Thank you.


(n3mes1s) #8

Hi, this addon looks incredibly useful. I have a question. You say that it only works with static game assets? what do you mean exactly? if im making a game character, and i have a high poly, cant i just make a low poly version of it? lets say i have the head, arms, etc, separated in different objects, cant i just pick each one, make a low poly and then again join all of em?

With “join” i dont mean, joining vertices, i mean grouping all the meshes in one. Or for example, if im making a robot, that is composed by hard surfaces, mostly, cant this “method” applied to it? it will be like just doing it onto separated meshes.

Keeping in mind, i dont want textures or materials i just want the decimated mesh to be used as baked from the high poly. I also dont want a normal map since imma going to entirely texture and bake on spainter.

Thanks, and i really hope you keep working on this addon. I dont know why this thread doesnt have more feedback.


(urkokul) #9

Good job. Thanks


(carlosan) #10

Amazing work. Thank you.


(paddywwoof) #11

Hi, I had a play with this at last and it seems very good. There were a couple of things that might be covered but I couldn’t figure out:

When the texture folding is set to ON the decimation doesn’t seem to use the symmetry option so the middle UV triangles get squashed resulting in stretched mapping down the X axis.

If I start from a low poly shape and use subdivision surface (simple) to create the high poly model for detailed sculpting then it would be nice to be able to use the low poly shape with the generated UVs and textures (as it’s almost always going to be better than the decimated version)

I will do some more playing around and try to give some more positive feedback.


(aMars) #12

Did you use the default cube with hard edges and generated UVs? If so that won’t bake correctly because it is unwrapped in a cross, with hard edges the faces need to be separate UV islands with padding.


(paddywwoof) #13

I’ve done a bit more experimentation and made a couple of minor mods to the code here https://github.com/paddywwoof/AssetGen/commit/3244e769ffe28b19bf04a4a9343c99b9f1c7deb5
Most are in the GA.py where I tried various ways to get the decimation to work nicely. I think it’s a bit better if I shrinkwrap the LOD0 to the hi-res object. In the end the best way seemed to be to use the ‘Selected to active’ option.
All in all this seems a useful tool


(Linko) #14

Hi,

sorry for not answering I did a (long) pause and we were waiting for Blender 2.8.

paddywwoof: you can uncheck the texture baking, generate your LoD0, fix the vertices then use Selected to Active, it will still generate your LoDs. The new version will have button directly available to not bake the textures.

The shrinkwarp alone won’t fix the vertex overlapping and if we perform a slight smooth before the vertices won’t be aligned on the peaks, I mean if the model has spikes the low poly vertices won’t be aligned to the tipping points and the normal map will look weird (+ we will need to expand the cage even more). Sometimes when you smooth the high poly where you had overlapping vertices on your low poly the decimation fixes it.

n3mes1s: by Static meshes I mean the decimation only keeps your high poly details, it won’t generate edge loops for a rigging and deformations. So if you make characters it is better to make them statues. But you can still try in Mixamo to auto-rig a game character generated with the addon the result could be good enough for a small game jam project.
With hard surface model you can’t decimate too much but it will remove the model triangle on flat surfaces automatically.
You can uncheck all the texture baking options.

For the new addon I am thinking of an uber shader that the addon adds on the high poly. The user will have access to sliders to adjust the amount of Pointiness, AO, Top Lighting, Vertical Gradient and tweak the ColorRamp. The Inverted AO node will be used to add relief and SSS effects. We can include presets of ColorRamp like Grayscale for a base paint but also, rock, metal, etc. It won’t support the metallic and roughness because the node setup will be connected to an emissive node for quick preview and backing.
This means that a single texture will be baked for the Albedo, no compositing and ID Masks will be needed the workflow faster.
In Cycles render mode he will see what the texture looks like in the High Poly, be able to tweak it and once he clicks Generate, he will see the low poly in Eevee with the textures plugged in the Principled shader. He will have the possibility to automatically export the game asset and textures each time the generate game asset is clicked. This will allow to edit the high poly, generate the low poly and textures and see it automatically updated in Eevee and Godot (or other game engine).

The new GUI (still WIP):


(Linko) #15

The node setup for the texturing is complete. A button will add this grayscale node group in your shader to help you texture your asset directly on the high poly. For now you can download the node setup here: https://drive.google.com/file/d/1Jf65FaMZcXqwDIWLGv1euKMCP8xYl9TD/view?usp=sharing

We will probably work on the new addon after the release of the release candidate at the end of the month.


(sirmaxim) #16

I see what you did there and it’s not bad, but… The curvature output could use some more contrast. It would be awesome if you could make it look like handplane baker’s output.

Edit: just noticed you updated the node group since I downloaded it. The Linear output looks closer already, though still some minor differences right at the sharpest edges:


(Linko) #17

Hi.

I have updated the node setup, it should be close to handplane now. The opacity should not be at the maximum though, like recommended by this Dota artist: https://steamcommunity.com/sharedfiles/filedetails/?id=316375622
If you want the same result you must generate the curvature from the normal map with a pixel width of 4 and a slight blur then convert it to Linear with a gamma node at 2.2: https://blender.stackexchange.com/a/72602/23134 Keep the grayscale in sRGB to work in Blender.

I have added SSS and a 45 degrees front light and tweaked the default settings.


(Linko) #18

I have made a video of my progresses.

You will be able to create your diffuse texture on your high poly, stylize your mesh and generate mobile game assets (or very optimized). In this demo I create a stylized barrel for a mobile game:

In the final version with the GUI, each time you will generate your assets your LoDs and textures will be automatically exported to your game engine. So you will just have to swap between your high poly in Blender and game asset in the engine so you will be able to update and tweak it very quickly.