Bend This
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
01-12-2009 11:49
Finally decided on a brute force option attack. This is a very complicated programming technique where you add tons of options and keep trying them until things come out right. Very advanced stuff. This also allows for some really cool and confusing flexibility.
Well, it looks like I finally got my vector bending thing down. So far it has passed all of my tests with flying colours (pun). It even seems to play well with my polar remapping thing (reflection maps in Photoshop - this is uber cool as well).
The thing that sucks is that it requires three data sets that have to be in rastor format. In order to get it to work, you have to load up three BMP files. That's a lot of hard-coded data. But a small consolation if this thing really does perform for you. So far I have done the female upper torso @ 1024x1024 and the files total almost 10 megs. Egads!
Time to start clean-up and things. Hopefully I'll have something of substance tossed up in the next day or so.
~does a happy dance~
More to come.
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
01-13-2009 00:51
Some quick graphics of what I'm babbling about and what's to come. 
|
Infiniview Merit
The 100 Trillionth Cell
Join date: 27 Apr 2006
Posts: 845
|
01-13-2009 06:30
haha! A picture is worth a thousand words.  Vectors are waaay cool! I have been teaching myself in Inkscape the last few months. I might have to loosen my wallet and get the suite next time and step up to Illustrator. Awesome work Abu!
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
01-13-2009 07:18
Hahaha. Actually, I'm talking about a different kind of vector. That's cool because those kinds of vectors are cool as well. As a matter of fact, I used those kinds of vectors to make the bump map in those one graphics. Here is the quick-n-sleazy Bend This b1 package:  Put TS3D_bendthisb1.8bf in your filter/plug-in directory. It should show up as Filter > Tech Slop 3D > Bend This b1. Also in the zip are the TBN rastors that are needed. These are JPEG files for compression reasons. You will have to convert these to BMP files in order for Bend This to load them. Load the JPEG into PS or whatever and save/export them to BMP. The TBN rastors are 1024x1024. Currently there is no scaling. So, your working bump map will also have to be 1024x1024. If you use other dimensions, you will get tiling woes. For this right now, stick to 1024x1024. The only ones that I've done so far are the female upper torso. Claire was all excited about doing clothes, so this seemed like the best place to start. So, you have your bump map at 1024x1024. Use Bump to Tangent Normals to convert it to a tangent map.  Once you have your tangent map ready to go, hit Bend This. The UI looks pretty complicated. But all you really have to do is load the BMP files using the T, B, and N buttons. Once you have them loaded, watch the magic. You should them be ready to go to do other things with your new and improved world normal map. You know, RGB Theta and all that jazz.  For the curious, the drop-downs next to the TBN load buttons are for order of operations of the channels. And the check-boxes are for inverting after the order is set. All of these options work by default with the TBN rastors provided. If it wans't for this slew of options, it would have taken me forever to get things straight. For the truly curious, check this out:  Oh, BTW, the TBN rastors provided are without the right arm. The whole mirroring thing and all that. Depending on what you do, you might have to fix the right shoulder. Planning on several things. One of the bigger things I want to do is clean up the 3DS Max shaders for this and get it out there. And little things, like maybe add an Amount slider. Long term, I want to set it up more like MultiCH. You know, condense all of the data into an indexed format instead of bulky rastor. Well, have fun playing around with what I've got up so far. And if you get the gumption, talk back and/or show anything you come up with. These kinds of things never cease to give me the giggles. Doing these kinds of things in Photoshop absolutely cracks me up. Not bad for a goofball, eh? Insurgent: You can't do that in Photoshop. Me: Yes I can. And I'm going to just because it's funny. Insurgent: . . . ! Just imagine if I was a real programmer. Heh. Anyways, I'm off for a bit. BBL
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
01-14-2009 03:57
Here is the mat file for 3DS Max. It has three different materials in it for the different TBN rastor components.  The materials are based on the nested RGB Multiply trick. Two of them make use of the Normal Bump map. The Normal Bump thing is kind of weird. The magic number seems to be 0.6, which doesn't seem to correllate to anything I can think of. Also, Normal Bump needs a solid colour, so I tossed in Checker for that. I just spend some time cleaning up the legs for this. You know, taking care of shading errors and all that. When I went to render, the UVs got all jacked up. Not happy. Not sure when I'll have the strength to give it another go. Chip, if you already have the mesh waxed and set up, can I trick you into doing the renders? If not, I will get to it (again) eventually. I do have it cleaned, but I never did clean it for use with MeshSmooth or TurboSmooth. I did take the crappy shading-error laden legs that I did for a spin. Good news is that they work. Did some buttons, pockets, and general goofing around. Kudos for that.
|
Infiniview Merit
The 100 Trillionth Cell
Join date: 27 Apr 2006
Posts: 845
|
01-14-2009 12:57
Hey Abu, Wow you must be some kind of mathematical genius. The "vector" you are referring to I am now guessing is a math equation. I know that you create photoshop plug ins, and if I am correct 3ds max plug ins as well mostly relating to UV maps for creating skins. In my attempts to demystify your vernacular, is your use of the term "rastor" just a different spelling of the term "raster". Multiple searches failed to shed light on that question. Also looking at one of your other posts you talk about "trilinear interpolation". Thinking that this was some sort of photoshop option I looked for it there to no avail. Searches took me to discussions of various types of texture mapping to pixels in 3d environs. Where I discovered the term "texel" which if I understand correctly is like a basic unit of a texture mapped to a pixel. This search again reminded me of how complex a 3d environment is. In my limited comprehension of the explanation of trilinear interpololation it appears to be a method of texture mapping that relates to how the texture will appear in relation to the movement of the observer in a 3d environ. I do not make skins or clothes (as of yet anyhow) my interest has just been academic. Most posts I am able to file the subject matter internally in some fairly accurate context. But yours have caused me to put my detective hat on to find out what the heck your talking about. haha. Some of the terms your referencing you speak of as if applying to your project like a tool trilinear int. for example. Are you speaking in a programming context? Make no mistake I intend no criticism whatsoever. It appears to be pretty fascinating stuff. Also do you sell stuff? I took a glance at your pf and there was nothing about a store anywhere. Oh and can you do anything about the avatar mesh? haha. 
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
01-15-2009 01:33
I am a genius, but I'm a sloppy genius. I know this one guy with lots of formal training and sometimes we have a hard time communicating because I'm so sloppy and he's so formal. I have been to a university (crammed 2 years into 1), but I learn and work much faster on my own.
The bulk of my genius isn't in how much I know, but the creative ways in how I use what I know. I can learn anything, and once I understand something I can run with it in so many different directions (you should see what I can do with something as simple as Photoshop's Displace filter). Therein lies my true strength.
As a shining example of my sloppiness, you are right: it is raster and rastor. I spell it wrong, but at least I do it consistantly. I also have a tendency to make up my words and phrases to describe things. Ever hear of a blending mode described as 'identity 128'? Or high sat flesh tones due to sub-surface scattering described as 'event horizon'?
----
Okay, interpolation.
Lets say in Photoshop that you have one photograph with another photograph on top of it in the same document. If you reduce the opacity of the top photo, you will see an interpolation between the two photographs. This is linear interpolation.
You have two points, each point is a photograph, and then you find the resulting photograph somewhere between them.
Then you have bi-linear interpolation. You have a square with a photograph at each point. You then pick a point in that square and find the resulting photograph. Actually blending four photographs in a very specific way.
For tri-linear interpolation, imagine a cube. Now imagine that each corner of the cube is a colour. Pick a point within the cube and find the resulting colour. This is what I've done with my Trilinear Int filter.
----
Now vectors are a pretty big can of worms.
In their basic form, they point in a direction usually with a distance or magnitude built right in. For example, V[2,-3] is a vector that means move to the right by 2 and down by 3. To get the magnitude or distance, just use Pythagoras. M=sqr( 2*2 + -3*-3 ) = 3.6 approximately.
The vectors that I'm using in all of this are 3-point unit vectors that are also called normals. This means that they are in 3d space and always have a distance of 1. For example, V[0.707,0.707,0] is a unit vector (approximately).
What these vectors represent is the direction that 3d geometry is facing. The top of a box points up, so it would be something like V[0,0,1].
Where things get confusing is when folks start using different axis, orders, and things. Maybe V[0,0,1] is actally to the right instead of up. This is why I tossed in a lot of options because I'm actually mixing XYZ with RGB and I'm not always sure what goes where (sloppy genius again).
What I've done is taken normal vectors in two different spaces, UV and 3D, and put them together in a meaningful way.
-----
Okay, more vectors.
Adobe's Illustrator is a vector program. This uses vectors in a different way.
Take a point and give it two vectors. These two vectors would be the handles that you adjust to tweak the curve. Take another point and also give it two vectors. Then draw a line between the two points using the assigned vectors (handles) to describe how the line curves between the two anchor points.
This is also a form of bi-linear interpolation. B-splines and all that, which is another big can of worms.
NURBS (Non-Uniform Rational B-Splines) is an example of taking these kinds of vectors into the 3rd dimension.
----
Yes, I do have a little store in-world. It's somwhere in Mieum, along the west sim edge I believe. It's open-air and off the ground a bit. Mega-prim cylinder for a floor.
If you manage to find it, bring someone along so you can go ballroom dancing. Right in the center of the cylinder platform, there are ballroom dancing danceballs by Bits-n-Bobs, but they are slightly modified. Hop on them, then pan your camera up about 8 meters for a pleasant surpise. It gets even better if you use Midnight settings.
And if by some lucky chance you happen to catch me in-world, ask to see a demo of my multi-pose stand.
The irony of all of this is that I will get suspended in about a week for non-payment. Heh.
Um... yeah. BBL
|
Infiniview Merit
The 100 Trillionth Cell
Join date: 27 Apr 2006
Posts: 845
|
01-15-2009 01:51
Very cool, Thanks for the explanation that clears up alot, haha. I can relate. 
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
01-15-2009 02:00
Whoops. East edge at approximately Mieum(240,140,135).
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
01-27-2009 02:54
Got suspended a few days earlier than expected and got back a few days later than expected. But I'm back, i'm bad, and I'm feelin' mighty good about myself. While I was gone, I figured out a few algorithms for a few other things. Who knew that adaptive histogram equalization was actually so easy? Anyways, here are the female legs. As above, in JPG form, so save them as BMP so Bend This can load them. I did take them for a spin and they look straight to me.  Now, if you've played with the Max shader, something might be wrong with the T shader. This would be R and G being inverted. I'm not sure. If R and G are inverted, just invert in the shader, invert R and G after render, or invert Tx and Ty in Bend This. It's these kinds of little things that confuse me - which is *exactly* why I have all of those options in Bend This. I use Filter Meister for this stuff (without a doubt the best $25 I've spend in a very long time). Recently, DLL support has been added. This means that something like FreeImage can be used to load things other than BMPs. However, I haven't come close to being able to figure this out. FM is very C/C++ like. The free demo version of FM allows for saving source, loading source, and basic compiling. However, it does not allow for compiling to 8BF files. If anybody out there is willing to give it a go, I am more than willing to compile to filter and all that jazz. Even if it's something as a simple example of DLL usage and/or loading something other than a BMP, I'm sure I can figure it out from there.  edit: Screw it. I'll figure it out and do it my way.
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
02-03-2009 22:04
Success, biotches!
I can now load all manner of image files - including PSD files. Screw you, BMP! Be gone with you!
I can redo some of my old filters. I can also now go crazy with some of my newer ideas. How would you like a hacked texture render engine? Colour map, bump map, reflection map, diffuse, environment... I'm drooling.
As if this TBN bump trick wasn't enough. Speaking of which, my reflection map trick is on my soon-to-do list.
I rock. That's all there is to it.
~does a happy dance~
|
hurly Burleigh
Registered User
Join date: 19 Sep 2005
Posts: 167
|
02-04-2009 11:05
Abu
For us mere mortals who dont understand Geek Speak.
Is this a plugin filter for Photoshop?
What is it that it is actually doing?
It seems as though you have created something wonderful but to get the full adoration you deserve, perhaps a numbskull version of the explaination would help.
I looked at the graphics link and it appears to create a bumo mapped version of the texture?
|
Apple May
Apple May Designs
Join date: 6 Oct 2006
Posts: 326
|
02-04-2009 12:20
I agree with hurly, looks like some really cool stuff but I'm super confused (not that it's hard to do). I'm confused with exactly what this does... shading? I love the reflection you did but I noticed the note that it's something you'll release in the future... so the plugin that you've posted here isn't that?
I'll be the first in line when you do if that's the case! If you could give the break down in really... really... simple terms of exactly what this plug in does I'd appreciate it. I've played with it a bit, but I'm only getting a sketch appearance to my image lol.
_____________________
Fashion for Less
|
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
|
02-05-2009 01:48
Okay...
Let's say that you have a 'big boy' 3d application. You can have a model, textures/shaders/materials, set up lights, and render. Two things in particular that we are looking for in these apps is bump mapping and texture baking.
Bump mapping being a greyscale height map of sorts. "This part of the model is higher than it's immediately surrounding area and the lighting/shading on that part of the model will be affected as such."
Pretty much all models have UV space. This would be the wireframe or template that you paint on. Chip and Robin have supplied the more popular templates for the SL avatar. Somewhere along the way I supplied the vector versions of these. If I remember correctly, Py did some as well and I vaguely remember Robin or Chip mentioning it. These wireframe templates is what you paint on. Clothes, skins, and all that. You also paint bump maps on these.
And then texturing baking. You have your model in a scene all textured up and lights to light it up. You then tell your 3d app to 'bake' the texture of the model to UV or wireframe for the given model. Someone recently released some ambient occlusion renders (name escapes me right now) - this is an example of texture baking. There is also a Lightwave tutorial floating around that shows texturing baking (again, escapes me).
So, in these 'big boy' 3d apps, you have have a bump map on a model and then bake it to texture with the bump map having done it's thing. "I'm going to use a bump map to put buttons on a shirt and you will be able to see that when I bake the texture."
This happens pretty much seamlessly in the 3d application. You don't have to worry about the calculations under the hood and all that.
What I have done is broken the process down into several steps and put them into Photoshop. I don't want to put it all into one big step because sometimes all I need is one little piece for something else.
The first thing you need to do is make a bump map. Greyscale. Lots of ways of doing this depending on your flow.
Then you use Bump to Tangent Normals (PS filter I've provided) to convert the bump map into a tangent map. The resulting map should be dominated by blue with some funky colours. This individual step alone is damn handy.
Now this is where things get a bit complicated because a lot of calculations are involved. Also, I took a clunky route, but it works. But I am working on getting some of the clunkiness out.
You are almost ready for Bend This.
In the one zip file I have provided 3 JPG files for the female torso. These would be femTorsoT.jpg, femTorsoB.jpg, and femTorsoN.jpg. But what you have to do before being able to use them in Bend This is convert them to BMP files because Bend This can only load BMP files (something I will remedy very soon).
*Note that the files are 1024x1024. Make sure that your working doc is the same size or else you will get funky results. That is, make your initial bump map @ 1024x1024. Fixing the scaling issue is on my to-do list.
Convert the provided JPG files to BMP.
With your new fangled blue-ish tangent map, run Bend This.
You should see three buttons labeled T, B, and N. Use these buttons to load femTorsoT.bmp, femTorsoB.bmp, and femTorsoN.bmp respectively. Hopefully you shouldn't have to mess with the slew of options that I tossed in.
Bend This should spit something out that looks an awlful lot like femTorsoN.bmp - but modified appropriately using the blue-ish tangent map.
What you do with or how you use this new texture map is up to you. You can use RGB Theta or RGB Elipsoid for faux lighting effects (two filters that I have provided). Or you can throw a reflection map on it (as of yet unreleased). You know, whatever.
In a very small nutshell, paint a bump map and light it up in Photoshop.
:whew:
Back to work with me.
|
hurly Burleigh
Registered User
Join date: 19 Sep 2005
Posts: 167
|
02-05-2009 12:52
Thanks Abu It is actually something like i was thinking but i was unsure of all the technical terms for things. I will give it a try  Keep up the good work
|