Can textures be generated randomly in game?
|
Rook Inventor
Registered User
Join date: 11 Mar 2009
Posts: 22
|
03-26-2009 14:48
Is there a way to generate simple patterns in game randomly? Say I wanted to make tie dye shirts and have no two shirts the same? What I'm really looking for is a way for the user to set parameters like color and splotch size etc and then have the texture generate randomly.
Alternatively, is there a way to load a large texture but mapping only a random portion of it. This would give the illusion of two different patterns.
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
03-26-2009 16:31
You can always put several textures in a single large one and then use llSetTextureAnim to change from one to another. See  . Unfortunately, doing that for the texture on a shirt is going to be VERY difficult, if not impossible, since the template for a shirt is scaled to the avatar body. Still, in general, that's how you change textures on objects in world.
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
03-26-2009 17:44
Interesting idea, but unfortunately it can't be done. First, clothing can't be scripted, so there's no way to get it to respond to commands. Second, SL has no ability to create textures. All images must be created externally, and then imported.
You could potentially fake it by putting a translucent surface over an opaque one, and then using offsets and color changes to somewhat vary the combined appearance of the two. But the object would be rigid, so it wouldn't behave like a shirt. If you want tie-died armor plates, then maybe, but a realistic looking shirt is out of the question.
Another option could be to put the texture generation sequence on a website somewhere. Instead of buying an actual shirt from you, people could buy a login to your site. They could then use your software to generate their texture and upload it to SL, and then from there they could apply it to a shirt themselves.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
|
03-26-2009 18:48
You could do some further tests, but i've noticed that if you use the lands media texture as your skin texture and you have a media set to play, you end up with what ever was on the screen when you close the editor. IDK if that's any help or if it persists between logins and TPs or avatar changes. Its just a thought.
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
|
Rook Inventor
Registered User
Join date: 11 Mar 2009
Posts: 22
|
03-27-2009 05:47
The tie dye shirt was just an example. I actually have a different project in mind. The textures will be used on simple prim objects. Chosen Few, you gave me an idea on how I can accomplish what I want with semi translucent textures.
My next question is.... Say I want to be able to change textures at different times. Going back to the shirt example. Say I have a shirt texture with stripes, one with polka dots, and one with checkered patterns. If the user wanted stripes, his shirt would change etc. Do all these textures need to be stored in the prim object.... I know a shirt isn't a prim... But where are the textures stored? Can I upload 100 textures and let the user of the object call them from a library somewhere or do all 100 textures need to be loaded on the object?
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
03-27-2009 07:48
From: Rook Inventor My next question is.... Say I want to be able to change textures at different times. Going back to the shirt example. Say I have a shirt texture with stripes, one with polka dots, and one with checkered patterns. If the user wanted stripes, his shirt would change etc. Do all these textures need to be stored in the prim object.... I know a shirt isn't a prim... But where are the textures stored? Can I upload 100 textures and let the user of the object call them from a library somewhere or do all 100 textures need to be loaded on the object? You're right, a shirt is not a prim. It's a texture. That's all it is. The special character of a shirt (or any other article of standard (non-prim) SL clothing is that it is "worn" by applying the texture to the avatar body. The texture resides in your inventory (that is, on an asset server) and your av body is textured by reference to the texture's UUID. The reason you can't do as you suggest is that each shirt is a different texture. If you want a customer to have several different versions of a shirt, with different colors, patters, or whatever, you may create them and sell them as a package. The customer may pick and choose from the package to decide what to wear, but can't wear them all at once. The avatar body cannot "store" a texture it isn't wearing at the moment.
|
Rook Inventor
Registered User
Join date: 11 Mar 2009
Posts: 22
|
03-27-2009 10:13
Ok say it wasn't a shirt. Say I created a "magic beach ball" it's just a simple sphere with a star pattern texture on it. Now say it was St Patricks day. You say to the ball Shamrock, and the ball instantly changes from red to green and the stars become shamrocks. I think I know how to do it by making a giant texture with stars and shamrocks and other textures then mapping only a portion of that texture to the ball, but what if I wanted 100 possibilities? I'm sure there is a size limit to the texture. Can the ball grab a texture from another object? I'm just trying to figure out a way to have my magic beach ball have many texture possibilities.
|
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
|
03-27-2009 10:25
From: Rook Inventor Ok say it wasn't a shirt. Say I created a "magic beach ball" it's just a simple sphere with a star pattern texture on it. Now say it was St Patricks day. You say to the ball Shamrock, and the ball instantly changes from red to green and the stars become shamrocks. I think I know how to do it by making a giant texture with stars and shamrocks and other textures then mapping only a portion of that texture to the ball, but what if I wanted 100 possibilities? I'm sure there is a size limit to the texture. Can the ball grab a texture from another object? I'm just trying to figure out a way to have my magic beach ball have many texture possibilities. This one's easy. You can just pass a UUID of a texture to llSetTexture. You can easily create 100 or more textures and pick one based on some criteria. You don't even need to put them in the object, just put the UUIDs in the script. It could even be dynamic, but that would require a little more programming.
_____________________
Visit ChereeMotion - Life's Best Pinup Poses http://slurl.com/secondlife/Wild%20Rice/38/230/51
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
03-27-2009 10:44
From: Cheree Bury This one's easy. You can just pass a UUID of a texture to llSetTexture. You can easily create 100 or more textures and pick one based on some criteria. You don't even need to put them in the object, just put the UUIDs in the script. It could even be dynamic, but that would require a little more programming. Exactly. One way to do the "little more programming" is what I suggested in my first response. .... combine many textures into a single one and rotate through them with llSetTextureAnim. Another would be to write a script that displays a dialog box and asks the user to pick among textures saved in the prim's contents. In either case, it's a straightforward bit of scripting. In addition to the link I gave you earlier, take a look at  or perhaps modify the sample script at  , which uses a very different approach. There are many ways to do what you want, so long as you don't want to do it to textures on an avatar. ETA: BTW, take some time to read the sticky thread on Texture Sizes, etc. at the top of this forum before you go much farther. I suspect that some of the questions that are lurking in your mind will be answered there.
|
Rook Inventor
Registered User
Join date: 11 Mar 2009
Posts: 22
|
03-27-2009 11:08
OK thanks for all the input. I'll take a look at the links when I get home, but your responses have me thinking on the right track.
|
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
|
04-03-2009 06:34
From: Rook Inventor Ok say it wasn't a shirt. Say I created a "magic beach ball" it's just a simple sphere with a star pattern texture on it. Now say it was St Patricks day. You say to the ball Shamrock, and the ball instantly changes from red to green and the stars become shamrocks. I think I know how to do it by making a giant texture with stars and shamrocks and other textures then mapping only a portion of that texture to the ball, but what if I wanted 100 possibilities? I'm sure there is a size limit to the texture. Can the ball grab a texture from another object? I'm just trying to figure out a way to have my magic beach ball have many texture possibilities. hmm, for an instance like that, I'd make nested balls and utilize alpha textures. Like alpha-star-alpha as an optional texture on the outer most sphere. That way you can swap shapes without changing the inner layers.
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
|
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
|
04-03-2009 09:15
From: Zen Zeddmore hmm, for an instance like that, I'd make nested balls and utilize alpha textures. Like alpha-star-alpha as an optional texture on the outer most sphere. That way you can swap shapes without changing the inner layers. Agreed. That would be like the furry avatars that allow you to change eye color on command. The outer shell has an alpha texture that shows through to an inner surface with the iris color. Can only nest two like that, though, since two alpha textures and a solid inside would have the alpha sort glitch issues. But yeah... Outer shell is outer colors with perforations for symbol shapes, and inner shell is color for the symbols, and could just as easily be a texture as a solid color.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
04-03-2009 09:45
Cool! I haven't ever paid attention to those, Ceera, but it sounds like an elegant idea. So, you write a script that lets you change the color (or texture) of either ball, giving you a much larger number of possible combinations than you'd get if you just swapped around a single list of UUIDs. I like it. 
|
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
|
04-03-2009 11:12
Yes. And on most furries, they use a partial sphere behind each eye, so you can control each eye individually.
Extrapolating:
The top layer could have a variety of different shaped "cut outs" like hearts, shamrocks, diamons, or a complex texture with just some parts transparent, the cut out areas being 100% alpha, arranged in a grid.
The layer below could be a grid of prims, each scripted to display a number of different 24-bit textures and/or solid colors.
Certainly has some possibilities...
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
04-03-2009 11:33
Indeed! I was thinking about possibilities for signage. You might have a background prim that holds a variety of standard images (frames, logos, decorative dingbats, whatever) and a foreground prim that you use for dropping postable notices on (opaque lettering, transparent elsewhere). For the artistically-challenged user, that would be the equivalent of having a choice of clip art backgrounds or pre-printed letterheads to write on.
|