PDA

View Full Version : Alpha Transparency on Geometry



A.Russell
09-22-2005, 02:50 AM
How do you get alpha channel transparency to be rendered?

I have a model where some of the textures have an alpha channel to make parts of them transparent(for example plants and grass). The parts masked by an alpha channel are solid black in the editor and appear solid white when rendered in Layout.

I have gone into Surface editor, and alpha channels are set to be enabled.

What is the problem?

Silkrooster
09-22-2005, 05:42 PM
Have you added the transparency image to the transparency channel?
Silk

A.Russell
09-22-2005, 09:37 PM
I think I've done that. Please look at these screen shots and tell me if you can see something wrong. There is certainly a masking image in the alpha channel:

http://www.my-virtual-classroom.com/pictures/transparencyissue.jpg

Silkrooster
09-22-2005, 09:44 PM
Try changing the value in the transparency channel to a higher number, I think it can't be set to 0 when using a transparency. If I remember right, that is.
Silk

A.Russell
09-22-2005, 09:49 PM
I've tried that, it just makes the whole image see-through -the bits that are supposed to be masked are the same transparency as the grass texture.

toby
09-22-2005, 10:55 PM
In display options, check 'OpenGL Multi-texturing' and then 'Transparency Channel'.

Also, try inverting the layer. White gives you transparency.

A.Russell
09-22-2005, 11:21 PM
I guess you mean the preferences panel in Lightwave? Because there is no such option under "Display Options" in Modeler.

If so, then all the Open GL options are already selected, including Open GL Textures and OpenGL Transparency.

The problem is not just how it looks in the view ports, it also renders that way.

Thanks for the heads up about inverting the alpha image, though. I'll have to invert the alpha image in Photoshop, since the image editor in Lightwave only inverts the colour channels. In the first place I'd like the alpha channel to work.

http://www.clubvarie.com/pictures/uglyrender.jpg

toby
09-22-2005, 11:58 PM
oh, that's right, the invert won't work, because you need to use a black and white image in the transparency channel instead of an rgb image.

Clone the image in the image editor, and chnage the alhpa channel drop-down to 'alpha only', and use this in the transparency channel.

You might not be able to see transparency maps in the modeler viewport. You can in layout, but it's a pretty new feature.

As for inverting, no! I said invert the layer, not the image in the editor.

A.Russell
09-23-2005, 01:30 AM
Thanks Toby. Getting closer, but still no cigar.


I've discovered it doesn't matter if it is a B&W image in the transparency channel, it takes the alpha.

However, and this is strange, if I clone the alpha channel and invert it, I get this:

http://www.clubvarie.com/pictures/uglyrender2.jpg

I thought to get the colour showing I would make a copy of the tga and invert its alpha channel in Photoshop. I did this, and replaced both the colour channel and transparency channel with this new image, but then I was back to no transparency at all! I saved it as 32 bit tga and I can see the alpha is there. It's just a tga with alpha like the original, but now it doesn7t make it transparent at all. Is there some special method you need to save the image or a special program to make the right sort of tga? I can't understand it.

MonroePoteet
09-23-2005, 10:13 AM
I think the solution is to make a clone of the image file (Clone button in Image Editor), check "Alpha Only" on the clone, and use the clone as the transparency mask.

When the alpha channel is "Enabled" (rather than Alpha Only), then LW uses both the alpha channel and the color content of the image to determine the "pass through" of what's behind it. So, wherever the color is non-white with the image set to alpha Enabled, it will be slightly non-transparent.

By setting "Alpha Only", you tell LW to *only* use the alpha channel on that layer, which is what you want on the transparency channel.

mTp

toby
09-23-2005, 01:29 PM
Yes that's what I said.

To clarify, you DO NOT want use the SAME image in the transparency and color channels!

Do not use an image in the transparency channel that contains an alpha, there is no need and it will just confuse things. Use an image with no alpha, or the clone set to 'alpha only'.

SO...

The layer in the color channel should have green in the grass area. You don't even need an alpha here. Even if there is an alpha in this image, it has NO EFFECT on the transparency of the surface.

The layer in the transparency channel should have black in the grass area.

A.Russell
09-24-2005, 12:06 PM
Yes, I have done as you said, and about 50 other things. Take a look:

http://www.clubvarie.com/pictures/alphacrap_1.jpg

http://www.clubvarie.com/pictures/alphacrap_2.jpg

http://www.clubvarie.com/pictures/alphacrap_3.jpg

Can you see anything wrong with this?

toby
09-24-2005, 12:48 PM
For one thing, since you inverted the alpha in photoshop, it's masking out the green of the grass - I'd put that back to normal.

But let's start from scratch and simplify. Make a green grass image with no alpha for the color channel, and make a b&w image of the grass for the transparency channel. (This is the way I do it anyway, it allows you to use 8-bit images and saves texture memory.)

If the transparency doesn't seem to be working, you can always click 'invert layer' and see if that does it.

operation
09-24-2005, 03:06 PM
I had the same problem in the past ....

How I do ....

I make my color map with an alpha (grass+alpha) ...(....)
and I create a black and white alpha picture of my grass.

use your map in color. (grass+alpha =32 bits)
use the black and white in the transparency channel (8 bits)

... it should work ..

Toby is right ( you can use an 8 bits picture for color)


Lw s**ks on this point ( image panel need more improvement)

MonroePoteet
09-24-2005, 03:44 PM
32-bit images with alpha work great for me in the color channel, and a cloned, Alpha-Only instance works great in transparency channels. 8-bit B&W images also work great for me in transparency channels.

All in all, I'd have to disagree that LW is inadequate in this area. I think it's only a matter of understanding what LW is doing with the data stored in the image for the various settings.

The only enhancement I'd ask for is access to the "Alpha Only" on a surface-by-surface basis (i.e. the Surface Editor), instead of having to clone the image. Otherwise, it works exactly as I'd expect.

mTp

operation
09-24-2005, 04:05 PM
yes , the clone tip is working.

Of you course, if you use it as it should be used ...

But when I say that Image editor is bad ... a lot of features are missing (in the surface editor too ).

Newtek need to think about how to use Imageeditor + Surface editor at the same time or to merge them.

Tile, Flip, repeat, crop, etc...

If you are experienced with other packages , you may understand.(no offense)

ps; it must be intuitive ( I had the same pbl than Russell at the beginning because I had the same 'steps' as him about using alpha...
After tweaking ... I did understand how it should work).

It will be great if I put a 32 bits picture in the transparency slot that LW use the alpha channel ( and not the color channel).( of course by checking a box to say use alpha or color in the transparency option)

MonroePoteet
09-24-2005, 08:08 PM
I admit my ignorance of other packages. Quite truthfully, I'm tired of hearing people complain "Maya can do this" or "Max can do that" or "XSI can do this other thing."

To me, LW is an *astounding* product. With very rare exceptions, I've been able to do anything I want to with it.

Personally, I like the versatility of LW. I like knowing what's going on "under the hood". I like knowing WHY I get the results I get, and how to fine-tune them. I like the consistency of Textures and Envelope across all channels and how they interact. I like managing Images separately from Surfaces. I like Modeling separate from Rendering and scene management.

I think the major difference in opinion may be in what's expected of the product. Take automobiles as an analogy. Some people want a fancy road car with creature comforts and push-button features on all sides, others want a hot rod. Some people never open the hood, others are tinkerers and don't mind getting their hands dirty.

Road cars are comfortable and luxurious and anyone can drive them. Hotrods go FAST in the right hands.

Just my opinion, though.
mTp

toby
09-24-2005, 08:27 PM
I like the consistency of Textures and Envelope across all channels and how they interact. I like managing Images separately from Surfaces. I like Modeling separate from Rendering and scene management.


Exactly! :hammer:

I hope people who talk about other packages also appreciate LW's strengths.

A.Russell
09-24-2005, 09:51 PM
Yay! finally got it. Even though this scene hasn't been lit yet, I don't know that it usable in any case. Light reflects off the masked parts in some places for some reason:

http://www.clubvarie.com/pictures/crappyrender.jpg

I eventually made it work by making a 24bit png image for the colour channel and an 8bit b&w image for the transparency channel in photoshop.

I agree with Operation, a "just use the d*mn image in the alpha channel for transparency" checkbox would be a useful feature.

dballesg
09-25-2005, 02:18 AM
Hello A. Russell,

As toby said, try this:

Clone your image on the Image Editor, and made the clone Alpha Only.
On your original Image, disable the alpha.

Put your grass Image on the Color Channel, the one with only Alpha on the Transparency channel, and change its Blending Mode to Alpha.

I am doing something similar as you and I found it is easier, have the color image in one file, and the alpha in another, and made use of TWO layers, one with blendig mode as Normal (for example color) and the one you want it cut the color or transparenci or whatever, as Blending Mode to Alpha.

Cheers,
David

Rory_L
09-25-2005, 02:35 AM
You have to use the alpha to mask the specular channel too, or you will get light reflecting off the masked parts!

R

Lightwolf
09-25-2005, 04:35 AM
Put your grass Image on the Color Channel, the one with only Alpha on the Transparency channel, and change its Blending Mode to Alpha.

Actually, the last bit is not necessary(sp?), even counter productive.
The Blending Mode defines how tha layer reacts _within_ the texture layers window, not as a surface channel. So leaving it at the default works well.

To repeat the steps:
* load 32 bit image
* create two clones/instances in the image editor
* clone 1, no Alpha
* clone 2, Alpha only
* Apply the first in the colour channel, the second in the transparency channel.

And as Rory_L wrote, you may need to use the alpha to mask out specularity etc. too.

One little note here though: LW will treat the alpha/rgb combination of the image when texturing as straight alpha (as opposed to pre-multiplied). So in Photoshop, make sure that the colour on the semi-transparent areas is at 100%, and not blended into a background colour. (Compare that to a LW render, where the semi-transparent edges contain bits of the background colour in the colour channel).

Also, if you expect a correct alpha channel for compositing to be rendered out using this split image technique, you'll be disapointed (again, due to the pre-multiplication). If you need a good alpha exported, render in two passes, on RGB only with no Alpha/transparency, and a second pass with the Alpha on the RGB channel (again, no transparency) and a luminosity of 100% and combine those two in your favourite compositing application.

Cheers,
Mike - sorry for blubbering

A.Russell
09-25-2005, 05:49 AM
Thank you everybody, I see how it works now. I think the trouble I was having was because the mask in the original image was inverted to the way Lightwave does things. Therefore, even though I had a valid image in the transparency channel, the alpha in the colour channel made the unmasked part either all back or all white. Thanks ROry for expalaining that there needs to be an alpha in other channels as well for transparency to work as expected.

While I appreciate this low level of control, it is also a bit convolted for ordinary use. An option to "just use the d*mn alpha channel for transparency" would be greatly appreciated by laymen like myself.

Anyway, now I've been through my trial by fire, I am empowered to the full potential of alpha channels offered by Lightwave!

peteb
09-29-2005, 07:20 AM
This is one thing that stumped me when I first used Lightwave. I really don't see why you wouldn't want the alpha in a 32bit image not to act like an Alpha.
Basically in any other package I've used if I make a 32 bit image the alpha will be transparent. Saving you a lot of time.
In Lightwave having to either clone or have a seperate B/W image and then having to put it into the transparency channel is a pain and then when you have to put it in the spec as well.
Another confusing thing is the fact that you can set layers to alpha which in case you don't know only alphas out that image you're using and not the actual poly. So it's good when you're using layered textures but that's about it.

Pete B

Lightwolf
09-29-2005, 07:25 AM
This is one thing that stumped me when I first used Lightwave. I really don't see why you wouldn't want the alpha in a 32bit image not to act like an Alpha.
...
So it's good when you're using layered textures but that's about it.

Ig uess that is the point... in the end every surface channel (i.e. RGB, diffuse, whatever) acts like a stack of Photoshop layers as far as the texture layers are concerned. If you look at it this way, it makes sense...

Cheers,
Mike

toby
09-29-2005, 09:50 PM
I really don't see why you wouldn't want the alpha in a 32bit image not to act like an Alpha.
It does act like an alpha. The layer beneath shows through.
I for one would never want to affect my transparency by putting a map in the color channel. If it did, we'd have people here frustrated trying to figure out how to put an insignia on an airplane without making the plane transparent.

colkai
09-30-2005, 04:47 AM
Newtek need to think about how to use Imageeditor + Surface editor at the same time or to merge them.

Tile, Flip, repeat, crop, etc...
You know, that's one thing I've often felt was missing in Image editor. Oftentimes, it would be cool to take an image and just rotate it / flip it in the image editor for use on textures, rather than having to edit it outside of LW.
Also more controls in terms of "pushing" the image too.
One could argue that you can use the texture rotational tools, but sometimes, say with UV's, it would be handy to reselct an image within LW Layout rather than having to go back and edit the UV map so it lines up.

Lightwolf
09-30-2005, 05:15 AM
[QUOTE=colkai
One could argue that you can use the texture rotational tools, but sometimes, say with UV's, it would be handy to reselct an image within LW Layout rather than having to go back and edit the UV map so it lines up.[/QUOTE]
Looking at the list (flip, rotate, repeat, tile) these could be done by manipulating the UV coordinates prior to rendering, may be even with the new UV Animation option. Crop is a different beast.

The main issue in the image editor are the cases where the output image would have a different size, i.e. tile/repeat, crop and rotate, a simple flip would be easy to code.

I hope that the nodal system can resolve many of these issues.
I.e.
|Create UVs| -> |Manipulate UVs| -> |Use UVs to apply an image| -> |apply to RGB, Transparency, whatever|

Especially on this level of complexity a nodal system would come in _very_ handy.

Cheers,
Mike

peteb
09-30-2005, 06:25 AM
" If it did, we'd have people here frustrated trying to figure out how to put an insignia on an airplane without making the plane transparent."

No because for the layered alphas you'd be using an 8 bit image. I'm saying if you import a texture that's 32bit then that extra 8bit should alpha out the polys.

Pete

colkai
09-30-2005, 08:00 AM
Looking at the list (flip, rotate, repeat, tile) these could be done by manipulating the UV coordinates prior to rendering, may be even with the new UV Animation option.

That sounds like it would be cool Mike, though I'm dubious as to if such a thing will be possible in the first incarnation of LW9, (notice I didn't say it will never be? :p One has to believe.)

Lightwolf
09-30-2005, 08:03 AM
That sounds like it would be cool Mike, though I'm dubious as to if such a thing will be possible in the first incarnation of LW9, (notice I didn't say it will never be? :p One has to believe.)
Oh, I meant the animated UV option that crept in suring LW8.3 (I think, or was it the one before that?). Since it allows you to manipulate UVs prior to rendering it should basically work.

Cheers,
Mike - so many ideas, so little time ;)

colkai
09-30-2005, 01:38 PM
Whoa - didn't notice that -will have to check it out.

toby
09-30-2005, 10:09 PM
" If it did, we'd have people here frustrated trying to figure out how to put an insignia on an airplane without making the plane transparent."

No because for the layered alphas you'd be using an 8 bit image. I'm saying if you import a texture that's 32bit then that extra 8bit should alpha out the polys.

Pete
?
If I understand you, you mean anyone who wanted to add a decal would have to do the work that you don't want to do, so that you can apply transparency from within the color channel?! The only way to apply a decal without an alpha is to add a black and white image layer set to alpha, in the color channel - this is what you've said you 'shouldn't have to do'. Besides, for full transparency, you'd still have to apply the b&w image to the spec and reflection channels.


I meant the animated UV option that crept in suring LW8.3 (I think, or was it the one before that?). Since it allows you to manipulate UVs prior to rendering it should basically work.
Do tell! I've seen that option in the surf editor, but what kind of uv's do you make for it?

Lightwolf
10-02-2005, 06:30 AM
Do tell! I've seen that option in the surf editor, but what kind of uv's do you make for it?
Well, it is a plugin class that allows you to manipulate existing UVs prior to the image being applied. (in the basic case, just animate them). It could be used for example to just flip UVs etc... I haven't looked into it much though ... the SDK Docs in LW 8.x suck (sorry)...

Cheers,
Mike

peteb
10-03-2005, 06:26 AM
Urm I didn't really get your last comment but I'll say what I mean more clearly.

At the moment if you want to add a decal to a car for example. You have to go into the colour channel. Add a layer that has your texture on it and then add another one set to Alpha and add a B/W texture that tells Lightwave what parts of the underlying texture to remove? From what I remember this is how it works at the moment, correct? So my idea wouldn't effect your decals in anyway.

At the moment if you've made a texture with an Alpha image Lightwave just ignores that extra 8bits of info. It will treat it like a normal image. Actually if I remember from the manual it actually tells you to avoid doing this as it causes problems.

I could be wrong about this as I have't done any transparency for a while. If you can load a 32bit and use the extra 8bit to alpha the decal then that's great but wouldn't it be better if you could tell it to either do that or to alpha out the whole poly?

So what I'm saying is why can't they do it so that when you have a 32bit image it treats the extra 8bit to alpha out the whole poly? You're only going to make one of these 32bit images if you want it to do that and if not you can just stick with the other method which you have to use now for decals anyway.

The thing is I could discuss this all day but the fact is other packages do this and it works so much better then Lightwave and saves you a lot of time.

Pete B

Lightwolf
10-03-2005, 06:45 AM
Urm I didn't really get your last comment but I'll say what I mean more clearly.

At the moment if you want to add a decal to a car for example. You have to go into the colour channel. Add a layer that has your texture on it and then add another one set to Alpha and add a B/W texture that tells Lightwave what parts of the underlying texture to remove? From what I remember this is how it works at the moment, correct? So my idea wouldn't effect your decals in anyway.
Nope, an image with included alpha will use the alpha to reveal the underlying layers in the texture layer editor. That is the beauty of it. Think of it as a layer in Photoshop with transparency.

Cheers,
Mike

Lightwolf
10-03-2005, 06:48 AM
So what I'm saying is why can't they do it so that when you have a 32bit image it treats the extra 8bit to alpha out the whole poly? You're only going to make one of these 32bit images if you want it to do that and if not you can just stick with the other method which you have to use now for decals anyway.
a) there are two ways to alpha out the surface, clip maps and transparency
b) All the decal people would suffer instead ;)
c) I think if you could just pick the channel to use in the image layer (as I and others have proposed) it would solve most of these problems, and be more flexible.
d) nodes will solve many of these issues :D

Cheers,
Mike

peteb
10-03-2005, 10:39 AM
Yeah that sounds better. Clip maps are no good because you can only have black or white.

Like I said there's no reason why you couldn't have both.

So hopefully you're right and this will be solved with the node system.

Forgot to add I guess Alpha on polys isn't much use for people that do high end renders but for games it's a must.


Pete B

Lightwolf
10-04-2005, 03:05 AM
Yeah that sounds better. Clip maps are no good because you can only have black or white.

Not quite true, Clipmaps interpret grayscales to do edge anti-aliasing in clipped polygons, so for simple cut-outs you'd actually want greyscale images, not just 1-bit images.

You can try it yourself, create two clipmaps, one with greyscales, the other as a 1-bit image (some type in PS will do), zoom in closely to a clipped edge and take a look at the render.

Cheers,
Mike

peteb
10-04-2005, 04:01 AM
Yeah but you still can't get a nice fade off....can you?

Lightwolf
10-04-2005, 04:16 AM
Yeah but you still can't get a nice fade off....can you?
You get AA'ed edges, but no semi-transparent areas.
They still have their uses though.

Cheers,
Mike

toby
10-04-2005, 09:57 PM
You get AA'ed edges, but no semi-transparent areas.
They still have their uses though.

Cheers,
Mike
I think that's contradictory :D
Just to clarify, you get the smooth edge when the clipped poly is rendered with aa.

Lightwolf
10-05-2005, 03:04 AM
I think that's contradictory :D

No unles you consider a single pixel to be an areas ;)


Just to clarify, you get the smooth edge when the clipped poly is rendered with aa.
Yeah, sorry, forgot to mention that...

Cheers,
Mike