Friday, December 28, 2007
Hack your UI!
The decimals allowed in the basic UI make fine tuning alignment a royal pain. But, you can edit the xml files and fix that! This wonderful person tells you how. There are also some other neat things you can do in that blog! (Hint: search for 'name="ColorTrans"' in the tools too, and up the max_val from 90 to 100, and be able to set things ACTUALLY transparent without scripts or textures!)
Tuesday, December 25, 2007
SLImageUploader, oh how I love thee
This sculpt was a test to push the system (basically...every vertex counts, and is required to be reasonably accurate, with this done in a 64x64 mesh, which it was), because my pirate hat...came out lessgood than expected. I also wanted to make this table (someday, I'll actually get around to making the legs, and texturing, and all that stuff). Firstly, I uploaded it with the default uploader, to see how bad that makes it:
Not only does it mush the details and can't manage a flat surface, LOD also wrecks it even more:
Something that is only really easy to tell when you're in SL, at the side seams it often doesn't quite match up. While SL's compression sort of wraps when chopping things into little bits and gluing them back together again, it doesn't do a great job of it. In textures this is generally not something you'll notice- although upload anything that actually depends on real pixel data, and yeah, you will (I've got a small texture I need to upload through SLImageUploader because it has very obvious seams...that aren't actually there).
Here you can also see where the top vertices all pull to one, because the top doesn't technically exist. I didn't have the vertices to spare to pull it all to the center, so I'll have to take care in my texturing. (Note: while this is taken of the default uploaded version, the good one is fairly similar, and identical in the vertex pulling)
Finally, what happener when I used SLImageUploader instead. Flat pristine surfaces, a little distortion but not even close to as much, and a generally much cleaner model. This is something I can work with. The other was something I could give up on sculpties with.
Things to still keep in mind: the interpolation in SL rounds off edges. This is good, in that things aren't all sharp and pointy because we've got limited points. This is bad when you want to make things with...sharp points. This is a problem that can be sort of gotten around by clustering a number of points to remind it you really do want that.
Not only does it mush the details and can't manage a flat surface, LOD also wrecks it even more:
Something that is only really easy to tell when you're in SL, at the side seams it often doesn't quite match up. While SL's compression sort of wraps when chopping things into little bits and gluing them back together again, it doesn't do a great job of it. In textures this is generally not something you'll notice- although upload anything that actually depends on real pixel data, and yeah, you will (I've got a small texture I need to upload through SLImageUploader because it has very obvious seams...that aren't actually there).
Here you can also see where the top vertices all pull to one, because the top doesn't technically exist. I didn't have the vertices to spare to pull it all to the center, so I'll have to take care in my texturing. (Note: while this is taken of the default uploaded version, the good one is fairly similar, and identical in the vertex pulling)
Finally, what happener when I used SLImageUploader instead. Flat pristine surfaces, a little distortion but not even close to as much, and a generally much cleaner model. This is something I can work with. The other was something I could give up on sculpties with.
Things to still keep in mind: the interpolation in SL rounds off edges. This is good, in that things aren't all sharp and pointy because we've got limited points. This is bad when you want to make things with...sharp points. This is a problem that can be sort of gotten around by clustering a number of points to remind it you really do want that.
Thursday, December 20, 2007
Code wrangling
Overview I shall try to keep updated of the code bits and bobs that will end up here.
Simple attachment animation code: a simple script to throw in an attachment that you want to always play an animation when held. Good for carrying things around with you.
Network server code: this particular has an object that, when touched, delivers all the items included in the server to the toucher, but also provides the basic framework for objects communicating with a server for other uses. Server code is some deeply guarded secret, and it was a pain finding this.
Ring scripts: code for scripting rings that guess your hand state, and adjust accordingly. I use something that evolved from this in all of my rings- it has more adjustability on the user's part written in, and the right/left bias is written out and adjusted in another script. The version I use is sort of a great huge mess because I'm not a coder, even worse than this one that I'm putting out there to get the theory out for people to use in their own products. I'm...embarrassed to show the full version. This one is messy enough, and that one just adds more crap in- I'm so not a programmer, I'm someone who codes when necessary, so I'm very clunky, as this will show. Introduction, right hand, left hand, and a simple supplemental helper script for getting rotation for hard coding. The same basic theory can be applied to scripting fingernails/claws, as well as even more tenuously applying to intelligent skirts- however this is waaaay overkill for the latter, and I suggest using that free script, AttachmentSet, instead, as it is a far more elegant piece of coding, and the server will thank you for the reduction in processes.
Simple attachment animation code: a simple script to throw in an attachment that you want to always play an animation when held. Good for carrying things around with you.
Network server code: this particular has an object that, when touched, delivers all the items included in the server to the toucher, but also provides the basic framework for objects communicating with a server for other uses. Server code is some deeply guarded secret, and it was a pain finding this.
Ring scripts: code for scripting rings that guess your hand state, and adjust accordingly. I use something that evolved from this in all of my rings- it has more adjustability on the user's part written in, and the right/left bias is written out and adjusted in another script. The version I use is sort of a great huge mess because I'm not a coder, even worse than this one that I'm putting out there to get the theory out for people to use in their own products. I'm...embarrassed to show the full version. This one is messy enough, and that one just adds more crap in- I'm so not a programmer, I'm someone who codes when necessary, so I'm very clunky, as this will show. Introduction, right hand, left hand, and a simple supplemental helper script for getting rotation for hard coding. The same basic theory can be applied to scripting fingernails/claws, as well as even more tenuously applying to intelligent skirts- however this is waaaay overkill for the latter, and I suggest using that free script, AttachmentSet, instead, as it is a far more elegant piece of coding, and the server will thank you for the reduction in processes.
Sculpty corralling
You can use tags to find all of my ramblings on sculpties, but it's kind of word soup in there. So here's an attempt at a handy dandy guide of what's where.
Step by step...badly. Sort of. Tips with no shiny pictures, because I am lazy:
Getting Started: A very quick and dirty crash course in how to get up and running. Use a premapped sphere, and jump straight in to using the modeling tools (the fun part!). This is to get your familiar enough to hit the ground running, it doesn't teach you how to master Blender. Because Blender is evil and complicated, and I don't know how to do most things in it.
UV mapping the hard way: Say you didn't use that premapped sphere to start out with, and in fact, did your sculpting first, and then decided you needed to map it. It ain't pretty, unless you go through a number of seemingly extraneous steps. If you do this, it is imperative you preview your sculpts before uploading, as getting them backwards is really easy.
Texturing sculpts: some quick and dirty tips to get your started in the world of texturing with Blender. Does not include advanced techniques, but at least gets you pointed in a vaguely decent direction to start.
Texturing and the Avatar mesh: how to import the av mesh into Blender, and a few things to do from there, as well as how to be able to paint on a sculpt to line up better with an avatar clothing texture (note: your mileage may vary, since we don't get to play with the real av mesh, just a vague approximation).
Importing Sculpt Maps to Blender: we've covered how to make an object in Blender into a sculpty. But what about taking one of those rainbow maps and making it into an object in Blender we can play with? Here's how.
Awesome things that make life easier:
Link to a pre mapped sphere: Find mapping a pain in the ass? You're in luck! Here, have a sphere to start with that's already had all that crap done to it. You just need to rebake when you've finished your sculpting.
SLImageUploader: example of mush to awesome with SLImageUpload. Also, if you're having some side seam distortion, this should fix it, because it doesn't use the stupid JPEG compression...which is idiotic when we're talking something where every pixel does matter. Yes, even when you tick lossless in the SL client, it lies like a filthy whore.
Extra tips for other problems:
Mirroring: a very brief couple of tips about what to do if you find your sculpt map is inside out in SL. This is why you pretty much always want to preview the sculpt in SL, even if you're then logging out to use SLImageUploader.
Sculpt Mapping: an overview of the different mapping modes you can set for your sculpt in SL. Generally you'll go with the default sphere, but the others do have their uses.
Sizing Sculpties Smaller: Say you need miniprim sculpties for something. Sculpts only natively go down so far, and there's no dimpling to save you. However, adjusting the map in Photoshop can shrink them down nicely.
Step by step...badly. Sort of. Tips with no shiny pictures, because I am lazy:
Getting Started: A very quick and dirty crash course in how to get up and running. Use a premapped sphere, and jump straight in to using the modeling tools (the fun part!). This is to get your familiar enough to hit the ground running, it doesn't teach you how to master Blender. Because Blender is evil and complicated, and I don't know how to do most things in it.
UV mapping the hard way: Say you didn't use that premapped sphere to start out with, and in fact, did your sculpting first, and then decided you needed to map it. It ain't pretty, unless you go through a number of seemingly extraneous steps. If you do this, it is imperative you preview your sculpts before uploading, as getting them backwards is really easy.
Texturing sculpts: some quick and dirty tips to get your started in the world of texturing with Blender. Does not include advanced techniques, but at least gets you pointed in a vaguely decent direction to start.
Texturing and the Avatar mesh: how to import the av mesh into Blender, and a few things to do from there, as well as how to be able to paint on a sculpt to line up better with an avatar clothing texture (note: your mileage may vary, since we don't get to play with the real av mesh, just a vague approximation).
Importing Sculpt Maps to Blender: we've covered how to make an object in Blender into a sculpty. But what about taking one of those rainbow maps and making it into an object in Blender we can play with? Here's how.
Awesome things that make life easier:
Link to a pre mapped sphere: Find mapping a pain in the ass? You're in luck! Here, have a sphere to start with that's already had all that crap done to it. You just need to rebake when you've finished your sculpting.
SLImageUploader: example of mush to awesome with SLImageUpload. Also, if you're having some side seam distortion, this should fix it, because it doesn't use the stupid JPEG compression...which is idiotic when we're talking something where every pixel does matter. Yes, even when you tick lossless in the SL client, it lies like a filthy whore.
Extra tips for other problems:
Mirroring: a very brief couple of tips about what to do if you find your sculpt map is inside out in SL. This is why you pretty much always want to preview the sculpt in SL, even if you're then logging out to use SLImageUploader.
Sculpt Mapping: an overview of the different mapping modes you can set for your sculpt in SL. Generally you'll go with the default sphere, but the others do have their uses.
Sizing Sculpties Smaller: Say you need miniprim sculpties for something. Sculpts only natively go down so far, and there's no dimpling to save you. However, adjusting the map in Photoshop can shrink them down nicely.
Sculpt mapping
Sculpty UVs map 4 different ways in SL. Each have uses and pitfalls. To change your mapping mode, you have to insert a script defining the llSetPrimitiveParams:
Where PRIM_SCULPT_TYPE_SPHERE is changed to the type you need, and YOUR UUID HERE has been replaced with the UUID of your sculpt map (left click on the texture in inventory, Copy Asset UUID, Paste in script). After it's compiled, you can, and probably should, delete the script from the object's inventory.
PRIM_SCULPT_TYPE_PLANE maps as a plane. The edges do not connect in any way, it's one face and invisible from the back side. Your sculpt is a one sided piece of paper you've done your crumpling or origami to.
PRIM_SCULPT_TYPE_CYLINDER makes the UV map a tube. The sides wrap around and connect to each other. This is the first evidence of why it is 100% necessary to not end up with a sculpt map that's 90 degrees off, although it will screw you in all modes but plane. In cylinder, the top and bottom are open and do not connect to each other in any way, leaving an open hole on either end, through which you can look in and see that there is no inside to your prim, because of the way 3d faces only face one side.
PRIM_SCULPT_TYPE_SPHERE is the default mode. You take your cylinder, and now the ends have stretchy bits that cover them. These pieces do not technically exist in your UV map, so in your texture...they also do not exist. They are beyond the bounds of the texturing you've done in Blender, and wrap from the other side of the texture. Add more data at the top and bottom of your sculpt map if you need these things to have something else! They also wrap sort of oddly, pulling all to one point, which is why generally it is a good idea to keep all the vertices on the poles clustered up into tiny little circles and manipulate the group as if they were single points, to minimize this distortion. Select a sculpty in edit mode in world, and in 90% of the cases you can see exactly how it's pulling the ends with a cluster of lines.
PRIM_SCULPT_TYPE_TORUS also started with the cylinder mapping, sides go to sides. Additionally, top edge goes straight down to meet bottom edge. There is less distortion here, as one vertex matches up with one vertex. However, the texturing rules still apply! Anything in between the vertices at the top and bottom is "dead" space to the way the texture is mapped, so either start out with a torus when you're sculpting and do the extra seaming, or keep this in mind!
default
{
state_entry()
{
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, "YOUR UUID HERE", PRIM_SCULPT_TYPE_SPHERE]);
}
}
Where PRIM_SCULPT_TYPE_SPHERE is changed to the type you need, and YOUR UUID HERE has been replaced with the UUID of your sculpt map (left click on the texture in inventory, Copy Asset UUID, Paste in script). After it's compiled, you can, and probably should, delete the script from the object's inventory.
PRIM_SCULPT_TYPE_PLANE maps as a plane. The edges do not connect in any way, it's one face and invisible from the back side. Your sculpt is a one sided piece of paper you've done your crumpling or origami to.
PRIM_SCULPT_TYPE_CYLINDER makes the UV map a tube. The sides wrap around and connect to each other. This is the first evidence of why it is 100% necessary to not end up with a sculpt map that's 90 degrees off, although it will screw you in all modes but plane. In cylinder, the top and bottom are open and do not connect to each other in any way, leaving an open hole on either end, through which you can look in and see that there is no inside to your prim, because of the way 3d faces only face one side.
PRIM_SCULPT_TYPE_SPHERE is the default mode. You take your cylinder, and now the ends have stretchy bits that cover them. These pieces do not technically exist in your UV map, so in your texture...they also do not exist. They are beyond the bounds of the texturing you've done in Blender, and wrap from the other side of the texture. Add more data at the top and bottom of your sculpt map if you need these things to have something else! They also wrap sort of oddly, pulling all to one point, which is why generally it is a good idea to keep all the vertices on the poles clustered up into tiny little circles and manipulate the group as if they were single points, to minimize this distortion. Select a sculpty in edit mode in world, and in 90% of the cases you can see exactly how it's pulling the ends with a cluster of lines.
PRIM_SCULPT_TYPE_TORUS also started with the cylinder mapping, sides go to sides. Additionally, top edge goes straight down to meet bottom edge. There is less distortion here, as one vertex matches up with one vertex. However, the texturing rules still apply! Anything in between the vertices at the top and bottom is "dead" space to the way the texture is mapped, so either start out with a torus when you're sculpting and do the extra seaming, or keep this in mind!
Texturing sculpts
Once you've sculpted your beautiful object, you may want to be able to texture it. The brilliant things about sculpties, is that unlike prims where you either have to recreate the object outside of SL or just have a really good idea of how things will map and hope you're right, you can paint directly onto your object in Blender. It's sex.
Once you've done your mapping and your sculpting, go to Texture Paint mode in the pane with your 3d object (assuming you work in the split 3d View/UV Image Editor with the bottom Buttons Window workspace that I find most useful). In the dropdown next to that, there's the view modes: choose Textured with the odd little nubby thing at the top, so you can see what's going on in your object. Select the entire thing with A, and in the texture view pane, create a new image. This one should be big! Bare minimum of 256x256- I generally work in 1024x1024 with the idea that I will scale it down to 512. I want it to be at least double size of the final product though, because I'm not so good at fine control, and really, shrinking down is always a good thing.
Warning: if you have only one face selected when you add this image, only the painting on that face will show! The rest just won't do anything! This can be useful when you, say, want to work with a cluster of faces and keep them separate from the rest of the object. This is not useful when you accidentally do it and can't figure out why the hell your painting isn't working except for one little square.
Unselect in the 3d view with A again, and your object should now be black, black as my soul, with grey lines denoting the faces. Your image should be similarly black, although without the grid. You can, at this point, just start doodling with the default paintbrush, which is rather large, and set to white. However! Hit F9 to be taken to the Object tool panel at the bottom, and there is a panel there, Paint, that gives you control over your brush! Opacity, mode, size, colour, etc, as well as a couple of different painting modes. Brush on your highlights and shadows! It's magic, not only does it show on your 3d model while you're painting, it also shows you exactly what section of the texture you're painting on. I still find I lack fine control, so I tend to do large markers for myself to use in Photoshop, and save off a number of layers (for instance, I do one image for shadows, another for highlights, in the black/white, and use Channels to pull out the stuff I want). Any time you want to use a new image, save your image off with a useful name, and create a new one in the Image menu of the texture pane again.
Another fun and easy cheat for basic shadows, is Ambient Occlusion. This will light your model with global lighting. Its results are very noisy and gritty, so you may want to do a bit of post processing, but it still gives you a quick and easy baseline that's great for some basic shadowing to start from.
Go back to UV Face Select mode, select all (A), and create a new image again. This also needs to be big really, again bare minimum of twice size (I generally use twice size, and then do a lot of smudging/blurring in PS to tone down the dirtiness). With all still selected, hit Ctrl-Alt-B, and choose Ambient Occlusion from the dropdown. It takes a bit to do all of its interpolation, and you can watch the image being build up in rows. If you've still got Textured selected on your 3d model, you can see exactly how the shades of grey are mapping to your model. Save that image off for use.
It is fully possible to do start to finish texturing in Blender- however I find the tools in PS are easier for me to use, due to familiarity, the vast toolset available there, and the fact I'm not having to worry about rotating a 3d object to get around it in the middle of what I'm doing. There are also a number of other texturing options available- setting up good lighting and doing a Full Render instead of the Ambient Occlusion, for instance, will get you more real baked lighting. Materials let you set things to have inherent reflectiveness for the lighting to play off of as well, so a really well textured shininess is not that difficult. But, these are things that have so far been beyond me- the lighting never seems to listen to me at all, and I ended up with crinkly cellophane looking highlights the time I tried to do a full render. I'm obviously missing a step somewhere, that I'll figure out eventually, once I decide I want something that I can't get otherwise.
You can also open images in the same menu where you create new ones, to do some of this stuff to an image you've already partially prepped (with, say, a pattern), as well as seeing how your current image will map once you've got all of your layers sorted (and paint directly on that, as well- with brush settings you can conceivably paint on some of your detail there).
Once you've done your mapping and your sculpting, go to Texture Paint mode in the pane with your 3d object (assuming you work in the split 3d View/UV Image Editor with the bottom Buttons Window workspace that I find most useful). In the dropdown next to that, there's the view modes: choose Textured with the odd little nubby thing at the top, so you can see what's going on in your object. Select the entire thing with A, and in the texture view pane, create a new image. This one should be big! Bare minimum of 256x256- I generally work in 1024x1024 with the idea that I will scale it down to 512. I want it to be at least double size of the final product though, because I'm not so good at fine control, and really, shrinking down is always a good thing.
Warning: if you have only one face selected when you add this image, only the painting on that face will show! The rest just won't do anything! This can be useful when you, say, want to work with a cluster of faces and keep them separate from the rest of the object. This is not useful when you accidentally do it and can't figure out why the hell your painting isn't working except for one little square.
Unselect in the 3d view with A again, and your object should now be black, black as my soul, with grey lines denoting the faces. Your image should be similarly black, although without the grid. You can, at this point, just start doodling with the default paintbrush, which is rather large, and set to white. However! Hit F9 to be taken to the Object tool panel at the bottom, and there is a panel there, Paint, that gives you control over your brush! Opacity, mode, size, colour, etc, as well as a couple of different painting modes. Brush on your highlights and shadows! It's magic, not only does it show on your 3d model while you're painting, it also shows you exactly what section of the texture you're painting on. I still find I lack fine control, so I tend to do large markers for myself to use in Photoshop, and save off a number of layers (for instance, I do one image for shadows, another for highlights, in the black/white, and use Channels to pull out the stuff I want). Any time you want to use a new image, save your image off with a useful name, and create a new one in the Image menu of the texture pane again.
Another fun and easy cheat for basic shadows, is Ambient Occlusion. This will light your model with global lighting. Its results are very noisy and gritty, so you may want to do a bit of post processing, but it still gives you a quick and easy baseline that's great for some basic shadowing to start from.
Go back to UV Face Select mode, select all (A), and create a new image again. This also needs to be big really, again bare minimum of twice size (I generally use twice size, and then do a lot of smudging/blurring in PS to tone down the dirtiness). With all still selected, hit Ctrl-Alt-B, and choose Ambient Occlusion from the dropdown. It takes a bit to do all of its interpolation, and you can watch the image being build up in rows. If you've still got Textured selected on your 3d model, you can see exactly how the shades of grey are mapping to your model. Save that image off for use.
It is fully possible to do start to finish texturing in Blender- however I find the tools in PS are easier for me to use, due to familiarity, the vast toolset available there, and the fact I'm not having to worry about rotating a 3d object to get around it in the middle of what I'm doing. There are also a number of other texturing options available- setting up good lighting and doing a Full Render instead of the Ambient Occlusion, for instance, will get you more real baked lighting. Materials let you set things to have inherent reflectiveness for the lighting to play off of as well, so a really well textured shininess is not that difficult. But, these are things that have so far been beyond me- the lighting never seems to listen to me at all, and I ended up with crinkly cellophane looking highlights the time I tried to do a full render. I'm obviously missing a step somewhere, that I'll figure out eventually, once I decide I want something that I can't get otherwise.
You can also open images in the same menu where you create new ones, to do some of this stuff to an image you've already partially prepped (with, say, a pattern), as well as seeing how your current image will map once you've got all of your layers sorted (and paint directly on that, as well- with brush settings you can conceivably paint on some of your detail there).
Sunday, December 16, 2007
Attachment makes with the animation
Ha, I suck. Posted this to the wrong journal first. Please forgive fashion planet, not that you're going to see this there.
This is a simple attachment triggers animation script (things like holding a stuffed animal, or other static thing...like the stocking). I have no idea where it came from, other than the huge bin of random free scripts. This has a timer built in, so if it gets broken, it will re-engage automatically. For use: place your animation (one only please!) into your object, and this script. Attach (or re-attach, as case may be), and things should be golden.
Note: dumping the llGetInventoryName(INVENTORY_ANIMATION,0) into a string variable will be more efficient...I think. But this way is easy and portable.
This is a simple attachment triggers animation script (things like holding a stuffed animal, or other static thing...like the stocking). I have no idea where it came from, other than the huge bin of random free scripts. This has a timer built in, so if it gets broken, it will re-engage automatically. For use: place your animation (one only please!) into your object, and this script. Attach (or re-attach, as case may be), and things should be golden.
Note: dumping the llGetInventoryName(INVENTORY_ANIMATION,0) into a string variable will be more efficient...I think. But this way is easy and portable.
default
{
attach(key id) {
if(id!=NULL_KEY) {
llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);
} else {
llSetTimerEvent(0.0);
if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
}
}
run_time_permissions(integer perms) {
if(perms) {
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
llSetTimerEvent(5.0);
}
}
timer() {
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
}
}
Tuesday, December 11, 2007
UV the easy way!
It took a bit of hunting (everyone seems to be linking to the Levitsky one in preference to anything else, and it _is_ the best thing out there to walk people who don't know Blender through out there), but I found a pre mapped sphere to download. After you've messed up your sphere, you just go baking when in UV Select mode (you may need to add a new image...I seem really good at managing to lose my images loaded. That's at least reasonably straightforward). Assuming you don't mind doing a bit of work _un_ sculpting, the Levitsky tutorial has the file at the bottom as well, so you can start with almost-a-cylinder that's pre-mapped. I think I found a clean cylinder base somewhere, but arsed if I can find where now.
This should get your map oriented the right way (and, one hopes, not inside out, since they changed the orientation necessary midway through development) so sides are sides and tops are tops, as well as skipping the beastly coord stage, which mostly just sucks with the power of a thousand suns.
Note: sculpt maps are most efficient (and, generally, successful) when the rainbow image map is 64x64, due to LOD and ceilings on vertices.
This should get your map oriented the right way (and, one hopes, not inside out, since they changed the orientation necessary midway through development) so sides are sides and tops are tops, as well as skipping the beastly coord stage, which mostly just sucks with the power of a thousand suns.
Note: sculpt maps are most efficient (and, generally, successful) when the rainbow image map is 64x64, due to LOD and ceilings on vertices.
Saturday, December 8, 2007
Network server stuff
Before I forget! That network vendor code. The forum post is about a concept that simply doesn't work in SL (who would pay 2L for a drink, nevermind a drink that you "finish" and kills itself?), but the posted code in response to the question is beautiful.
Things of MASSIVE NOTE. Do not, ever, take your server into your inventory. If you need to move it, select Wear from the pie menu and attach it to your bod, go where ever you need to, and Drop it. Do NOT detach. You need to keep it in world at all times, because the UUID will change otherwise, which means everything breaks. Everything. So, this is dangerous in a "shit. I got kicked from my land and everything returned to me" kind of way. Just like onRez vendors and such, it has to be existent in world to work- which means attaching it to yourself and wearing it only works so long as you are logged in. The onRez vendors get around the unique UUID thing, but they've also got waaaaay more of a backend, I'm sure it's to do with contacting the outside server, which keeps track of things and updates when necessary (I would assume SLX has the same general rules, but I've only the experience with onRez. No listing fees = love). This only contacts the one thing in world, so it needs to know how to find it, they use a proxy to filter through, I'm sure.
Also note: 2 code chunks here. First chunk = server. Second chunk = on touch give all items from server. This also needs a little modding to work, period, so don't just copypaste and expect magic to happen (it's just plugging in the UUID from yours in the client code though, assuming you want it to work as is). Thankfully it's actually a reasonably straightforward bit of code, other than all that bloody nesting for the item giving, that I ended up stripping out anyway.
Things of MASSIVE NOTE. Do not, ever, take your server into your inventory. If you need to move it, select Wear from the pie menu and attach it to your bod, go where ever you need to, and Drop it. Do NOT detach. You need to keep it in world at all times, because the UUID will change otherwise, which means everything breaks. Everything. So, this is dangerous in a "shit. I got kicked from my land and everything returned to me" kind of way. Just like onRez vendors and such, it has to be existent in world to work- which means attaching it to yourself and wearing it only works so long as you are logged in. The onRez vendors get around the unique UUID thing, but they've also got waaaaay more of a backend, I'm sure it's to do with contacting the outside server, which keeps track of things and updates when necessary (I would assume SLX has the same general rules, but I've only the experience with onRez. No listing fees = love). This only contacts the one thing in world, so it needs to know how to find it, they use a proxy to filter through, I'm sure.
Also note: 2 code chunks here. First chunk = server. Second chunk = on touch give all items from server. This also needs a little modding to work, period, so don't just copypaste and expect magic to happen (it's just plugging in the UUID from yours in the client code though, assuming you want it to work as is). Thankfully it's actually a reasonably straightforward bit of code, other than all that bloody nesting for the item giving, that I ended up stripping out anyway.
Server Code:
// Distributed item giver (I made it to use with my store landmarks, since I kept having to update multiple vendors)
// You do not need to change anything in this script, just put your items in the server prim that you want handed out when the "giver" prim is touched.
//
// NOTE: THE UUID OF THE SERVER MUST NEVER CHANGE! If it does you'll need to update ALL the child scripts. This means you can NEVER pickup the server prim.
// A simple way to move the server is to right-click the prim, and select "wear", "right hand",
// proceed to teleport or fly to your new location, right-click the prim again and select "DROP",
// (NOT DETACH! if you detach it will move into your inventory and the unique UUID will be lost)
//
// Lasivian Leandros
string gServerKey = "";
list inventory_types = [INVENTORY_BODYPART,INVENTORY_CLOTHING,INVENTORY_LA NDMARK,INVENTORY_NOTECARD,INVENTORY_OBJECT,INVENTO RY_SCRIPT,INVENTORY_SOUND,INVENTORY_TEXTURE];
integer j;
integer k;
integer type;
integer typecount;
string objectname;
default
{
on_rez(integer i)
{
llResetScript();
}
state_entry()
{
gServerKey = llGetKey();
llSetObjectDesc(gServerKey);
llSetText(llGetObjectName() + "\n Key: "+ gServerKey,<0,1,0>,1.0);
llSetTimerEvent(2.5); // I would not speed this up beyond one e-mail check per 2.5 seconds, it's laggy enough as it is.
}
touch_start(integer total_number)
{
gServerKey = llGetKey();
llSetText(llGetObjectName() + "\n Key: "+ gServerKey,<0,1,0>,1.0);
llInstantMessage(llDetectedKey(0), "Update Server Key is: " + gServerKey);
}
email(string time, string address, string subj, string message, integer num_left)
{
key target = subj;
// This allows you to test the system without getting all the junk it's setup to give out
if (target == llGetOwner())
{
llOwnerSay("Touch received on a client prim from you.");
//return; // If you want to get copies of the given items yourself uncomment this line
}
integer total_number = 1;
//gMessageList = llParseString2List(message, ["\n", "Object-Name: ", " Update", " System"], []);//Break up the content of the e-mail.
integer i;
for (i=0;i < total_number;i++)
{
integer inventory_count = llGetListLength(inventory_types);
string myname = llGetScriptName();
for (j=0; j < inventory_count;j++)
{
type = llList2Integer(inventory_types,j); // get the next inventory type from the list
typecount = llGetInventoryNumber(type); // how many of that kind of inventory is in the box?
if (typecount > 0)
{
for (k=0; k < typecount;k++)
{
objectname = llGetInventoryName(type,k);
if (objectname != myname) // don't give self out so the user doesn't get fifty thousand copies.
{
llGiveInventory(target,objectname);
}
}
}
}
}
}
timer()
{
llGetNextEmail("", ""); // check for email with any subject/sender
}
}
Client Code:
//This half the the setup is dead simple, it just sends the key of the person that touched the prim this script is in off to the server, which then distributes the items inside it.
string gTargetKey = ""; // Update this with the UUID of your server prim.
//string gTargetKey = "b041bc00-3d6a-41f7-f65d-81aa36093fca"; //uncomment out this line to see how it should work if you're having trouble with your own.
default
{
touch_start(integer total_number)
{
llEmail(gTargetKey + "@lsl.secondlife.com", llDetectedKey(0), "");
}
}
Antlers!
I'm still fighting with Blender, right now my problem is due to not really know _how_ to make the thing that's top priority right now. It's not a fine control issue (it's a simple thing! It doesn't actually need much, it just needs the right not much!), it's entirely a "oh, hey, I...don't even know how to make that look like what it's supposed to" (and texturing is even worse). Bah! I'll get there.
But anyway! Last night I made some antlers to go in the stocking that, if I can get the aforementioned stone out of my shoe, will be released sometime next week, fingers crossed. And by "some" I mean a crapton of colour variants. But, just two types. I learned how to do servery things (way easier than I thought, although some potential for danger and destroying the whole system), which NO ONE EVER TALKS ABOUT. Seriously, it's like it's some desperately guarded secret (because, well, people charge massive amounts for networked vendors, and this is part of how they work. Still, LAME). I've got to snag the code off the forum post and put it here for future reference. I've of course added lots of crap particular to my needs to it (including a "ok, you're this call? Well then, you only send one of these items" so I can have just _one_ thing obsessively checking its email, since again, they do things the opposite of the way I think they ought to be done).
First! The antlers alone- although only versions with stuffs on them are going in the stocking (I love this first picture, and may knock out the background sometime). These are not your girlie understated little antlers, these are antlers for goring people and fighting over mates! It should be reasonably apparent I have a fetish for curlies.
The last two pictures obviously taken in Le Zoo. I sort of love Le Zoo, but on the other hand it just...could be better. I think I'm a little disappointed by only 4 enclosures, not a single bat I could find in the batcave, and the shops mostly just aren't integrated at all (Chapeau, however, with the rhino- beautiful). I still wouldn't mind trying to get a shop there (I'm not optimistic about said possibility), but I'd be likely to blow my prim allotment on rusty old cages. I'm also very torn on the animals- prinimals do get around the "well then, sculpts killed the framerate" but sculpties would make far more impressive animals- especially in some cases. They move though, which I only noticed spending time there taking photos, which is awesome.
The antlers of course come in brown as well. I just...don't do brown. Also, the coat in the pictures will be released in the upcoming week, if all goes well and I finish taking the photos and dropkick it all into Photoshop:
(It's again with my stealth spookiness. It's named the NosferCoat, because it's inspired by the coat worn in Nosferatu. I'm making up a creepshape to take some pictures of it in...although I may decide that's a little too out there for the fashiony set. The first run is 5 dark and semi drab colours, the red is the brightest, but I'm considering a second set of brighter, I have a purple and a green in my head that might be pretty.)
The scarf in the couple of pics is currently sitting in one of the packages under the tree, free for warming your avatar, as is the little tiny black snowflake earring you can kind of see in the photo with the lion. Emee's talked me into selling the boots, another "in this upcoming week," I hope. The necklace...eventually. I've got to resize everything all over again, and it was a pain in the ass the first time (5 sizes I think?), and design my damn HUD, because I suck and can't figure out what it ought to look like.
I splurged a couple of nights ago on Miriel eyes (splurged? They're pretty cheap, really. Got a 4 pack I've been considering for a Very Long Time, long pre September and the Jewelry Expo). I had mostly been hesitant because I've gotten so used to Allegory's bright ass eyes, but it turns out they're tintable! So I was filled with glee. I love these eyes, and got just about everything I wanted in one little pack (Luminous I, which means I've got better purple eyes for shop pics, because I'm a wierdo, and a lovely monochromatic set for funtimes. I suppose _sometime_ I'll find a reason to wear the blue, but they were free anyway). The Eclipse are still a bit tempting as well, I'll have to see what I think about the grey sometime.
But anyway! Last night I made some antlers to go in the stocking that, if I can get the aforementioned stone out of my shoe, will be released sometime next week, fingers crossed. And by "some" I mean a crapton of colour variants. But, just two types. I learned how to do servery things (way easier than I thought, although some potential for danger and destroying the whole system), which NO ONE EVER TALKS ABOUT. Seriously, it's like it's some desperately guarded secret (because, well, people charge massive amounts for networked vendors, and this is part of how they work. Still, LAME). I've got to snag the code off the forum post and put it here for future reference. I've of course added lots of crap particular to my needs to it (including a "ok, you're this call? Well then, you only send one of these items" so I can have just _one_ thing obsessively checking its email, since again, they do things the opposite of the way I think they ought to be done).
First! The antlers alone- although only versions with stuffs on them are going in the stocking (I love this first picture, and may knock out the background sometime). These are not your girlie understated little antlers, these are antlers for goring people and fighting over mates! It should be reasonably apparent I have a fetish for curlies.
The last two pictures obviously taken in Le Zoo. I sort of love Le Zoo, but on the other hand it just...could be better. I think I'm a little disappointed by only 4 enclosures, not a single bat I could find in the batcave, and the shops mostly just aren't integrated at all (Chapeau, however, with the rhino- beautiful). I still wouldn't mind trying to get a shop there (I'm not optimistic about said possibility), but I'd be likely to blow my prim allotment on rusty old cages. I'm also very torn on the animals- prinimals do get around the "well then, sculpts killed the framerate" but sculpties would make far more impressive animals- especially in some cases. They move though, which I only noticed spending time there taking photos, which is awesome.
The antlers of course come in brown as well. I just...don't do brown. Also, the coat in the pictures will be released in the upcoming week, if all goes well and I finish taking the photos and dropkick it all into Photoshop:
(It's again with my stealth spookiness. It's named the NosferCoat, because it's inspired by the coat worn in Nosferatu. I'm making up a creepshape to take some pictures of it in...although I may decide that's a little too out there for the fashiony set. The first run is 5 dark and semi drab colours, the red is the brightest, but I'm considering a second set of brighter, I have a purple and a green in my head that might be pretty.)
The scarf in the couple of pics is currently sitting in one of the packages under the tree, free for warming your avatar, as is the little tiny black snowflake earring you can kind of see in the photo with the lion. Emee's talked me into selling the boots, another "in this upcoming week," I hope. The necklace...eventually. I've got to resize everything all over again, and it was a pain in the ass the first time (5 sizes I think?), and design my damn HUD, because I suck and can't figure out what it ought to look like.
I splurged a couple of nights ago on Miriel eyes (splurged? They're pretty cheap, really. Got a 4 pack I've been considering for a Very Long Time, long pre September and the Jewelry Expo). I had mostly been hesitant because I've gotten so used to Allegory's bright ass eyes, but it turns out they're tintable! So I was filled with glee. I love these eyes, and got just about everything I wanted in one little pack (Luminous I, which means I've got better purple eyes for shop pics, because I'm a wierdo, and a lovely monochromatic set for funtimes. I suppose _sometime_ I'll find a reason to wear the blue, but they were free anyway). The Eclipse are still a bit tempting as well, I'll have to see what I think about the grey sometime.
Sunday, December 2, 2007
Mirror mirror on the wall
Unfortunately the new way of mapping gets me an inside out object often (ALWAYS PREVIEW YOUR SCULPTS BEFORE UPLOADING! Even if you don't upload them through SL's interface), which means the image needs to be flipped horozontal in post. SL just sometimes get confused what's an inside and what's an outside, since it only textures on one side of the face. (Of course, say you want an inside out texture for a bottle or balloon or something, flip a right side out sculpt map horozontal to get it inside out.)
Mirroring the actual object can be done in Blender as well- ctrl-alt-M if I recall correctly. However it can also be done in post! Assuming you have an image editor that divides up the colour channels, invert the red channel (note: this mirrors on the x axis. Invert one of the other channels to mirror along their axes instead), and then flip the whole thing horozontal (this is to make it not be inside out, and assumes that the before copy wasn't inside out either- to un-inside out something, flip the whole thing horozontal). If your sculpt is inside out, flip it back horozontal.
Mirroring the actual object can be done in Blender as well- ctrl-alt-M if I recall correctly. However it can also be done in post! Assuming you have an image editor that divides up the colour channels, invert the red channel (note: this mirrors on the x axis. Invert one of the other channels to mirror along their axes instead), and then flip the whole thing horozontal (this is to make it not be inside out, and assumes that the before copy wasn't inside out either- to un-inside out something, flip the whole thing horozontal). If your sculpt is inside out, flip it back horozontal.
Saturday, December 1, 2007
Hurdles
So, after finding just the right search terms, I found this (+100 points for the Strangelove reference), which explains how to unwrap _after_ you've done your sculpting (which was the deal).
In text only, with no helpful images like the other people (and I'll be checking this through next time to make sure I haven't missed a step, so approach with caution now, also note that this assumes you've gotten this far on your own, refer to the others for more helpful stuff. This is really just so I have something if they go poof):
Prep model for mapping. If you've got a mesh, make sure you've marked your seams (Edit Mode, select 2 points in the loop you want, ctrl-E, Select Edge Loop, ctrl-E, Mark Seam). It has to unwrap to a square, so you need good edges. You _can_ kill sphere end points after it's UV mapped (and any other niggling things that muck up your nice square grid, if necessary. Finding them can be annoying with the way modes work.)
UV mapping:
Window with object: UV Face Select. Second window: UV/Image Editor
In UV Face Select pane, hit A (select all), hit U, select Project from View (Bounds). This presents you with something fucking terrifying, and my problem before.
Select a face in UV Face Select mode, hit A twice to select all. Hit U, choose Follow Active (Quads)->None. Still a mess, but better. In the UV/Image Editor pane, select Quads Constrained Rectangular from the UVs menu. You _may_ need to hit A on your UV map, and G to move it a little, to get it to pay attention to the next step, it doesn't always unmap properly unless you've reminded it. Back to UV Face Select window, hit U, Follow Active (Quads)->None again. If all has gone well, it's all rectangular!
If you mapped a cylinder first, then sculpted (as in this tutorial), you won't need to force it to be rectangular repeatedly.
Use S (scale, if you hit Y or X after S you can scale in just one direction) and G (move) with A (all) selected to scale and move it within the bounds. In the UVs menu, Layout Clipped to Image size will eventually help.
In Image menu, add new, 64 by 64. (Note: if your model isn't that size with vertices exactly, you may need to burn that larger and shrink down. I had a 63x64 due to miscalculation that worked perfectly when a 256 square was shrunk down, but had white lines at 64).
Note: There is a possibility, depending on how you've gotten your edges together, that the UV map will be at 90 degrees to where it ought to be. Tick off Quads Restrained Rectangular (important! It does nasty bad things if it's still on), select all (A) your grid mesh, and type in R (rotate) and 90 to rotate things nice and easy (you can do this later and rebake the UV map if necessary, since you've set up everything to make it happy to rebake at any time).
Texture mapping:
F5 selects the Shading panel, Materials. In Material, Add New under Links and Pipeline. Things change drastically. Click Texface on in the new Material pane.
Either add 3 textures here under Texture (Add new), or add them in the F6 window (it makes no nevermind, but you have to go to F6 next- Shading, Texture). At each of the 3 textures, set Texture Type to Blend.
Hit F5 to go back to the Materials panel, and in the Texture menu, select the first texture button. Change Map Input to X, blank, blank (vertical); and Map To Red 1.0, Green 0.0, Blue 0.0; select Add from the dropdown. Second texture is Map Input to Y, blank, blank (vertical); and Map To Red 0.0, Green 1.0, Blue 0.0; select Add from the dropdown. Third is Map Input to Z, blank, blank (vertical); and Map To Red 0.0, Green 0.0, Blue 1.0; select Add from the dropdown.
In other words: all textures set to Add. Texture one is the X coords, which stores info in Red channel, two is Y coords in Green, and three is Z coords in Blue. The 2nd and 3rd coord space in each is blank because we're separating out each coord to be translated into colourspace.
Switch to Scene->Render with F10, Choose Bake, click on Textures, and hit the button. If your texture is predominantly white! go back to F5 and make sure you've selected Texface!! I always forget that. If it isn't shiny happy rainbow but has too much white or black, something Bad happened. You can add a new Image texture at any point, and overwrite existings if something goes wrong. However, in theory you have a psychadelic rainbow, so Save the targa in the Image menu in UV/Image mode.
Texture Painting:
Add a new Image in the UV/Image pane, make this one larger (256, 512, whatever. I usually go 1024, so I can shrink down later). Switch the pane with UV Face Select to Texture Paint. Start doodling, and go wheeee! In Panels, hit F9 (Editting), and adjust your brush in Paint. Save your image off once you're done. I only do certain things with this, then bring lots of layers into PS to make things happy and pretty- however, there is a lot you can do here, including texture the model entirely in Blender if you have the stomach for figuring it all out.
Baking up bits that Blender sets up for you can also be really useful. Add a new image in the UV/Image mode. Go back to UV/Face Select mode in the other window, select all, hit ctrl-alt-B and choose from the menu of baking choices. If you can set up nice lighting, you can do some pretty fancy stuff here. Although sometimes it looks like saran wrap and is all crinkly. Ambient Occlusion can give some basic depth.
In text only, with no helpful images like the other people (and I'll be checking this through next time to make sure I haven't missed a step, so approach with caution now, also note that this assumes you've gotten this far on your own, refer to the others for more helpful stuff. This is really just so I have something if they go poof):
Prep model for mapping. If you've got a mesh, make sure you've marked your seams (Edit Mode, select 2 points in the loop you want, ctrl-E, Select Edge Loop, ctrl-E, Mark Seam). It has to unwrap to a square, so you need good edges. You _can_ kill sphere end points after it's UV mapped (and any other niggling things that muck up your nice square grid, if necessary. Finding them can be annoying with the way modes work.)
UV mapping:
Window with object: UV Face Select. Second window: UV/Image Editor
In UV Face Select pane, hit A (select all), hit U, select Project from View (Bounds). This presents you with something fucking terrifying, and my problem before.
Select a face in UV Face Select mode, hit A twice to select all. Hit U, choose Follow Active (Quads)->None. Still a mess, but better. In the UV/Image Editor pane, select Quads Constrained Rectangular from the UVs menu. You _may_ need to hit A on your UV map, and G to move it a little, to get it to pay attention to the next step, it doesn't always unmap properly unless you've reminded it. Back to UV Face Select window, hit U, Follow Active (Quads)->None again. If all has gone well, it's all rectangular!
If you mapped a cylinder first, then sculpted (as in this tutorial), you won't need to force it to be rectangular repeatedly.
Use S (scale, if you hit Y or X after S you can scale in just one direction) and G (move) with A (all) selected to scale and move it within the bounds. In the UVs menu, Layout Clipped to Image size will eventually help.
In Image menu, add new, 64 by 64. (Note: if your model isn't that size with vertices exactly, you may need to burn that larger and shrink down. I had a 63x64 due to miscalculation that worked perfectly when a 256 square was shrunk down, but had white lines at 64).
Note: There is a possibility, depending on how you've gotten your edges together, that the UV map will be at 90 degrees to where it ought to be. Tick off Quads Restrained Rectangular (important! It does nasty bad things if it's still on), select all (A) your grid mesh, and type in R (rotate) and 90 to rotate things nice and easy (you can do this later and rebake the UV map if necessary, since you've set up everything to make it happy to rebake at any time).
Texture mapping:
F5 selects the Shading panel, Materials. In Material, Add New under Links and Pipeline. Things change drastically. Click Texface on in the new Material pane.
Either add 3 textures here under Texture (Add new), or add them in the F6 window (it makes no nevermind, but you have to go to F6 next- Shading, Texture). At each of the 3 textures, set Texture Type to Blend.
Hit F5 to go back to the Materials panel, and in the Texture menu, select the first texture button. Change Map Input to X, blank, blank (vertical); and Map To Red 1.0, Green 0.0, Blue 0.0; select Add from the dropdown. Second texture is Map Input to Y, blank, blank (vertical); and Map To Red 0.0, Green 1.0, Blue 0.0; select Add from the dropdown. Third is Map Input to Z, blank, blank (vertical); and Map To Red 0.0, Green 0.0, Blue 1.0; select Add from the dropdown.
In other words: all textures set to Add. Texture one is the X coords, which stores info in Red channel, two is Y coords in Green, and three is Z coords in Blue. The 2nd and 3rd coord space in each is blank because we're separating out each coord to be translated into colourspace.
Switch to Scene->Render with F10, Choose Bake, click on Textures, and hit the button. If your texture is predominantly white! go back to F5 and make sure you've selected Texface!! I always forget that. If it isn't shiny happy rainbow but has too much white or black, something Bad happened. You can add a new Image texture at any point, and overwrite existings if something goes wrong. However, in theory you have a psychadelic rainbow, so Save the targa in the Image menu in UV/Image mode.
Texture Painting:
Add a new Image in the UV/Image pane, make this one larger (256, 512, whatever. I usually go 1024, so I can shrink down later). Switch the pane with UV Face Select to Texture Paint. Start doodling, and go wheeee! In Panels, hit F9 (Editting), and adjust your brush in Paint. Save your image off once you're done. I only do certain things with this, then bring lots of layers into PS to make things happy and pretty- however, there is a lot you can do here, including texture the model entirely in Blender if you have the stomach for figuring it all out.
Baking up bits that Blender sets up for you can also be really useful. Add a new image in the UV/Image mode. Go back to UV/Face Select mode in the other window, select all, hit ctrl-alt-B and choose from the menu of baking choices. If you can set up nice lighting, you can do some pretty fancy stuff here. Although sometimes it looks like saran wrap and is all crinkly. Ambient Occlusion can give some basic depth.
Subscribe to:
Posts (Atom)