Aller au contenu

Photo

Looking for the "best" way of implementing a skin mesh on a PC. Thoughts?


  • Veuillez vous connecter pour répondre
86 réponses à ce sujet

#1
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
So I'm finally getting decent enough at understanding how skin mesh works that I'm starting to look at skin meshing  PC characters.  But I've been spending more free time lately trying to figure out the best way to do it than actually doing it and I'm sure each method is going to have hurdles I'll have to jump over to get there.

My goal is to implement this idea from the Vault, basically.  For praticality, we're talking about being skinned from the neck or chest on down.  I don't want to do it as a robe but I am not averse to doing it as a tail.

So, I can get a skin mesh working by copying it over to the p model on a player. As long as they don't switch body parts from p**_(bodypart)000, everything seems "fine".  That's exactly what I used for this experiment- though you'll need an X-Fire account to view it.  Not really a great solution, IMO.

There are two other methods that seem like the next step: Duplicating the *_g skeleton in the a_ba supermodel series and rigging the skin mesh to that from the p-model on (which would mean a new phenotype) or doing the skin mesh just like horses, as a tail, and supermodeling the tail into a_ba instead of h_ba, which I think might allow me to get around needing to make a new pheno.

What am I missing?  Are there other approaches which are a better way to implement something like this?  If so, what are the advantages?

The old "Facelifting NWN" threads had a lot of good discusson but they covered a couple of topics at once and I'm trying to focus on this one specific thing.  Because of the sheer amount and variety of free-to-use meshes and textures, I'm looking at models originally created by the worldwide Sims 2 community.  Those break down to body mesh, face mesh and hair mesh as separate articles. 

The idea is rig the body mesh to the NWN skeleton, rig the face mesh to neck_g and then the hair to head_g.  Theoretically, robes and cloaks would still work and all body parts should still be usable, though they (like robes)  might suffer from clipping.

That's the idea, anyway.  Thoughts?

Modifié par OldTimeRadio, 03 décembre 2011 - 08:11 .


#2
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<breaking out...>

I don't having any cogent ideas at the moment.

I was looking at using effects to add clothing, jewelry, etc. and it is extremely limited by the nodes available to NWScript. You figure this out and find a way for me to stitch things to places *other than* head, torso, hands and left forearm and I'd kiss you.

Well, hug you.

Hmmm. Fist bump, anyway :-P

<the pins & needles>

#3
Rubies

Rubies
  • Members
  • 292 messages
Not sure how close it is, but I've been continually hopping between working on similarly updated NWN characters (though I haven't worked on them in a while, now), but I'm afraid I've rather dropped the compatibility side of things, using LShoulder and RShoulder for the head, and dropping the forearm, hand, and shin nodes. I do have a rigged model, which I'd be more than happy to send you if you wanted to take more of a look at it, but you'd probably be better off just using it as somewhat of a reference as it's not perfect (it's still -very- buggy, it doesn't have support for Robes, and Cloaks are... modified a bit, so you'd be a bit stuck there too).

Modifié par Rubies, 04 décembre 2011 - 02:19 .


#4
s e n

s e n
  • Members
  • 408 messages
i dont see the difference among using a body skinmesh and a robe skinmesh: the procedure of animation will be the same and they would share same animation nodes as well...like you said there may come issues from clipping when adding clothing parts to the body (the question is: does the engine allow to "hide" certain parts like it does when adding standard cloting? i dunno that)... but even if it doesnt, the idea of having skinmeshed bodies that can be overridden by skinmeshed robes sounds cool: you can even try something with nwn2 models, thats the same split body/head/hairs/eyes... its just a looooooooong work to reassing verts to animation nodes and safely weight all of them... very very long and brainstorming work

#5
OldMansBeard

OldMansBeard
  • Members
  • 152 messages
I've been working on skinmesh ideas lately too and I pretty much agree with what everyone else has already posted.

There's not much difference between doing whole bodies and doing robes, in terms of technique and design, apart from the heads of course. Doing whole bodies allows more variety because, whilst we are limited to 255 entries in parts_robe.2da, we can have up to 65535 distinct entries in appearance.2da so the scheme I'm moving towards is to provide robes for PC/Henchman outfits and distinct appearance models for all other NPC's. But that's a matter of judgement.

You definitely need extra bones to do it convincingly and those need their own animation keys in the supermodels. It's a matter of taste what bones you add and how you animate them. Personally, I've written some software (an offshoot of CleanModels3) that riffles through supermodels, adds extra bones (about 60 of them) and computes their animation keys from other keys, allowing for gravity and so on, all done automatically. I just couldn't face adding all the keys by hand, although it might give better results if I did and it's not an approach that would suit everybody.

You can't do the whole body with one skinmesh if you use lots of extra bones because there's a hard limit of 17 bones per skin. What you can do though, and what I do, is to use several skinmeshes within each model. You need to disguise the joins somehow - perhaps a belt at the waist and so on, but otherwise this works fine with no apparent lagginess.

It's possible to overlay rigid parts (a shin, for example) over a skinmesh body if you design them carefully to avoid clipping and if you are doing the skins as robes this is a good way to get some variety. Making the parts to work equally well as ordinary parts without a robe is a bit challenging but it can be done if you design your scheme with this in mind at the start.

Having seen my own results so far, I'd say it's definitely worth the effort to get past the "stick figure" look in vanilla NWN but that the effort is not inconsiderable.

Hope this helps.

OMB

Modifié par OldMansBeard, 04 décembre 2011 - 02:30 .


#6
Zwerkules

Zwerkules
  • Members
  • 1 321 messages
@OMB: I'd love to see some screenshots of your work.

#7
henesua

henesua
  • Members
  • 3 863 messages
How does one take advantage of all of the existing custom animations and phenotypes with a system like this?

#8
Nostrebor

Nostrebor
  • Members
  • 32 messages
Will these approaches allow the changing of skin color, tattoos, etc.?

#9
s e n

s e n
  • Members
  • 408 messages
of course

#10
OldMansBeard

OldMansBeard
  • Members
  • 152 messages
@Zwekules - all in good time. :) I'm not ready to go public with the models yet, just sharing what I've learnt so far in getting as far as I have.

@henesua - for me, it's not a problem. I'm using some custom phenotypes anyway and I've tried the scheme out with a few custom animations of my own just out of interest and it works. Once you have your software written, it's a matter of minutes (literally) to run custom phenotypes and custom supermodels through it to add the bones and animation keys. The hard bit is writing the software ...

This assumes, of course, that you have some way of rescaling and reshaping the skins themselves to different phenotypes, or of reconstructing them from scratch in the different proportions. I've made life simple for myself by using races and phenotypes that are derived from the basic one by variously scaling height, breadth and depth in different proportions. There are tools for doing that and it saves a lot of hand-crafting.

@Nostrebor - yes.

Modifié par OldMansBeard, 04 décembre 2011 - 06:54 .


#11
s e n

s e n
  • Members
  • 408 messages
OMB you're the Master of the Bit

#12
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Lots of interesting responses! I should have been clearer in my original post, though.  I'm trying to find the least-intrusive, least-complicated way to add a skin mesh body (neck or chest on down) to the PC while still allowing for dynamic heads and maybe heads and hair, if I attach heads to the neck model.  For discussion's sake, though, I'll just leave it at head and body meshes.

Using a non-dynamic appearance won't work for what I'd like to do because...it's non-dynamic.  To get the variety (outside of envmap or VFX tricks, etc.) of dynamic models with non-dynamic models requires a prohibitive amount of data, most of which is redundant in comparison to a dynamic model.

Using a robe is much better because I can now mix and match my skin mesh body with my head and I don't have to generate all the possible combinations like I would with a non-dynamic model approach.  The only problem is that it eats into an armor slot, which is more obtrusive than I'd like.  I would like it to eat no armor slots.

There's nothing "wrong" with either of those two methods.  They're just the wrong tool for the job if the job, specifically, is creating an unobtrusive (don't eat an armor slot) skin mesh body on PC which you want to have dynamic heads for.  Late yesterday I did find an article in the Omnibus which I'd overlooked because of the misleading title, called "Scaling within NWN" and which makes me think that mostly mimicing the way DLA horses is the best it's going to get.  Maybe.

Unless someone can think of a better approach for getting the skin mesh body onto the player which still allows for dynamic heads and doesn't use an armor slot?  Let me know your ideas if you can!

@ Rolo Kipp - Never even thought of that, great idea!  I think the farthest I ever got thinking along those lines was something like the claw attachment on the lizardman I did for the last CC challenge.

@Rubies - Thank you for the offer!  I'm really just trying to focus on how far I can get with a 14/15 bone skin mesh model (won't include belt as a bone, optionally includes neck as one).  I'm also trying to stick as close as I can to the existing framework, skeleton-wise.  Not really out of love, but necessity and compatibility. 

@S E N - Hopefully my explanation clears up why I'm trying to avoid robes.  Nothing wrong with the concept, it's just the limition of using up an armor slot  I'm just being picky to start with and see how much I have to yield to the game engine. 

...but even if it doesnt, the idea of having skinmeshed bodies that can be overridden by skinmeshed robes sounds cool: you can even try something with nwn2 models, thats the same split body/head/hairs/eyes.

Something in that ballpark is my hope.  I'm a fan of creative scavenging so kitbashing together armor from one source, body meshes from another, etc. is not just an option, it's my main focus.

@OldMansBeard -  Your project sounds interesting and I'd also like to toss on my request for screenshots or, really, video based on what I imagine you're doing.  Bones, skin mesh are done through vertex programs and so even what most think of as "very complex" models, bone-wise, seem to play very nicely as those calculations take place on the GPU.  If you click on the white X in my signature line (or here) that will bring you to my XFire videos page.  I uncovered some interesting though esoteric behavior regarding the bone limit in NWN, and those videos start with either "52 bones" or "53 bones" and run, chronologically, from lower right to upper left.  As far as seams on skin meshes go, you might look into the phrase "average normals" on Google.  I haven't had time to play with it much, myself, but it seems promising and has apparently been used for some time to address that issue.

Thank you for the information and it's nice to see someone else also working to get us out of "the sticks". :D

@Heneusa - Since any solution would supermodel into a_ba, it shouldn't really have much of an impact.  At worst, it would require duplicating 14 or so *_g bones (that make up the body, sans belt and starting at the neck or below) in any of the animations.  The duplication of those bones is necessary if I can't come up with a way to get skin mesh using dynamic bones to play more nicely.  I don't have many more tricks to try, but at least one more I haven't used yet.  Seeing what I'm trying to do, if you have any suggestions to make it more efficient, now's the time they would be the most helpful.

@Nostrebor - Yes, as tails can use PLT.  Though you wouldn't necessarily be required to use them.

Modifié par OldTimeRadio, 05 décembre 2011 - 03:32 .


#13
Rubies

Rubies
  • Members
  • 292 messages
In terms of animation, mine are rigged up almost exactly to the standard NWN models. Replacing the LShoulder and RShoulder nodes with the Head node would let you use a_ba as a supermodel. I went with cloaks as 'head' nodes due to the fact that you can then get hats/helmets that hide hair/head separately, but it shouldn't take too long to convert. I'll try throw together an untextured model with the head model switched that you can take a look at. :)

On a side note, that WOK walkmesh placeable is -really- interesting!

#14
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Ah, now I think I see what you're talking about. Yeah, if you want to throw it onto Mediafire and either post a link here or PM me, that would be great. Thanks a lot, Rubies!

#15
henesua

henesua
  • Members
  • 3 863 messages
I'll point the Q folks in the direction of this thread, as some of the models that I wanted to work with Ragnorok's alternate combat animations are presently problematic. These are the long coat models which have super model ba_coat or some such. Perhaps it will be easy for them to fix those up.

#16
OldMansBeard

OldMansBeard
  • Members
  • 152 messages
OTR - I see, now, what you want to do. Just one thought - the parts-based base models - pmh0.mdl and so on, don't have to be invisible, they can themselves have visible meshes, which could be a skinmesh body, which would always display but could be (partially) covered the armour parts if an outfit is worn but otherwise would appear as is. Now, they only seem to allow dds/tga bitmaps, just like creature models which is a bit limiting but I seem to recall that in one of the last patches, creatures with appearance numbers above a certain number are allowed to have plt's instead. If that's right, defining a high-numbered part-based appearance might just do the trick.

(edit) - sorry, that's probably rubbish. I was thinking of the thing in 1.67 whereby parts-based races could use their own plt's instead of human ones. You would have to create a separate appearance for every skin tone and so on. Although if they all had the same race letter you would only need one set of parts. I'm rambling. I'll stop.
:blush:

Modifié par OldMansBeard, 05 décembre 2011 - 08:54 .


#17
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
About putting a mesh on pmh0, exactly.  There were two problems I had with that method: First, the skin meshes didn't seem to work properly unless all bone nodes they were attached to were the 000 versions- like null arm, null bicep, etc.  Second, if I secrete a skin mesh with an assigned texture onto a p-model, how can I change the texture without eating up a new line in phenotypes.2da for each texture I would want to use?

There are some ideas I have about getting around the first problem but the second one seems to be a deal-breaker.  Maybe I'm missing something, though?  I probably won't be able to get a demo of anything out with the holidays but I'd like to keep kicking around the question and see what approaches we can think of.  Brainstorming is useful, even if a particular branch of thought doesn't wind up panning out.

If there are any lurking modders out there, the need to solve this problem could crop up in your future too and sooner than you think:  With the very recent additions of a topology selectorcustom target loader and clothing creator to the open source MakeHuman, it's going to get a lot easier for a single person to create lots of these full-body meshes from scratch themselves.

:)

Modifié par OldTimeRadio, 06 décembre 2011 - 12:52 .


#18
OldMansBeard

OldMansBeard
  • Members
  • 152 messages
A wild idea - haven't tried it (yet), assuming there's no way to get plt's onto base models: decompose the tga/dds bitmap into its RGB components, make three layers of skin, one for each component, (maybe a 4th layer underneath for white) and vary the skin colour dynamically by varying the alpha of each layer using three custom animations with alphakeys that shade up and down timewise, chopping each animation off according to the colour you want.

Alphakeys on skins certainly work (I've used it before) although NWMax doesn't understand them. Whether the transparency would work over 3 or 4 layers, I don't know. I'll try it out and report back.

(edit -added)

Well, it sort of works. I have a skinmesh creature with the multiple skin layers, that changes colour dynamically between red and green via yellow when it plays a custom animation; chopping the animation at half time leaves it permanently yellow.

I haven't managed more than two colours yet, though. Need to fiddle around with layers and alphas 'n stuff.

OMB

Modifié par OldMansBeard, 06 décembre 2011 - 03:54 .


#19
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Very innovative idea!  I read it this morning and I didn't "get it" but now I see what you're talking about.  Deliciously brilliant in the way we have to be to get things to work as we'd like!

This might be off topic because of how environment maps are applied to the player model and how that eats up 2da lines, but I'd had some good success with a technique to use a solid envmap to fake a "one layer PLT" effect.  What I do is take a TGA without an alpha, add one in GIMP, "Decompose" the image so I can edit the channels, copy the red channel (say) into the alpha, invert the alpha and then (and this takes quite a bit of time, for me) carefully white-out (solidly or with a brush) all parts of the alpha I don't want to pick up the influence of an environment map.  Then I can tint the creature (I've only used this on creatures) via appearance.2da instead of having to generate new, full, textures.  One model, one texture, many color results.  So these are all the same texture, just using different environment maps as defined in new 2da lines: A, B, C.  The eyes, mouth, claws and back scalesare fully whited out in alpha (so no envmap coloring is picked up) while belly has been carefully blended so the original coloring comes through a bit more naturally.

That specific method I describe yields really impressive results and I was kicking it around as a possibility if some other ones failed.  It would still eat up phenotype.2da lines, unlike your idea, but it's something I've thought about as a "next best", fallback, option.  It's only good for saving space on models and non-PLT textures at the expense of 2DA lines, though, so really I guess it comes down to being used best on tails or appearances.  Anyway, I wanted to throw out the idea, even though it might not necessarily be a useful tool in your train of thought but just on the off chance it did...like somehow your alpha trickery in conjunction with the influence of an environment map to...I don't know...I guess it wouldn't be able to produce a third color like in real life, but...

We are limited to 99 phenotypes, correct?  I think various community modifications have eaten up about 25 or so of those...(?)

The more I'm poring over the content I might be using and looking at how different things would play out, I guess this would really come down to a fairly small number of "nude" base skin meshes and do any other meshes as robes through which the "base" p-model or tail-based "underskin" would physically punch through.  Which would make sense in the context of "I am using this armor slot because I am wearing clothing or at least clothing more substantial than underwear". Edit: It just seems very wasteful in most situations, though.  Even though it's being done on the GPU, the deformation on unseen verts is still being tracked.

Modifié par OldTimeRadio, 07 décembre 2011 - 01:23 .


#20
OldMansBeard

OldMansBeard
  • Members
  • 152 messages
Your envmap trick sounds cunning. Maybe a combination of ideas would work best. I'll leave the alphakey idea with you, I don't need it for the robes I'm doing at the moment. On your last point, I agree it seems wasteful to cover up patches of skin verts but if you think about it, at worst, it's only as bad as having twice as many characters in the scene so maybe it's not too horrendous.

I didn't know about "MakeHuman" - it looks good. If what I'm doing is obsolete before I've even finished it - great ! The NWN world will be an _even_better_ place :)

#21
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Thank you for sharing alpha key idea!  As far as the skin mesh verts go, you're right about the load and also GPU manufacturers are notoriously clever with how they do things so there may be some automatic optimizations the GPU executes in such circumstances whcih I don't even know about. 

MakeHuman and things like it definitely are nice.  As are procedual texture generators- lord knows I've tested just about every one of them.  But as a person who has spent a lot of time looking for timesaving panaceas, and even cobbling together a couple of my own attempts with MaxScript, for example, I have yet to find anything which procedurally replicates artistic talent or modding skill, heh heh.

#22
Rubies

Rubies
  • Members
  • 292 messages
Since I haven't actually sliced this model up yet to test it, and am still a tad distracted with swapping these bones around (and redoing some of the weighting... and... okay, I just got really distracted with fixing it up), how does NWN treat bodyparts? I heard something a -long- time ago about it treating skinmeshes and shadows and... something else differently, but it seems pretty unlikely to me, and I definitely know it treats shadows pretty normally. Just figured I'd make sure. :)

Modifié par Rubies, 08 décembre 2011 - 03:47 .


#23
OldMansBeard

OldMansBeard
  • Members
  • 152 messages
Skinmeshes cast shadows as usual, unless you turn them off deliberately of course. Danglymeshes tend to have broken shadows, or none, depending on what kind of model it is.
I'm adopting a scheme whereby the base models (pmh0.mdl and so on), contain low-poly trimesh shadow meshes and all armour parts and robes have shadows turned off. So the figure casts the same shadow regardless of what is equipped in the body slot, which isn't quite right sometimes but near enough for me. It means shadows are cheap in terms of processing load and I don't have to worry about jagged edges, concavities and whatnot in the parts and robes.

#24
Rubies

Rubies
  • Members
  • 292 messages
It definitely sounds more efficient to use the underlaying bones, essentially, as shadow boxes; I've had my shadows disabled on skinmeshes but my bones are too basic to consider using as shadows, so maybe I'll have to improve those instead. Makes sense, though!

Modifié par Rubies, 08 décembre 2011 - 05:41 .


#25
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
@OldMansBeard

OldMansBeard wrote...
You can't do the whole body with one skinmesh if you use lots of extra bones because there's a hard limit of 17 bones per skin. What you can do though, and what I do, is to use several skinmeshes within each model. You need to disguise the joins somehow - perhaps a belt at the waist and so on, but otherwise this works fine with no apparent lagginess.

I just wanted to correct something I mentioned earlier about modifying normals on multiple skin meshes in order to fix the visual discontinuity caused along the seam between the two.

If you take a look at this thread (which covers the topic) and then search for "However when I followed the steps Michael did, it worked:", you'll see the process I really meant to direct you to.  I still haven't played with it very much but I'm going through my notes as I code these procedures into MaxScript (as much as I can, anyway) and realized I'd initially misdirected you.

Sorry about that. (!)

Edit: Oh well, possibly for naught.  I can get the seam effect addressed in Max but it's not doing well in NWN.  It might be that it's because the seam is smack in the middle of a highly distorted bit of skin.  I'll keep tinkering.  If anyone finds a way to get this or some other method to help those seams go bye-bye, please post here or PM me.

Edit: Well, figured out a way to seam him without him seeming seamed.  Or close enough, anyway.
Posted Image Posted ImagePosted Image Posted Image

Modifié par OldTimeRadio, 18 décembre 2011 - 01:13 .