Sunday, January 6, 2008

Importing Sculpt Maps to Blender

Say you are (an idiot) like me, and after playing around with modifying a sculpty you've been working on you remapped the UV and saved that off....and then forgot to save the file. Since Blender doesn't prompt to save new versions when you've changed something, sometimes you accidentally screw yourself.

Step one: curse profusely. Step two: do a google search and find these plug ins (if you can't see the forum post for whatever reason, here's the download link (and thank you, Domino Marama).

Drop those files in your Program Files\Blender Foundation\Blender\.blender\scripts directory (only the is required for importing, however the others may be useful!), and there should be an option in your File->Import dropdown that makes the magic happen. Yay! Once again, watch for that option popup (read the readme attached for what the options do, this time some of them actually are useful to change sometimes, although it defaults to what you usually want to work with, assuming sphere mapping and less pain with seams).

If you change your sculpt and need to remap it any, you will have to add a new material (F5), set to Texface, add three new textures set to blend (F6), and set them (F5) to: x, blank blank, red 1.0, Add; y, blank, blank, green 1.0, Add; z, blank, blank, blue 1.0, Add, and then Bake (F10) Textures, going through the normal material setup (I've gone over that in more detail before if this is too sketchy for you, however, these are the reminder for the things that need to be hit). Once the new materials are added and set up, hit that big Bake button, as you should know by now, to make with the flavour rainbow- and now we're back to just as if we hadn't lost it all in the first place. (One can also use Rokuro for the basic shape and import for making it a less regimented shape in this way, so if we wanted to not admit I'm an idiot, we would use this as the excuse for figuring it out instead.)


BETLOG said...

I was searching for blender/bvh tutorials/templates, followed a tangent and saw this. Been there, done that [painting my av head]..and ...long time no see. So just thought i'd touch base. Maybe we should talk blender some time.

Allegory Malaprop said...

Hey stranger! It has been a long time!

I'm still very much a Blender novice and trying to muddle my way through, and maybe help some people not to have to make my mistakes.

BETLOG said...

Blender novice, yes, same. Getting there though.. learning shortcuts and the sometimes subtle things blender uses to indicate stuff are the key there i suspect.
It's still the best freebie program i know of though. Amazes me how good it is every time i use it.
It was actually blender .bvh (animation) exports and looking for SL compatible rigs that people may have shared online that I was looking for... and which turns out to be a relatively obscure topic. Probably because the people who are doing it are also profiting from it in SL, and therefore not sharing.

That script looks very handy. For disaster recovery, as you said. It also reminds me that i need to figure out how to obscure my sculpties using the alpha channel, in Gimp.

Allegory Malaprop said...

I'm also obsessive compulsive about mirroring sometimes, so I'll export a sculpt that I prefer half of, copy and paste that half over the other, and then have something that's mirrored. This way I can import that back to keep working, as well (or paint it).

This is especially useful because mirroring works in the sculpt mode and not the edit mode (or, well, there probably is one there I haven't found), so I'll end up with one half I've tweaked the vertices with nicely. There are other little wacky things like making a sculpt perfectly mirrored (pixels vs. actual vertices mean that things will be slightly offcenter more of the time).

I'm working on getting real avatar meshes exported in multiple sizes to put up files for people to download, since we just get an approximation, I can see the bvh in Blender being very helpful for that as well, being able to use a real avatar model. Animations in Blender aren't something I've tried to tackle as of yet, I still only do little bits of animation so far, so it's not as big a deal. However, the guarding of secrets irks me- hence the "here's all the crap I know how to do so far, I hope this helps." I'd rather infinite diversity over protecting my "bottom line," but then, I'm not in this to try to make a living.

I'm totally unfamiliar with Gimp (I was already a Photoshop devotee before I moved to a PC), but one would assume it's reasonably straightforward, somehow. I'm currently not bothering to protect my sculpt maps, although there are a couple of things I'm working on that I might decide to- but with the potential for alpha channel being used for flexi, I'm not sure about it. One would hope it would still have an on/off toggle though.

BETLOG said...

>>(pixels vs. actual vertices mean that things will be slightly offcenter more of the time).

If you lay out your UV with a 32x32 image, and use "snap to pixels" you will get better results.. then use a 64x64 for actual export.
..and of course make sure youve got the "use lossless compression" checked when importing to SL.

>>I'm working on getting real avatar meshes exported

Er... pardon?
You mean like a libsecondlife OGL mesh?

BETLOG said...

oh, and of course start with a mesh object that has the correct number of X and Y segments (32 faces or 33 vertexes)... if you relate and position your XYZ vertexes in absolute proportion to your UVW vertexes the results are much more predictable.
Simply snapping to UV pixels on a 32x32 reference image will make a huge difference. But to truly WYSIWYG the mesh has to have the same number of XYZ points as the UVW.

Allegory Malaprop said...

I've...never actually noticed that snap to pixels thing, even though it's right next to things I use. D'oh. That will certainly help, eyeballing it always ends up with it slightly offcenter.

Even though I've seen it said that sculpts only listen to 32x32 although the image size ought to be 64x64, with the SLImageUploader I've actually had some success with getting 64x64s (i.e. 64 faces/65 vertices) to believe in every vertex. It's even more lossless (when set to be, of course) than the in viewer uploader, although there is still a bit of distortion in the viewer's interpolation.

And, something along those lines for the other thing. That is one thing I won't talk about in a public forum such as this because while it has really exciting possibilities for people who are going to use it more legitimately, it also has too much potential for abuse.

BETLOG said...

oh for sure, 64 is for upload, but 32 is for making sure the UVWs are snapped to the pixels...each time i rearrange or remap the UVWs i pull up a 32 image to snap them to.

Corax said...

"...while it has really exciting possibilities for people who are going to use it more legitimately, it also has too much potential for abuse."

Anything worth doing has potential for abuse. This is very much true regarding Second Life content. When you create something unique and interesting in SL, you risk having someone steal your creation, and no technical obfuscation or protection scheme will stop a determined thief. So why be hush-hush about something which has much greater potential for legitimate content creators than it has for criminal types? Such tools may already be in use by the bad guys, but those of us who work with avatars (or in my case, mess around with them and never seem to finish anything!) would do well to acquire better tools, not for making lots of money (not very likely!) but so the quality of SL avatars can be improved.

Allegory Malaprop said...

I was able to find out how to do it, so can you. But yes, here's one thing I'm not going to take people en masse by the hand for.

Last I checked, I wasn't actually obligated to write up tutorials for anything, so I think I should be allowed to use my own judgment as to what I do, and do not, want to spend my time explaining. Regardless, I have far higher priorities, even if I did want to eventually- so it still wouldn't be here yet, and might well not for a minimum of months to come. I've got a huge backlog as it is of things I'd like to run through notes on, as well as wanting to go back and clean up things at some point to make it a little friendlier.

Corax said...

I also would not expect you to spend your time on any tutorial unless it was something you wanted to do. My point was only that it does no good to be hush-hush about things that, as you said, anybody can find out. There is no real security through obscurity.