Jump to content

Are There in-World Differences When Different Methods Are Used to Make Prims Semi-Transparent?


Recommended Posts

I want to make a semi-transparent prim---think stained-glass window. It occurred to me that there are two ways to do it. One it to upload a semi-transparent texture, which I might have to do repeatedly to get just the appearance I want. the other is to upload an opaque texture and use the transparency adjustment in the prim editor to make it semi-transparent, which would be easier and quicker to get exactly right.

Would there be any difference in the result from the two methods?

Link to comment
Share on other sites

One obvious difference is that you can't use the transparency slider to make parts of a texture transparent (like the glass, but not the lead lines in a stained glass window).  It's all or nothing.  Another is that once you have uploaded a texture that is semi-transparent, you cannot make it more opaque.  That could be an advantage or a disadvantage, depending on how you plan to use it.  Yet another is that a texture with any transparency is uploaded as a 32-bit image rather than a 24-bit one, so it expects the user's graphic card to use more memory.  A 24-bit image can still be made semi-transparent with the slider, though.

BTW, you don't have to keep uploading trial versions to get the transparency right.  You can always use the Local Textures option. 

Edited by Rolig Loon
  • Like 4
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Rolig Loon said:

One obvious difference is that you can't use the transparency slider to make parts of a texture transparent (like the glass, but not the lead lines in a stained glass window).  It's all or nothing.  Another is that once you have uploaded a texture that is semi-transparent, you cannot make it more opaque.  That could be an advantage or a disadvantage, depending on how you plan to use it.  Yet another is that a texture with any transparency is uploaded as a 32-bit image rather than a 24-bit one, so it expects the user's graphic card to use more memory.  A 24-bit image can still be made semi-transparent with the slider, though.

BTW, you don't have to keep uploading trial versions to get the transparency right.  You can always use the Local Textures option. 

Thanks for a very helpful answer.

  • Like 1
Link to comment
Share on other sites

one other thing here - alpha blending and z-fighting.

A texture with no alpha channel set partially transparent by the transparency slider will still have alpha mode "none" and doesn't z-fight with other partially transparent objects.

A texture with partial transparency in the alpha channel and alpha mode set to blending WILL. This causes unpredictable rendering artefacts.

You can avoid this by using masking as the alpha mode but then that means everything will be either COMPLETELY transparent or not transparent at all. This would seem to preclude it being used for a partially transparent situation like a stained glass window. HOWEVER, there is an old technique that can be of value to you here. It's called halftoning.

This technique originated in printing, particularly for newspapers, where the impression of a greyscale image was created by using a matrix of black dots of varying size to simulate the greys. On a newspaper printed by the old hot-metal process the dots were quite large, you didnt even need a magnifying glass to see them, only to look fairly close. On a 1024x1024 texture with the smallest dot available being a single pixel then you're looking at a viable technique for making something look partially transparent while its actually alpha-masked and each pixel is either opaque or fully transparent. Most graphics progs contain halftoning filters. You will want to play with them, each one is different and you will want to learn how the ones in your particular graphics prog work best, what settings to use to get the best "pseudo-greyscale" result that is still effectively a single-bit mask, black or white. Once your alpha channel is comprised entirely of 1's and 0's then you can set a 50% alpha masking threshold and have no z-fighting and still an acceptable result for different degrees of partial transparency when rendered.

It's been decades since halftoning was a mainstream printing techniques and so it's something often overlooked in a graphical art education. It looks like it may have a new application though, at least in managing transparency in SL  😀

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Da5id Weatherwax said:

HOWEVER, there is an old technique that can be of value to you here. It's called halftoning.

That's a brilliant idea in theory at least. But have you tried it? I can't test it myself at the moment and I'm a bit worried that the in-world scaling may cause problems.

If it works, try to use several levels of transparency for the texture, not just two. That way it should be possible to tweak the perceived transparency amount by adjusting the alpha mask cutoff.

Link to comment
Share on other sites

48 minutes ago, ChinRey said:

That's a brilliant idea in theory at least. But have you tried it? I can't test it myself at the moment and I'm a bit worried that the in-world scaling may cause problems.

If it works, try to use several levels of transparency for the texture, not just two. That way it should be possible to tweak the perceived transparency amount by adjusting the alpha mask cutoff.

It won't really work the way you'd generally want, because of how alpha-masking is rendered compared to alpha-blending.

This is very apparent if you've ever seen a texture with lots of transparent holes in it, such as lace/fishnet clothing.

The further you zoom out, the smaller those holes get, and eventually the texture appears completely solid. I can't put it into simple terms, but I believe it's just a byproduct of how the texture is sampled for rendering. Smaller area on screen means less precise alpha checking.

For example, alpha masking:

9a0c27e59d.png
6267551f9b.png

Compared with alpha blending:

cf8e5b72fe.png

 

But I digress. One major difference between transparent texture vs 100% transparency is that transparent textures can still display materials. Here's a fully transparent texture with a blank (80 gloss, 255 environment) specular/shiny map on it:

214a0b36f2.png

I think this is very relevant when we're talking about glass.

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

16 minutes ago, Wulfie Reanimator said:

The further you zoom out, the smaller those holes get, and eventually the texture appears completely solid. I can't put it into simple terms, but I believe it's just a byproduct of how the texture is sampled for rendering. Smaller area on screen means less precise alpha checking.

Yes, that's what I was worried about. It was worth a try though.

 

Link to comment
Share on other sites

11 hours ago, ChinRey said:

Yes, that's what I was worried about. It was worth a try though.

 

Indeed, as @Wulfie Reanimator said, it does have its limitations. The further you zoom out the more opaque it becomes. Halftoning the alpha mask will not be a fix-all thing. It works best, in my experience, for indoor items or for the interior face of a window where you are never going to be viewing it from a really far distance. particularly small sections of an item will only work with this technique if the textures are optimised to not be heavily over-resolution. It also is completely non-variable - you cannot , for example, change the masking threshold and see a different result. the degree of "transparency" is hardwired by the halftone mask.

But where it does work, it works really well.

 

Blended transparency without z-fighting would be the best solution, but we can't have that... this is just another tool to be added to the box in case it fits the particular items need :)

Edited by Da5id Weatherwax
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...