This content has been marked as final. Show 9 replies
Hey there Nickname, thank you for the reply. I have, in fact, read that very article a couple of times to ensure that I did not miss anything. While it did help me with creating alpha textures within tools like Fireworks or Photoshop it does not explain how to create the alpha transparency at run-time using only Lingo. Better yet, how to combine a 16bit image with a 32bit alpha. The interesting thing is that I already do this in another part of my code with different image objects, but for some reason the same methodology does not work at all in this particular application. I did, however, test one of the images that I am referring to and as a sprite it works just fine. As a texture I get streaking.
Is there something interesting that needs to be done to ensure that one does not get streaking when working with alpha transparency in textures as compared to sprites???
Have a look at: .renderFormat (a property of textures), and getRenderServices().textureRenderFormat (which sets the default texture render format.
You may find that setting your texture's renderformat property to #rgba8888 gets rid of the streaking.
Hey there duckets thank you for the reply as well. I guess I should do a better job of providing more upfront information in the description of my problem. I have tried using #rgba8888, #rgba4444, and #rgba5551 all with the same result. I have also used both OpenGL and Direct3D in my hunt to get rid of the streaking to no avail. Here is what is different when I do not get streaking. I can create an image in Fireworks with the correct masking technique and just load that image as a texture with no streaking. I, however, cannot seem to do the same only using imaging Lingo which is what I need to do. So, the issue I am having seems to be using the correct technique in imaging Lingo to convert a 16bit image to a 32bit one with alpha trans at the borders. Thank you again for your assistance.
Hi again folks. Ok, has anyone any knowledge of an xTra called GLEX? I was able to find a beta online and it literally solved my problems right out of the box. The issue with alpha transparency and Z ordering as I have described immediately disappeard after about 5 mins of configuration. I would really like to purchase this xTra if it is possible and I am working on a time crunch. Any information would be very helpful.
It was created by Lucas Meijer and Noisecrime. I'm not sure if they ever
got it to the point of a commercial release.
If you search the dir3d-l and/or dirgames-l list archives you'll find
contact addresses and threads relating to this xtra.
So, were you having an alpha transparency z ordering problem? From you initial post it sounded like your problem was to do with the visual appearance of the textures ('streaking', maybe bit-depth related) rather than z-sorting. Did you solve the streaking?
Is your texture width and height a power of two?(16,32,64,128,256,512,1024,etc) If not then your texture will look lousy and streaking may still occur due to the renderer forcing the image to scale to a power of two. I have been able to work around this problem on occasion by using the #rgba5551 textureformat under DX_7. Also, if I remember correctly, when you are creating the alpha in an image object the alpha channel image has to be 8bit and of the same dimensions as the 32 bit host image (the mask function in imaging lingo does not add alpha transparency to the host image/base layer, but merely composites transparent layers onto the 32 bit host image, i.e. the 32 bit host image should contain the alpha transparency before compositing). In addition, trying to up-sample from 16 bit to 32 bit may alias your image boundaries significantly and could be an issue. On the other hand, the problem could lie with your UV mapping, but we can't tell for sure unless you post the actual code used or at least a screen capture of the problem.
Hi, you can try using other texture layer as mask on the same shader. As usually you create the texture from a dynamic loaded image, then apply this texture to the shader on the texture list index 1 (textureList). Next part does the job, create other texture from a 32 bits image with the alpha information and fill all pixels with white color, this is very important because the second texture layer will be multiply with the first texture layer. This texture set its render format to rgba8888. Apply the mask texture to the same shader at texture list index 2, verify that the blendFunctionList index 2 is #multiply.
I include the code of a project that use this masking approach:
on beginSprite me
pMember = sprite(me.spriteNum).member
repeat with i = pMember.light.count down to 1
vEarthModelResource = pMember.newModelResource("EARTH MODEL RESOURCE", #sphere)
vEarthModelResource.radius = 50.000
vEarthModelResource.resolution = 20
vEarthTexture = pMember.newTexture("EARTH TEXTURE", #fromCastMember, member(3,1))
vEarthShader = pMember.newShader("EARTH SHADER", #standard)
vEarthShader.emissive = color(255,255,255)
vEarthShader.flat = TRUE
vEarthShader.transparent = FALSE
vEarthShader.textureList = vEarthTexture
pEarthSphere = pMember.newModel("EARTH MODEL", vEarthModelResource)
pEarthSphere.shaderList = vEarthShader
vNightModelResource = pMember.newModelResource("NIGHT MODEL RESOURCE", #sphere)
vNightModelResource.radius = 50.2000
vNightModelResource.resolution = 20
vNightTexture = pMember.newTexture("NIGHT TEXTURE", #fromCastMember, member(4,1))
vNightTexture.quality = #lowFiltered
vNightTexture.nearFiltering = FALSE
vNightTexture.renderFormat = #rgba8880
vNightShader = pMember.newShader("NIGHT SHADER", #standard)
vNightShader.emissive = color(255,255,255)
vNightShader.flat = TRUE
vNightShader.transparent = TRUE
vNightShader.textureList = vNightTexture
vMaskNightTexture = pMember.newTexture("MASK NIGHT TEXTURE", #fromCastMember, member(6,1))
vMaskNightTexture.renderFormat = #rgba8888
vNightShader.textureList = vMaskNightTexture
vNightShader.textureModeList = #wrapPlanar
pNightSphere = pMember.newModel("NIGHT MODEL", vNightModelResource)
pNightSphere.shaderList = vNightShader
pNightSphere.parent = pEarthSphere
vRotationVector = - pEarthSphere.transform.rotation
pNightSphere.shaderList.wrapTransformList.rotation = vRotationVector