OfficeHours:ProbablePrime:2022-07-12
Audio
Description
In this Office Hours, Probable Prime talks about:
- Optimising Avatars
- Exporting Data
- Updating Avatars with out-of-Neos changes
Other strange ramblings from Prime.
Transcription
(Please note that the transcriptions will not be 100% accurate)
Welcome to Office Hours, my name is ProbablePrime, if you have any questions please drop them
in the Office Hours text chat that is two above the one that you're currently in and
I'll get to the order that they arrive.
If there are no questions we are going to sit here on the precipice of doom with no
noise or sound at all.
The precipice of doom of silence.
So just get those questions in or we have to sit here, you'll slowly go mad at the lack
of sound.
So we have our first question here from Lex which says, what's a good way to optimize
avatars for network traffic, are you making sure that only necessary things are being
sent over the network to make sure the host doesn't get overloaded with data?
That really does depend on the type of avatar, I see a lot of people that do like preemptive
optimization for things that don't make sense to be optimized.
There are like cases where you might want to do it for like artistic reasons, for example
the anylander people will make their own IK, make their own sort of bones and rigging systems
because of artistic reasons.
They like making everything inside game without stepping outside of games.
So they get that functionality.
But I've seen some people who make their own IK because they're like, well, the IK is bad,
it's laggy and I want to avoid it.
That's an example of like optimization that's not needed.
If there's a problem with IK, we'll fix it eventually, we'll optimize it.
There's a good parallel to be placed here on browser stuff and JavaScript, I'm quite
opinionated here.
So there's a bunch of frontend libraries that are designed to just put HTML on the page
and make it interactive.
It's the stuff that powers TweetDeck, like Twitter, whatever website you use, it uses
JavaScript these days.
And there's a lot of cases where developers of JavaScript think they know better than
the browser manufacturers and they'll write their own mechanisms for doing various things
and then the browser people catch up and they're like, hey, if you use our method, it's so
much faster.
So a good example here would be React, which has what's called a virtual sort of HTML virtual
layer where stuff gets copied around.
And that was super fast and is still quite fast, but emerging standard in most browsers
is now a native virtual HTML that makes stuff a lot faster than even React.
But it's going to take years for people to use that because there's inertia from using
the old stuff.
So again, it's a good example.
We know in some cases, we know better than you about our ability to optimize it.
And when we optimize it, if you don't put anything hacky in place, then you get those
optimizations for free.
As a more sort of neo-centric example, if the React stuff blew over your head, let's
say there's one node that you're using quite a lot, using it in every single logics chain
you ever do, and it has a known issue with lag.
You could, for example, avoid that node, or you could open up a bug report, and we could
look at that bug and fix that node, and then every single use of that node would benefit
from the optimization.
If every single user avoided that node because it wasn't optimized, there would be no performance
gain from us making that change.
So keep that in mind.
With that out of the way, once you're away from stuff that is just standard, so if you
want your IK, your avatar to have IK, use IK, user IK systems.
If you want your avatar to have blend shapes, use those.
For reasons other than network traffic, the best practice right now is to actually slice
your head off.
This is kind of grim.
Slice your head off and make sure your blend shapes are only on your head and not on the
rest of your body.
Now, of course, there are body modification blend shapes, like sizing, et cetera.
Those should only be on the body.
The point being is only put the blend shapes where they need to be and split the meshes
such that the data is not copied between those two places, and that's better for performance
in other reasons but not network traffic.
Beyond those two things, which are literally nothing to do with the question really, avoid
writes where you can.
I see a lot of people doing animations or like reciprocal motion based on sort of writes
or Boolean matches.
For example, they might have a tail wag and they're using a Boolean match to do the tail
wag, right?
So they latch the latch on, it goes to true, and the tail swings to the right.
Then the latch off, and the tail swings to the left.
And what you're having there is you're just turning a Boolean match on and off for literally
no reason.
You can use a drive for that, and that would be a lot more performant and a lot less network
traffic.
Just use a sine wave.
That's what a sine wave is.
A sine wave is essentially on a smooth level, a Boolean match turning on and off.
Just mathematics.
So keep that in mind.
And then limit what's on your avatar as well.
If you don't use it every session, you don't need it.
So you know, don't parent a gun to your avatar, because I can guarantee you only shoot that
gun like once a day, maybe.
Sometimes if you parent it to your avatar, you'll find excuses to use it, and it's not
very polite to just walk into every session and be like, oh yeah, the gun on my avatar,
which I need to justify having, I'll shoot everyone.
No, just don't put the gun on your avatar.
Same thing goes with like multi-tools and stuff like that.
If you don't use it, don't put it on your avatar, and before you won't have that.
Then beyond that, just make sure you're using as many drives as possible.
Writes might sound good, repeated writes might sound good, but writes are sort of like a
network synchronization things.
Yeah, the blend shape thing is like, it's just like really, in some cases, like annoying.
It's like there are like defined ways to handle them, but a lot of times, either the defined
ways to handle them right now are kind of difficult to do, or rely on a sort of culture
change in avatar basemakers.
For example, the culture with avatar basemakers right now is to add as many blend shapes as
possible, because that actually drives their sales up.
If they can, you know, especially the body modification blend shapes, if there's like
five different body types and blend shapes change all of those, beautiful, that's a lot
of money for those avatar makers.
If there's a lot of expression blend shapes, again, that's going to drive sales up because
they can make cute faces, etc.
But what that doesn't do is it doesn't provide bases into the community that have optimization
in mind.
If they started just, you know, guillotining the head off properly, there'd be performant
there.
If they, I don't know, if they had something in Unity Blender, or even if we had something
inside of a Neos that made it, baking the blend shapes and putting those around would
be a lot better.
You can do it now, and I do recommend you do it, but some people are just like, it's
too complicated, or I don't want to do it, or I don't understand how to do it.
We could make a better system for that.
I always imagine, like, you know, in Star Trek, where medicine, you know, in Star Trek,
some guys might not notice I trick it.
In Star Trek, of course, because it's a sci-fi, so in the future, I'm always sort of fascinated
by the medical episodes.
You know, someone walks into the doctor, it always seems like much better than the healthcare
system in any country I've ever been in, right?
You just walk into, like here, in reality, you walk into the doctor, and they just got
to guess what's wrong with you.
But in Star Trek, you walk into the doctor, they beep you of a scanner, or then they inject
you of one injection, and then you're done, and you can leave.
Like that's how our tooling should be for avatars, right?
You get out a tool, or you get out a UI, you stick the avatar in it, and you're like, I'll
want to optimize it, and we'll just do everything for you.
We'll find out where the head is, we'll guillotine it, we'll separate those things, we'll bake
burn chips that you aren't using, and then we'll provide you with the optimized version.
You can just save that to your inventory, and that way, you've got an optimized one
and an editing one.
Blender and Unity should also be doing some of that.
I know that VRChat actually does do some of that.
When you upload an avatar, you'll see things like preparing your avatar for upload.
That does do some sort of optimizations and changes to the avatar when it's uploaded.
People just don't notice that, of course, because they can't sort of investigate the
intermediary stage.
The intermediary stage goes straight to VRChat, and so you don't see what's happening there.
But I do know that they do some stuff to sort of adjust things.
To answer this question about, wait, that's a thing, yeah.
It's called Web Components.
It comes under the sort of generic tree of that.
It's a more native way to do what every front-end library does right now, which is basically
like instead of having to write code and JavaScript and stuff to do like, oh, custom element here,
like cheese fountain might be a custom element in HTML, you can just do it using standard
stuff that's built into the browser, and it's faster because it runs faster because it's
in the browser.
It's not JavaScript.
But it's taking a while for people to catch up to it.
Moving on.
Jonathan has a question, will there be any way in the future to pull your own avatars
out of Neos?
Like if you worked on your avatar at some point in the future, you want to edit a few
things on it in Blender, but don't want to go back through the process of redoing everything
on a new version of your avatar.
Yes and no.
When your avatar is imported into Neos, it is changed through a couple of mechanisms.
First of all, it goes from a sort of FBX or whatever you import it as, whatever file type.
It goes from there to like ass importers internal format, and then into Neos's internal format.
And going backwards from that is kind of difficult.
And so that's why that doesn't work right now.
That's why exporting avatars does not work right now.
There are stuff that we can do there to make that a lot easier.
What I would actually think would be a better move there, though, would be to make it more
seamless for you to reimport the avatar and just sort of like shoot it across onto the
current avatar.
You can already do that, but it does have limitations.
If you don't change blend shapes, you just change weights or you just adjust blend shapes.
So no added blend shapes, no added bones.
You can just update the mesh reference on your avatar and it will work.
If you add blend shapes or add bones, it can not work.
I should probably like document that a little bit because like some people don't realize
that happens.
But yeah, if you don't add any bones, you don't have any blend shapes, you just edit
stuff in those existing constraints.
Just replace the mesh reference.
Perfectly easy.
You don't need to do anything.
I don't have all the time for UV editing.
UV editing is quite stable and usually UV editing doesn't touch the bones or blend shapes.
You're just adjusting the UVs or adjusting the textures.
You can just drop in a new mesh reference.
I also do it for weights.
Weights also appears to be one that is stable as long as you don't add any bones, for example.
I always have issues with clothing, like clipping where the skin clips through or bits of clothing
clip with each other and so I edit the weight painting a lot and I don't need to recreate
the avatar in that case.
I just update the mesh reference and it works.
But that is because I am not breaking any of those constraints I mentioned.
I also want to get one of those like, you know when you have to do a humanoid unity
and let's see if I can get a picture.
Yeah, yeah, yeah.
There's this screen.
I want to see if we can get something similar to that inside Unity.
It would only, inside Neos, it would only appear when there's a problem.
Like if we can't automatically do it, we could like open it up or maybe you could edit it
afterwards if there was a problem.
I don't want that to be a step that everyone has to go through.
I want it to be a step that people have to go through if they want to edit stuff or they
want to adjust it or it's coming in wrong and they need to just do it manually.
That would be great because then it would be like, cool, you don't need to worry about
the rig.
We have a lot of people that come in and they say like, hey, what is the rig requirements
for Neos?
And we link them the wiki article I wrote, but then they're like, oh, I've got a remake
my avatar to conform to that rig and I'm like, it's really not like, it's not that much different
to VR chats.
Like it's almost identical to VR chats.
Like, I don't know why you're redoing your rig, so cool, confusing, but there we go.
Moving onwards to more questions, Kip says, do you know a good sound file playlist object
in public folders?
I don't know playlists.
The only playlist one I know is the Polylogix YouTube player that can handle YouTube playlists.
There are a few I have seen that can do like multiple sound files in a list, but I don't
have one to hand.
I'm somewhat sound-adversed.
So he's boiling in here, so I'm going to go ahead and turn on the magical AC.
Yeah, I have a portable AC unit.
It's a big, large, stupid, but it makes the room cold, so I'm happy about that.
It doesn't make the room cold when I have too many doors open, because if I have my
bedroom door and my bathroom door open, it kind of doubles the square footage which it
needs to exact pressure on.
I can never remember if an air conditioner does negative or positive pressure, but it
needs like a complete closed system to work effectively.
So we're going to go close them doors, be right back.
Keep questions coming, I'll get back to them in just a second.
And I'm back with the bedroom and bathroom door closed, we now have a closed pressure
system which has immediately doubled the effect of the air conditioner.
So if your air conditioner isn't working, close those windows, close those doors, get
a draft excluder for your doors as well.
I have a sticky plastic draft excluder that went on my front door, because when my AC
was on, there was this whistling noise, which was effectively cold air I'm paying for, going
out underneath my door, and I'm like, nope!
I'm paying for that air!
Screw you!
With that, we're out of questions, if you have any more questions, please do let us
know.
Please drop those questions in.
If there are no additional questions, then soul crushing silence commences now.
You have the power of the sun in your hands, you can ask any question you want, and you're
choosing to ask a B in silence.
Interesting.
Quick call out by the way, occasionally when colliders come up in office hours, I make
a reference to a good example for using active colliders being mining with a pickaxe.
And I got kind of annoyed that I kept forgetting to make that tutorial, so I spent some time
yesterday and made the tutorial.
It's probably the hardest I've worked on a tutorial in a long time, so I'll just link
it in the office hours chat there.
Here's a 30-minute long tutorial about building a mining system, and that's cool.
It was probably about, like, three hours start to finish.
I was like, I should record this.
I need some assets.
I have found some assets.
I will build the object and make sure it works.
Okay, it works.
Cool.
Now I've got to do, like, a recording of a 30-minute tutorial without many mistakes.
I did it in one take.
I did it in one take.
No editing.
There are a couple, like, oopsie doozles, but it's fine.
The storm says that the CJ group made a system using active colliders.
Yeah, they should have.
Colliders are exactly what you need for that.
The reason behind that is, I mean, I talk about it a little bit in the tutorial as well,
but it's like a problem with, like, sets.
Basically you have a set of miningable objects that you want to be static.
You don't want the mineable objects that are out in the world to be doing anything idly.
If they're doing anything, you've got some wrong stuff there.
They don't need to be doing any maths or living their best life.
They're just inanimate objects.
But then you've got a bunch of people wielding pickaxes that want to be doing stuff.
They want to be attacking the ore, so it makes sense to put the colliders on the stuff, which
is...
There's less of.
There are more ore veins than people.
No business lawyer.
If you wanted to mine trees without punching them, you would need to maybe get an axe tree
chopping thing.
I'm happy to do more RPG-style tutorials.
In that video, I talk about, like, hey, what's next after mining smelting?
We could totally do a smelting tutorial.
That would actually probably be easier, because that would just be, like, hey, you take the
mined ore, you throw it into the furnace, you wait a few seconds logic-wise, and now
it pops like a bar.
Stereotypical mining.
Although it might be interesting to see if we can recreate hydrineer systems.
So in hydrineer, you can drop multiple ore nuggets into a cauldron and then pour it out,
and that will get you a higher bar, like a higher purity bar.
Which works out fine, until you realize that you've been, you know, playing the game a
long time, and that your one gold bar has, like, three million gold worth of gold inside
it.
Because it's just, like, cool, that cauldron will just keep adding weight and quality until
you stop it.
So linker says health system.
Yeah, I keep thinking about that one.
It's difficult to do, and the reason behind that one is that there are so many health
systems that exist out there already.
There are a couple that sort of communicate between multiple games as well, they've established
a couple of standards.
In a way, there's a standard one of the building groups uses, and I would think there's a standard
which the Japanese community uses as well.
And so I would hate to introduce another standard.
But if I make it deliberately a little bit crunchy and a little bit basic, then that
might work.
That's what I did for the mining system as well.
There's no, like, durability or anything like that, or, like, sound isn't good either in
the tutorial, but it gets you started.
Yeah.
Simpler systems are good.
I especially love having, like, a place to go on from.
So again, referring to that video above, I put, like, the whole resource pack I found
in the world, which has all sorts of resources, including, like, crystals and stuff like that.
And I show very clearly during the tutorial, here's where you make an ore more difficult
to mine or require more hits.
And so you could go into that world, and if you wanted to learn a little bit more, you
could set it up such that the crystal resources required more mining or maybe a different
pickaxe.
But it is the...
There have been other examples, but it's one of, like, you know, the sort of initial examples
of where I take, like, 500 other videos I've recorded and smush them together into a new
tutorial.
Sometimes I do, like, isolated technical concepts, and it's like, well, why would I need this
node?
Well, here's a video for you.
It's called Mineable.
Yeah, I don't want to make big claims here, because it's hard to prove, but I think I
was the first person to do a health system.
If you look up the world browser for deathmatch template, there is an ancient world.
It was a long, long, long time ago.
In fact, the only person I recognized that was around back then in this chat right now
was business lawyer.
But business lawyer has been here forever.
And that was the first time I saw it.
I had guns.
I had HP points.
I had respawning.
I had it all down.
The reason behind that sort of rush was that I don't think anyone understood dynamic impulses
back then.
But Fruch kept going around in various worlds, and they were, like, showing off dynamic impulses,
and people were like, oh, those are cool.
And then he started seeing stuff being created using dynamic impulses, and he's like, yay,
the knowledge is spreading.
I don't know if he just added dynamic impulses.
It might have been that.
I don't know if you can look at the update notes.
But yeah, look at deathmatch template.
It is ancient.
I was going to do a tutorial on how that worked, but of course then it changed because of dynamic
variables.
Yeah.
Deathmatch template.
12th of April, 2019.
Long, long, long time ago.
So Kip says if a mesh has the same vertex groups, can you swap it out by changing the
reference?
Yes.
Yes, I think so.
Try it.
Here's the best bet as well.
If you save the avatar and you have edits that you want to apply anyway and you're worried
about reimporting the avatar, it's worth it to try.
Just go in a world, slap down the saved avatar, update that mesh.
If it turns into a cosmic horror being, then you're out of luck.
Sometimes it will just work.
There is also the rig transfer tool tip.
I have no idea how that's meant to work.
I've been meaning to ask for years.
Because the avatar rig transfer tool tip either does cosmic horror or works flawlessly, and
I don't understand why or when.
Specs says, yes, I think the key to having either of those work is has the vertex sort
of changed.
Or something like that.
It's like, has the vertex order changed?
Has the number of bones changed?
Has the number of shape keys changed?
A fun story here which leads to a bunch of crazy cosmic horror is if you rig transfer
tool tip to stuff you know isn't going to be incompatible, sometimes it can lead to
cool results.
I have a version of my regular tutorial avatar which I accidentally rig transferred with
a Dutch angel dragon.
And it turned me into this very spindly creature that has a Dutch angel dragon head that's
all shriveled and a tiny wing on one side.
It looks really cosmic horror-y, but kind of artistic as well.
So try that out.
Maybe take a Hobkin and rig transfer it onto a Rex and see what monstrosity you create.
Kip says, do you have a tutorial on camera objects and outputting it to a texture real
time?
Possibly.
Give me a second.
Not directly.
The following video on a showcase of building a key to him might help.
Because that uses a camera texture.
The builder key to is a very simple in terms of textured model.
By his name, he periodically jumps in and says hi.
And the text sheet basically has squares of color for each part of the key to.
Except for the body.
The body is more complicated so you can do patterns and stuff like that.
But things like the collar, the tie, the eyes, the nose, et cetera, those are all sort of
just single squares.
And so you can change the color of those by just what I do is I put a quad over that area
on the texture sheet.
And then I have a camera in front of that, which I then hook up to the actual texture
of the Akita.
And that way you can see the changes live.
And then when you hit bake, I bake that camera view into an actual texture.
And I set that texture to be the texture of the avatar.
Similar way to how neoto shop works.
It's inspired by how neoto shop works.
And leads to a lot of cool stuff going on there.
You can kind of see how composition works in this random screenshot.
I'm going to pull out of the middle of nowhere.
Here where we have this is a science application I was doing the other day.
In this picture, you can see that we've got two cameras being composited by having a third
camera in front of them.
So two cameras output their two views to a quad.
And then in front of that is another camera which composites them together with some UIX,
which is graphing data.
And then you could make that a texture for an avatar if you wanted to.
For another example of seeing that in place, at the top of my head, my MMC 2022 entry does
have that in there for the whirlpools.
I don't remember where they are, how to get to them.
That world was created quite rapidly as I gave myself a weekend to do it.
So take a look.
With that, I believe we're out of questions and out of time.
So I'm going to go ahead and leave things off here.
And I will see you again next week.
If you have any questions in the meantime, please feel free to direct message me, post
on the Discord, make bug reports, et cetera.
And I'll get back to you as soon as I can.
Watch that mineable ore video if you're interested in making a mining system and keep your requests
coming in for what you'd like to see next.
I saw health system.
I'll add that to my list to do.
Oh, your previous question.
If I missed the question, I'm going to go back to it.
I'm sorry, Lex.
I'm sorry.
That wasn't a question.
Do you mean the anim.j one?
I haven't looked yet.
I promise you.
I haven't looked yet.
I do mean to look.
It's just I haven't looked yet.
My list is quite big.
I will communicate when I take a look.
All right.
Speak to you later.
All right.