Booth Optimization example

From VR Wiki

Example A: Working from booth

Make an optimised version of your booth for meets, please. It is not impossible, I don't care what you say; this article literally will show me doing it.

Note that this is focused on making a specific 'optimised version', you will lose functionality. Keep the functionality for smaller meets.

Starting out

Starting out you'll either have a unitypackage full of crap or some FBXes and textures. Ideally you have both. But either way:

1. Pull out the FBXes and textures from the pack and load them into blender.

Looking at the using the prefabs, you can see that the default booth is quite a bit on the heavy side:

100k polies dammmit

Cutting the polygons down will be a blender thing.

Reducing Mesh

General strategies for reducing mesh: Deletion, decimation.

Looking at it in blender there's 100k tris (bottom right) and a load of meshes. VRC does not like rendering this.

Loaded into blender

Immediately a few things should pop up: Hair is FOUR meshes for some reason, there's a load of clothing, and there's some other shit going on.

Quick Wins

The quickest of wins: Deleting mesh objects that aren't even visible. What I did is I toggled the meshes on and off until I found stuff that isn't even visible. The Bra, isn't visible under the clothing. So... Just delete it.

You can't tell if the bra is on or not.

Next easy wins are pieces of mesh that I don't quite need to be on all the time. Like the hat, the coat. Pretty easy to take off.

Still looks good Still looks good

And we're down to 83k and nothing has even changed.

Cutting down with some tougher deletions

Next is to remove mesh that isn't visible but from meshes rather than entire objects. The most obvious here is the body; you don't need the boob mesh if your shirt is always on, and you don't need feet mesh if your shoes are always on. (Sorry footfags).

Select the undermesh and then go into wireframe mode, switching between edit and object mode getting a feel for how things change visibility. For selection and deletion stick to edit mode though:

Selection underneath

Then select mesh that is not visible when the clothing is on. Then delete. Use ctrl-shift-m and extend to help keepit mirrored; and after deletion double check there's no skin mesh you actually wanted to keep.

Selecting boobs Did the same to the legs under the garters, and also the garterfeet under the shoes

Looks the same. Even left the stuff under the skirt. We both know that this area is important.

All the overlapping and layered mesh is a complete waste when you're making a special optimised version of your avatar.

With all that we are literally under 75k tris already. You could even take this into VRC for the handsome "Poor" rating, which still puts you above a lot of people. But we need to go even further beyond... Mainly in case doing all this shit wasn't enough.

Decimation; to go even further beyond

If that wasn't enough; it's time to start affecting the polygon structure of mesh. This is a destructive process and should be used. However, it can be used to great effect to save polygons with very little loss of important detail.

You start by looking around the avatar and looking for candidates; good candidates are small things with way too many polies, stuff not affected by bone chains or shapekeys.

The shoes. I'm not a shoefag but the toplogy is nice. I'm about to ruin it, because 13k tris for the shoes alone is fucking ridiculous. If you ARE a footfag you could consider just deleting the shoes previously and then not deleting the feet. Barefoot has some kind of appeal to it for some people I would imagine. If you go into edit mode and select the mesh you can see the tri count of it in the bottom right.

Lovely topology but they're 13k tris. They gotta go. sob

All the shoes are already a separate mesh object, so I go into object mode, select the spanner and add a decimate modifier. Then I wiggled the ratio until they were cut down but not horribly scuffed; you can check the tri count as you do it.

Lost, like tears in rain.

I applied this:

Time to die.

And there's before and after (left and right). Notice how you can barely fucking tell.

Before After

Shapekey sidenote

When looking at the blouse I noticed that it actually uses a shapekey to sit under the skirt. In this case it's for some coomer thing where you just wear the shirt (really cute) but we don't need that on an optimised version. Performance wise, it's best to not be using shapekeys if at all possible; so it's best to apply the setting you want as basis so that the shapekey doesn't need to be active.

Shapekey off Shapekey on

Apply that shit to basis so you can forget about it:

Apply to basis will also create an undo shapekey

More Decimation

Anyway looking at the shirt, look at these little shits, you don't need this many polygons for buttons. Now they're attache to the shirt currently so to decimate them you select the button mesh (ctrl-l helps a lot here) and then hit p to seperate them out. There are loads of buttons on this thing:

these buttons are pretty high poly for what they are

These buttons are like 9k polies by themselves dude:

9k by themselves

Now you want to seperate them out and decimate them but they have shapekeys. The shapekeys are for BOOBS. Now here you can make a choice; do you want to keep the boob slider or are you find having your boobs stay the same size? To decimate you need to delete shapekeys. Typically the answer is I just want one boob size. So find that boob size, and apply those shapekeys to basis. Then come back and decimate.

Whoops, shapekeys

So do the usual; split it out, then to delete the shapekeys you can either mash - on the shapekey list or delete the entire information:

Delete

Then separate out the thing and decimate.

Now for the hair; a similar thing was done. I edited the shapekeys until they looked like the hair I wanted, then I applied them as basis and decimated.

You're unlikely to want to change these shapekeys in game

while decimating the backhair I noticed that decimating it scuffed it a little. Definitely avoid decimating anything that people will be looking at, like front and side hair. Back hair is more fair game. Avoid near the face for sure. Also avoid fingers, and generally any base body mesh, decimating that stuff is asking for trouble.

We do a little bit of scuff

Also avoided was the main skirt mesh; with all the bones and shit.

I repeated the decimation on anywhere that looked kinda high poly: Buttons, garterbelt clips, bow ties, and so on. I avoided smooth areas like panties and base body since you decimate that and you'll get clipping issues. I also deleted some extra layered mesh on the clothing, stuff not seeable.

After poly count reduction

After all that, what do we get? We're down to 56k polygons. And it looks FINE.

Down to 56k polygons nocap fr fr 56k polys from 100k and it is basically just as good as when I started.


Merging Meshes

After all that I had like 20 meshes because I separated out a whole bunch for decimation. Clearly too many. Obvious wins here are just merging them! Select the mesh objects and hit ctrl-j to merge them.

Merge the clothing and the hair and the body but do not merge the face. I said do NOT merge the face. Keep 2 meshes. When I did this I got this problem:

So you wanna merge huh kid The fucking UVs are broken the texture looks weird

Basically you merge and part of the mesh has the texture all fucked up. This is because it slapped the UVs together and if they're named differently then one of the UVs isn't actually applied properly. Just go through each separate mesh, rename the UVs to the same name (UVMap is the best name to use) in the upside-down green triangle (object data properties) UV map tab. THEN try and merge them again.

Literally just merge them with ctrl-j

The only consideration with merging meshes really is toggles. You'll bot be able to toggle off your shoes or the shirt with this; but who cares you deleted the shit underneath anyway.

Considering Materials

On this model there are 6 materials. The face has two mateirals; a normal and a tranparent one for the blush and shit. These should be kept separate since you'll want to keep transparent effects. They can be merged but it's some effort since you need to use transparency masks and shit and it messes with render queues... it's fine to leave them separate.

The rest has 4; there's a transparent one and a normal one for the hair; same applies as above. Then you got clothing and body... It's possible to merge all these but with 6 total there's no real pressing need to. However, as an example I manually merged the clothing and the non transparent hair material.

EZ merge

You CAN bake the textures but that's a kinda retarded way since you're actually using blender's rendering pipeline simply to paint textures on your UV. reserve that for other texture work. It's also a fucking pain.

What you can do instead is manually merge the materials. Details I'm going to write up elsewhere but basically I combine the textures and then move the UVs around to match the new combined texture.

Anyway what I did is I first separated the mesh out by material and selected it in UV Editing mode:

Mesh on right, UVs on the left. you can see what is mapped where

I checked out what Mesh was painted by what texture, and then copied the hair texture and put it side by side to the costume texture in gimp. Note that doing this is pretty suboptimal since textures really should be squares; for max power yo'd want to make a square out of this; maybe by combining four materials at once. Honestly for this model it doesn't need any merging but I did it just for the tutorial.

Expand canvas 200% horizontally, then copy the other texture next to it.

Shown below is the costume UV on the hair UV; basically the UV slaps on the texture. What if... I just moved the UV from one mesh to another texture?

costume on hair

So in the left pane there I load up the custom texture I just made: and the UV is fugged. whoops

The UV got all stretched because it was stored as % of texture or some shit I don't know.

Then by hitting s (for scale), then x (to lock to x axis) and then setting the scaling to 0.5 exactly (because it was doublestretched exactly) I resized the UV to the right shape:

Unscuffing

Then just g move into position. Use the arrow keys to move a pixel at a time for maximum accuracy.

moving

Then I did the same to the hair. I selected the mesh of the hair material, changed the texture to the double texture, scaled and then moved.

Again

However at the moment you have two materials that both use the same texture. Go to the mesh, and in this case I just changed the hair material to the costume material. As I changed the UVs and changed the textures, it can be the same material now. The redundant material is just now not used and won't be in the export.

Just change the material.

And the materials are combined. :paissapretty:

Combined lmao

Right one more important thing: If the material has normal maps and transparency/effect masks you're going to have to combine them into a monotexture too. If they have different **matcaps** then.. you probably shouldn't combine them! Unless you don't care about matcaps as you're OPTIMISING. Gotta go fast.

Deleting unused bones

With some mesh deleted there's some bones that don't do anything any more. Delete them. Chances are if you deleted the coat you can delete coatbones. If you're unsure, just go into pose mode and give them a wiggle. I went into edit mode, selected the coat bone root, hit ctrl-shift-g to select all children bones and hit delete. done.

Deleted

Blender Optimisation done

What I did is I uploaded the fbx and the texture to unity, dragged it into the scene, copied the materials from the kikyo prefab (IE the one with the stats at the start) using pumkin tools, then duplicated one material, set the texture to my new texture, and then used this material on the right slots for the kikyo there. Shit looks the same. But:

EASY MONEY

Notice immediately that the physbone component count is still really high. That's because the kikyo by defauly uses hinge bones for the skirt and colliders to do the skirt effects; there has to be a seperate component for each so that it hinges away in a different direction. Howevre it also has a seperate component for every single hair bone strand which is excessive. Unfortunately a root bone has not been made for the model so the boof author has set it on the chains. You can leave as is or you can see how to maek a root bone which I may fill in some other time. the tl;dr for this, extrude the head, then make it the parent of each of the ahir bones, then stick the physbone component on the root bone. You'll save like 9 components and get the avatar to poor at least. Then medium with a few more component merges. Also nips INSIST on using colliders for fucking everything I'd remove some of those. The breasts are also two compoennts, the belt is another three, it goes on and on.

For optimization purposes, combine them all by adding root bones in blender and setting just a single component on that root. Anyway look at this shit:

Breasts are two componentsThe belt is like 3And look at the fucking hair

well.. I got 20 minutes. Back to blender.

Reducing Physbone components

I started with the hair. First find the parent of the hair; in this case "Head", then extrude it with shift-e. Hit z to lock the axis and move it somewhere.

headboneExtrude it out

Then I went into bone properties and unticked 'connected'. This lets you move it about freely. Then I rotaed and moved it to an aritrary position. I rotated it weirdly because then it's just esaier to select; overlapping bones is a fucking pain. It's weightless so it doesn't matter. I then renamed the bone to 'Hair_root' and moved it.

Just untick this broMoved arbitrarily

Then for all the hair bones in the chains I set the top one to parent to that new root. Set it as the parent:

Do this for every hairbone.

Note that I left the ears out of this new root; since you'll want the ears to have a different setting than the hair in physbones. But we are optimising so I made an ear root for those. Exactly the same as the hair.

leaving the ears outJust did the same shit again but for the ears.

I also did the same for the boobs; and as it turns out there is no belt on the blender fbx so I ignored that. (It was added by pumkins tools, copied out from the prefab)

so anyway I export this into fbx, import into uity, set prefab settings, copy using pumkins... And it added the old bones there as expected:

My old bones....

However they still have the old physbone components on them so I leave them for now. Next I copy the physbone components from the old boob and paste it as new component on the new boob root.

Copy from the old BOOBAthen PAste as new

Doing this messed up the settings; the boobs were WAY wigglierthan before. What I did is tweaked the settings until they were good again. This is a pain and honestly you could skip making the boob root since you're only saving one component and you're losing DUAL BOOB GRAB functionality as well as having to retweak it like an idiot. You can go back in blender and parent them to the chest again, delete the breast root and just use the oldsettings and it'll fix it all. The settings I ended up changing them to is below:

The bounced roughly the same as before.

I did the same to the hair; and the hair just moved the same as it did before so I consider that a bigger win:

The hair settings I used (are default!)

I deleted all the excess crap and there we go:

Armature as it is now

And it's medium now. This did not take long. It's a lot of steps, but it's a lot of very simple steps. It took me a while to take screenshots and write this all down though.

Less excuses now please