Adio Magic
Registered User
Join date: 2 Nov 2008
Posts: 2
|
01-18-2009 02:13
I have two prims, where the top faces of each are in close proximity. The top face of each prim has a different texture applied. By script, I selectively move the prim carrying the currently desired texture proud of the other prim.
You would think that the texture on the proud prim (i.e. the higher, exposed prim) would always be visible, but this is not the case. Varying your viewing angle towards the proud prim seems to change which texture is displayed.
I have tried varying the face separation between the prims, and tried slightly inclining the 2 prims relative to each other. These did not help.
Any ideas how to solve this situation?
Thx in advance.
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
01-18-2009 06:39
You are describing a common phenomenon, the "alpha glitch," which is a regular topic of discussion in this forum. It is not unique to SL, but is a feature of OpenGL architecture. Try searching the forum archives for the keyword "glitch" to get a feel for it. Also, read the sticky on alpha channels and transparency at the top of this forum. The short answer to your question is that yoiu cannot ever have two textures with alpha channels overlapping each other as you have. Graphics cards cannot determine which texture is "in front" and therefore flicker back and forth between them as viewing angle changes. There are ad hoc ways to correct for the problem, but none works all the time. The best thing to do is to avoid it in the first place.
|
Heather Rau
Registered User
Join date: 7 Feb 2007
Posts: 100
|
01-18-2009 19:03
Put simply, when textures which have alpha channels overlap, OpenGL needs a way of deciding which texture should take precedence over the other. It is coded to give priority to the texture that is closest to the POV of the camera, based on the center of each face. Needless to say, this leads to some interesting issues which are, outside of SL, referred to as "alpha sorting issues". There are creative ways around it, but the emphasis here is on creative. Work to fully understand that is happening, technically, and design the solution that is the "best" compromise between the realities of OpenGL architecture and the effect you wish to achieve. The truth is that finding solutions to the problem is half the fun of it. 
|
Adio Magic
Registered User
Join date: 2 Nov 2008
Posts: 2
|
01-18-2009 19:35
Thanks for your replies.
The images used on the surfaces of the 2 prims have no visible alpha channels. The images were produced from layers containing alpha channels, but the final images, after all layers are viewed together, contain no visible alpha.
This phenomenon is also apparent when in-world snapshots are used for the textures applied to the tops of the two prims.
Given these facts, are the previous replies still correct?
Thx in advance.
|
Peggy Paperdoll
A Brat
Join date: 15 Apr 2006
Posts: 4,383
|
01-18-2009 20:42
Yes the previous posts are facts. Despite the textures having no "visible" transparency, if they contain the alpha channel OpenGL will treat the textures as if they do have a "visible" transparency. If a texture has no transparency (or no need for transparency) then it should be saved as a 24 bit texture......not the 32 bit that contains that alpha channel. If your texture has no need to have a transparent section then don't save it as if it does.....save it properly. 100% opaque should be 24 bit. Any transparency in the texture it should be 32 bit.
Placing textures containing the alpha channel in line with any other texture containing an alpha channel (which means if from any angle the two, or more textures, can be viewed in such a way that your view angle sees them in line with each other) will cause the alpha sorting glitch.
|
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
|
01-19-2009 06:51
From: Adio Magic I selectively move the prim carrying the currently desired texture proud of the other prim. You would think that the texture on the proud prim (i.e. the higher, exposed prim) would always be visible, but this is not the case. Varying your viewing angle towards the proud prim seems to change which texture is displayed. Consider the geometry, using the camera location and the *centers* of the prims. It doesn't matter that your camera is closer to the edge of the proud prim if the center of the other one is closer than the center of the proud prim. One of these days I'll make a drawing.
_____________________
The Vengeance Studio Gadget Store is closed! 
|