Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Making alpha textures for hair -- getting stray specks of texture

Freyja Nemeth
Registered User
Join date: 3 Jun 2007
Posts: 117
10-01-2007 00:51
I've been playing around with making alpha textures for hair to use in making flexicurls, but I keep running into an a problem I can't quite diagnose. More often than not, the hairs end up having tiny, tiny specks of the texture showing up roughly where the outer corner of the prims are.

It is almost as if a bit of texture wraps around from one edge to the other. Or is it something else? Can it be avoided by making the textures or the prims in a certain way? What I have done with the textures is to leave a 1 pixel margin all around, but that doesn't seem to do it.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
10-01-2007 07:19
From: Freyja Nemeth
It is almost as if a bit of texture wraps around from one edge to the other.

You guessed it. That's exactly what's happening. SL does not have the ability to clamp textures. It tries to tile everything, so you'll always see a little bit the left edge bleeding in on the right, a bit of the top bleeding in on the bottom, etc. It's more noticeable when it effects transparency than anything else, but it happens with everything.

To prevent seeing the problem, you were on the right track. There are two ways to go:

1. Give your image a completely uniform border so that the bleeding doesn't matter. In your case, that would mean a transparent border. You'll need more than one pixel though. Try it with at least 3. If your texture is large, you may need more.

-OR-

2. Set the repeats per face to .995 instead of 1. This will usually obscure the bleed area altogether.
_____________________
.

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.
Freyja Nemeth
Registered User
Join date: 3 Jun 2007
Posts: 117
10-01-2007 08:22
Thank you, that should help me get a handle on this. :)

Btw, when you say it might need more of a border than 3 if the texture is large, how large are we talking? In your experience, what's a good border amount for 512 by 512, for example?
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
10-01-2007 08:59
Since a .995 repeat usually obscures the bleed, I'm guessing that .5% of the texture is the bleed area. Make your border cover that amount, and I think it will be fine. I'm not in-world right now to test though.
_____________________
.

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.
Freyja Nemeth
Registered User
Join date: 3 Jun 2007
Posts: 117
10-01-2007 09:03
Okay, will play around with that.

I did a quick test with retexturing a hair I had bought with one of my textures, and there I found that the repeats were already set surprisingly low, 0.010 both ways, but the specks were still happening. Not sure if there's perhaps some special trick involved in how to setup these kinds of hair textures.

Does it matter, btw, if textures are 128/256/512/etc or can they be something entirely different, like 520? Figured it might be easier to just expand the canvas instead of redrawing my texture to get the border.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
10-01-2007 09:38
From: Freyja Nemeth
I did a quick test with retexturing a hair I had bought with one of my textures, and there I found that the repeats were already set surprisingly low, 0.010 both ways, but the specks were still happening. Not sure if there's perhaps some special trick involved in how to setup these kinds of hair textures.

Hmm. Maybe we're talking about two different things then. Post a screenshot maybe?

From: Freyja Nemeth
Does it matter, btw, if textures are 128/256/512/etc or can they be something entirely different, like 520?

If it's not a power of two, SL will reize it at the time of upload. 520 would become 512. The problem is SL doesn't do that great of a job of it, visually. It's much better to size it correctly in Photoshop before uploading.

From: Freyja Nemeth
Figured it might be easier to just expand the canvas instead of redrawing my texture to get the border.

You shouldn't have to recreate anything. Here are three possible ways to go:

1. Upsize the canvas to 520 and then downsize the whole image back to 512.

-OR-

2. Sscale contents of the image down a little without ever changing the size of the canvas.

-OR-

3. Don't bother resizing at all. Simply paint a black border onto the alpha channel. That will give the image a transparent border.
_____________________
.

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.
Freyja Nemeth
Registered User
Join date: 3 Jun 2007
Posts: 117
10-01-2007 09:59
From: Chosen Few
Hmm. Maybe we're talking about two different things then. Post a screenshot maybe?


Looks like this was due to there being a mix of prims in the selection, with different repeats sets. :)

From: Chosen Few

If it's not a power of two, SL will reize it at the time of upload. 520 would become 512. The problem is SL doesn't do that great of a job of it, visually. It's much better to size it correctly in Photoshop before uploading.


Ah, okay. :)

I'll have to see if I can find a good method of changing the size that doesn't change what the texture looks like, since I need to be able to scale down both the actual texture and the alpha channel that goes with it. Shrinking the image first and creating a new alpha channels leads to a lot of loss of definition at the edges whenever I try that (may be a PSP quirk).