It’s time for BugSmashers with Mark Abent!
Transcript by CanadianSyrup
What type of computer sings? A Dell…
The Bug: Lods(Level of Detail) which handles what you see at various distances was only showing one lod regardless of distance and in this case the lowest one which made the character look awful up close.
A character has bones on it which then they can attach objects to it such as helmet, body armour, pants, belt, weapon, etc.
There’s a piece of code which streams the geometry of those items above to allow the higher Lods to come in, but the problem is there’s also skin attachments which adds additional bones and geometry to the character himself and is permanent unlike helmets which can be removed. The problem appears to be stemming from the skin attachments breaking and overriding the other piece of code.
Olie from the UK built a piece of code that properly filters the attachment objects and the skin attachments so that they’re not conflicting and overriding with one another and causing improper lods.
Ta da! No more 80’s pixelated character!
Mark Abent (MA): Hey everyone, welcome back to BugSmashers. Before we begin, I got a little joke for you guys, no one’s in the office so this is gonna be good, ready? Here we go. What type of computer sings? You got it? Wait for it… A Dell… Ahh? Ahh?
Hey everyone. We are in a fun little map where there’s nothing in there, but our evil player and as you can see he looks really, really, really, lovely. This bug happens to be from Olie in the UK where our good old characters are not streaming in the higher end content or I should say his lods, his higher end lods, whenever you’re close up it just keeps using the low end lod which is the lowest, lowest, lowest mesh you could have on a character. This is what you’re supposed to see when the guy is weeee! Way, let me turn this guy off. Way back here, but instead when we go way up close we’re getting the crappy LOD.
Alright so what’s happening. Let’s go to the fun little code, here we are.
So we’re in this bit of code called the character instance. This is basically the root character you see here, could probably just do this, so my root character. The player has some bones on it and then we attach the helmet, we attach the body armour, we attach his pants and his belt, if he had a weapon, we’d attach his weapon. The character or the player and all his bones has a bunch of attachments like the helmet, armour, and so forth and we basically in this little bit of code will stream in the geometry in hopes that the higher end stuff comes in.
The only problem is the streaming thing only works for, well in this case it’s only trying to get raw geometry like even another character which can have even more bones or just geometry. Pure Geometry is a static object and then the character instance is another character. So you can have maybe another armour that had another bone that you can stick something too, but unfortunately we have other attachments that have these things called skin attachment when it basically adds additional bones and additional geometry to the character himself. So it’s not an additional like this helmet, if I put it on it maybe has two extra bones here, but it’s a separate object that I’m just attaching to my head as following. A skin object is this thing getting stuck to my head and forever being apart of me, it’s not separate, it’s me now, that’s what a skinned object is. Unfortunately those are the things that look like they’re breaking.
So what Olie did is he moved this little bit lod so that it can find per type and unfortunately we have different ways that we can have skin objects. For our attachment we have attachment objects and the attachment controls have these objects get put onto the things. So if we have an attachment type bone then it will handle any attachment objects that go to the specific bone. If we have an attachment face, it handles any attachment skins that get stuck onto the face and so on. Now unfortunately the attachment system has two ways of doing skins. The attachment object could be an item which has another skin to put onto the player, it could be like the face where the attachment object has a skin, so the skin unfortunately can be in two places right now, it could be on the attachment or the attachment object and this bit of code only handles the attachment object.
So we actually have to… Let’s check to see if our attachment also has a skin because if it has a skin then we want to stream in that bit too.
Unfortunately this functions not constant, that will get fixed after this, but to change that to constant would require a huge rebuild of code. This is for the programmers going “Oh my God why did you change that constant”, well to demonstrate and fix the bug I am just removing it for now so we can see the effect, don’t worry it’ll be constant again. So we’ll hit recode. Now if our attachment has a skin we will also add it to our merged lod information of the character and if everything goes well, we will refresh the logs.
Hey I have eyes, and now, look at that, our character is in HD, Oh snap. His hair is a little blue, but I’m probably missing a texture or two, however his little straps are no longer little weird triangles and you can see a lot more detail and when we go way out and beyond you can see that his lod, if you look at the pixels, his pixels, you’ll see that it goes to the correct lod and then when we snap in you can see the helmet pop. Wooo! So now we’re getting our good high fidelity lods when you’re close and nearby and Shazaam. Hope you guys enjoyed.
So as you guys saw we had a little fun lod issue. Our attachment system is quite complex. We have attachments which define how attachment objects should stick to something. It could be a character, it could be a chair, it could be a face and there’s many different attachment, may be different attachment objects and either one of those can have a skin where a skin makes, like if I’m a character, I now own that additional geometry and unfortunately we weren’t checking the attachment to see if it had a skin, we only checked the attachment object and now we’re attacking both of them so we can stream in the lod information correctly, so now our little character or in that gigantic character we’ll have the correct lod when you’re up close and he won’t look like a pixelated in 80’s game. Hope you guys enjoyed, see you next time.