Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Map Chan Hax

Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-12-2008 10:29
I'm a 3DS Max user and I love mapping channels. What I don't always enjoy is doing all of the mapping channel acrobatics in Max. Since most of my texture work is in Photoshop, I would like to have some sort of mapping channel functionality in PS.

So I spent some time writing my own little mini texture render engine in PS. Start with a texture, toss a starting triangle over it, and move it someplace else. It was just a matter of getting the triangle/UV data into Photoshop.

I actually got lucky with the Max exporter script. Wasn't as difficult as I thought. In Max, make several mapping channels and export two of them in one file. Simple text format and I'll have to expound on it later. Once exported, exit Max and all about Photoshop.

Close PS if it is open. Toss the filter, TS3D_mapchanhax.8bf, into your filters folder. Fire up PS. The filter will show up as Tech Slop 3D > Map Chan Hax.

In the zip file, there is also SLFHead_vectors.psd. In the Paths palette, there are two vector templates: side and quarter. I'm not sure, but I think I got the ratio a bit wrong on the quarter template. Anyways, use them to paint or photosource.

Since this is still a very early beta, there are some transparency issues that I have to take of. As such, please make sure that what you do is on a Layer and not on Background. And it is currently kind of important to make sure that all pixels are filled - that is, no partially transparent pixels because Map Chan Hax will fill them for you and you might not like how it does it.

Once you have all that, hit Filter > Tech Slop 3D > Map Chan Hax. Click the Load button, select the appropriate *.MCH file, and follow your nose.

Basically, you can take a side shot and translate it to the head texture UVs of the female AV. Same for the quarter veiw.

One of the good pieces of news is that it should work at any document size. I haven't gone higher than 1024, but theoretically good at higher pixel dimensions. If you get crazy with the document sizes, let me know how it goes, please.

Once it's done it's magic, do some Flaming Pear's Solidify or something to fill in the transparent areas. Yeah, I'll tell y'all more about the transparency later.

Oh, and I haven't made it smart enough to deal with UVs that are out of range. Watching out for this is good for when I talk more the silly data structure that I used.

This should work with other 2d programs that can load PS filters. Not entirely sure which ones, though. It might choke in certain version of PSP or something. I don't know. Worth a shot.

http://tech-slop.serveit.org/plugs/MapChanHaxB1.zip
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-13-2008 05:08
http://tech-slop.serveit.org/wiki/index.php?title=Map_Chan_Hax_Shoulders
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-13-2008 23:57
Did some more work and I'm officially mostly happy. The big thing being that it now works on individual channels, which takes care of the partial transparency issue. This also happens to mean that it works in Lab mode and such.

http://tech-slop.serveit.org/wiki/index.php?title=Map_Chan_Hax

http://tech-slop.serveit.org/wiki/index.php?title=Map_Chan_Hax_File_Format

http://tech-slop.serveit.org/wiki/index.php?title=Map_Chan_Hax_Leg_Seams

For the next bit, gonna be working on some clean up stuff. Then I'm going to let it sit. Once the urge strikes me again, will probably try to do a version that can load more than 2 sets of UV data.

Cheers.
Chip Midnight
ate my baby!
Join date: 1 May 2003
Posts: 10,231
09-14-2008 07:38
Haven't had a chance to check this out yet but it looks very cool. Thanks for sharing, Abu, you mad genius!
_____________________

My other hobby:
www.live365.com/stations/chip_midnight
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-15-2008 00:46
You know, I'm honestly surprised that it works. I'm rather sporadic when I work and sometimes I go too fast for my own good. But I exercised *tons* of self-control, took it slow, and made sure everything was in place before moving on to the next step. It all started with drawing triangles which isn't as easy as it sounds if you are doing it from scratch.

Now I have to take it easy and figure out what I'm going to do next.

One of the things that I enjoy doing is UV mapping. It's one of those things that I do when I need a break. I mean, I have a version of the female avatar with 21 mapping channels. I have the torso mapped several different ways with plenty of blending space. Same for the legs and head. Lots of UV with lots of overlap between the channels for all sorts of blending goodness.

I'm very tempted to start chucking out tons of mapping channels for MCH. But there is the UV overlap problem with material IDs. The only sure way to take care of this problem to my satisfaction is to do a version of MCH that can handle more than 2 channels at a time.

Later I'll chop up my 21 chan and toss a few of those out. Seeing how those do might help me figure out what route to take next.
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-15-2008 07:25
I just took a quick romp and fixed a little something that I wasn't sure about. Everything still works, but making it multi-channel should now be cake.

To kind of celebrate, I uploaded one of my unwrap jobs on the female mesh. Might work on the male mesh, but I haven't checked it (might stretch a little extra funky). Even though I did this mostly for skin work, I have done some successful clothes making tests with it.

The basic idea of this unwrap job is to cover the majority of the torso. From just below the neck and armpits down to the hips. The seam is down the middle of the back, which should be easy to fix once you get back to the default unwrap.

One of the problems with this kind of thing is material IDs and over-lapping UVs. To kind of get around this, I created a channel that I call Trip. It's a waste of space, but that's alright. It's basically all three parts of the mesh quartered into the corners. The head is in the upper-left, torso/upper in the lower-left, and the legs/lower in the lower-right. The waste of space is the empty upper-right. I wanted to stack it Chip-style, but ran into some massive interplation issues.

In the zip file is the template in vector format in the Paths palette. The orignal size is 512x512, but because of the nature of the Trip channel, the final textures will be 256x256. However, the template is vector and will resize just fine. I tried this at 2048x2048, meaning that the chunks will be chopped into 1024x1024, which will downsize to 512x512 for final export.

If you want to see how the channels correspond, I highly recommend taking Chip's or Robin's templates and running them through it. Make a double-sized document to hold all three parts, put the head in the upper-left, upper/torso in the lower-left, and lower/legs in the lower-right. Flatten and toss it through MCH with SLF_Front2Trip.mch.

http://tech-slop.serveit.org/plugs/SLF_Front2Trip.zip

I'm gonna go back to hiding under my rock unless something happens.
Pygora Acronym
User
Join date: 20 Feb 2007
Posts: 222
09-16-2008 08:10
Cool proof of concept. You are always working on something interesting man. Are you planning to release the UV to MCH Max Script?
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-17-2008 04:27
Oh, I've got way tons of stuff, Pygora, that I play with. One idea that I've been playing with is parametric-ish selections. Imagine painting three masks for the cheeks, then blending them together in a bunch of different ways that is uber easy for a mass variety of cheek masks. And I think I have a quick-n-easy way of doing faux sub-surface scattering in Lab mode. Start with a base skin, toss some lighting masks at it, and let it handle the rest. I got sucked into these ideas while I was working on my sculptie tutorials, which I will probably never finish.

Anyways, the MaxScript that I've been using. I had the bulk of the code, but I kind of asked about it at CGTalk. Bobo tossed out some code which was easier to read that what I had. The good news is that things did correspond between different UV channels, which is what I originally asked about.

No polish, but it works. You will have to Open it, edit the mesh name and the channels, then Evalute All. Bear in mind that I'm still not sure what will happen if you take certain things to the extreme. If you have more than 32k worth of faces, things might go bad. If your UVs are out of zero-to-one range, then MCH won't know what to do (this I can fix but have yet to do it).

CODE

theobj=getnodebyname"number3" -- change this to mesh's name
theMesh=snapshotasmesh theobj

mapchannels = #(1,2) -- the channel numbers to export

output_name = getSaveFileName caption:"Map Chan Hax" types:"MapChanHax (*.mch)|*.mch|All Files (*.*)|*.*|"
output_file = createfile output_name
out_file = createfile output_name

format "%\n" theMesh.numfaces to:out_file

for m in mapchannels do
(
for f = 1 to theMesh.numfaces do
(

theMapFace = meshop.getMapFace theMesh m f

mapVert1 = theMapFace.x
mapVert2 = theMapFace.y
mapVert3 = theMapFace.z

mapUVW1 = meshop.getMapVert theMesh m mapVert1
mapUVW2 = meshop.getMapVert theMesh m mapVert2
mapUVW3 = meshop.getMapVert theMesh m mapVert3

format "%\n" mapUVW1.x to:out_file
format "%\n" mapUVW1.y to:out_file
format "%\n" mapUVW2.x to:out_file
format "%\n" mapUVW2.y to:out_file
format "%\n" mapUVW3.x to:out_file
format "%\n" mapUVW3.y to:out_file

) -- f numfaces
) -- m mapchannels

close out_file


One of these days I'll fix up the MaxScript to make it a bit more friendly. Kind of ironic that I don't know enough about MS to do it tout de suite. Figure that one out. Heh.

edit:
If one of the mapping channels is Spherical, you might be able to do faux environment/reflection type stuff. Then again, it could be a complete overlap distaster. I might have to try this later.

Wait... logic bomb in that, but I might be able to get it work.
Pygora Acronym
User
Join date: 20 Feb 2007
Posts: 222
09-17-2008 08:48
Nice! This is handy stuff in general.

I replaced the first line of your script with
CODE
theobj=getnodebyname selection[1].name
so it runs on what you have selected, rather than having to type the mesh name in the script. I'm lazy like that.

Thanks for sharing this. You are indeed a mad genius. I'm going to play around with this some more now.
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
09-19-2008 05:32
That's the spirit, Pygora. And you are absolutely right - even though SL got this out of me, definitely useable in other environments and such.

Now it's time for me to regulate this to the back of my mind for a bit. The next step is seriously uncharted territory for me and I need to let my sub-conscious chew on it for a bit. And I need a bit of a break to meander with some of my in-world ideas.

Cheers.
Sioxie Legend
Obsessive Designer
Join date: 11 Nov 2006
Posts: 168
10-09-2008 17:01
Abu do you have the body (torso) and legs done in the same manner as the head? Just curious. I would really love to try this out.
_____________________
Sioxie Legend
__________________
http://secondwavefashion.blogspot.com/
www.soignemonde.com
https://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=31662
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
10-10-2008 02:48
Maybe this weekend I'll take a break from other things and toss out some MCH packs. The older ones that I tossed out are incompatible with the Multi version, so I really should spend some time redoing some of that.

If anybody has any specific ideas on a remap, I'm all ears. Or I can just do things my way and hope for the best.
Claire Harford
Inquisitive Creature
Join date: 16 Apr 2006
Posts: 49
10-10-2008 07:52
All ears, huh? *GRINS*... let me see...

I'm not sure if this was originally included with Map Chan Hax (as opposed to the current Multi Chan Hax)...

Any possibility of getting the arm mapped *with* the shoulder joint, split down where the shoulder seam is? Then the arm split again where the side seam of the torso is? Think of a raglan sleeve (athletic sports tops). I know there's only one real arm on the official templates, so I'm not sure if this could be tricky. :)

Next is... Shoulder seams! I *think* you had some with Map Chan Hax... but I must have missed them. Any chance of swapping them over to Multi Chan Hax?

Oh, and just as a heads up... I don't think the Front2Trip vector template is included with Multi Chan Hax. You might want to move it over to the newer version. Unless you already have, in which case, ignore me! :D

Thanks again, dude!
_____________________
Symphony Skins
SLurl: http://slurl.com/secondlife/Artisan/65/192/22

Clothes Horse
SLurl: http://slurl.com/secondlife/Artisan/75/212/22

Random Ramblings, Tips & Tricks
Blog: http://mistressofdesign.wordpress.com/
__________________

If men could only know each other, they would neither idolize nor hate.
- Elbert Hubbard
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
10-11-2008 01:32
Anything that is like a cylinder intersecting with another cylinder is kind of tricky. Torso and arms, tree trunk and branches.... things like that. The one shoulder that I did do for MapCH was the whole shoulder with some buffer zone and with the seam in a different place incongruent with the two default seams. I will give the shoulders another go and see what I can come up with.

And definitely some regular seam ones that aren't terribly tricky to use.

One thing I would really like to do is kind of a workshop or an informal challenge. I've been thinking about putting together a specific head/face pack for Camille and seeing what folks come up with. I think it might be kind of cool to see different results and compare some notes and techniques. If there is enough interest in this, I'll start putting the resources together soon.

I did not include the vector template for the Trip channel (as I call it). I didn't really see the need for it because anybody should be able to hack it together using Chip's or Robin's templates for it once they see how I put it together. But I'll put that on my list of Nice Thing To Do.
Jenette Ellison
Registered User
Join date: 27 Sep 2006
Posts: 17
OMG I gotta try this but I'ma aMac
03-30-2009 17:21
I downloaded this filter but won't work on my mac cs2, 3, or 4? Must be PC only? I know some developer tools could convert it to a Mac Plug-in-- I'd be williing to pay for it!! anyone? Please?
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
03-30-2009 22:21
PC only. Developed with FilterMeister, so the only way to make it Mac would be to covert it by hand with a complete re-write.

If anybody here wants to try it, or knows somebody that is willing, I would be more than happy to shoot over the code. Why, I might even wax the code a bit and comment it. I've already released the main pixel mangling engine to the FM community, so it should only be a small skip-and-a-jump for me to do so.