Oh, I think that my description may not have been fully clear. (Bad
pun, sorry :) )

I do all this, the thing is that I want to be able to use the same
material even if the actual image map has no alpha channel. When I try
this, loading an image map with no alpha channel, the bindings get
messed up and the red channel will be sent to transparency. This is
what I want to avoid. Think of it like a special kind of material, I
want to set up a bunch of user editable attributes, one of which is an
image map. If this image map contains an alpha channel, that would be
sent to transparency, but if it doesn't have an alpha channel,
transparency won't be affected by the material.

What I want is to make sure that the last three VSL objects in the
material shown in the attached image are only evaluated if the image
has an alpha channel.

Regards,
Fredrik Bergholtz


On 29/04/06, David Coombes <[EMAIL PROTECTED]> wrote:
Yes, you can do that, but you're thinking about it wrong. What you want to
do is output to the surface transparency the value held in an images Alpha
channel.

In your Surface Properties shader add a Texture object.
Load your texture with Alpha channel.
Set the output of the texture object (In/Out tab) to Surface:Transparency
In the Bindings tab, click the Edit checkbox and set the bindings so the
Transparency's RG and B channels (destination) are set from the source
image's A channel

At this point I'll mention I can't actually do this because RS's window is
busted and has been as long as I've known the software. When I click Edit
Binding the Source panel extends to below the bottom of the window and I see
no destination panel. No amount of opening and closing  windows and panels
and Ctrl left right shift click and dragging will expose the rest of the
interface for me. The way panels auto scale and such I've always found
awkward as they invariably produce a window far longer than my 768 pixel
height display, and often don't terminate at the bottom of the window
anyway.

Anyway, what you are doing is selecting a picture that has Red, Green, Blue
and Alpha components, and saying 'For each pixel, take the images Alpha
value and set that as the transparency value of the Red, Green and Blue
colour components of the surface.' You can just as easily create a black and
white image and set the value of surface transparency to the red component
of the image, using it as a mask.

David Coombes
[EMAIL PROTECTED]

...
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, April 29, 2006 11:56 AM
Subject: VSL: Testing an image for an alpha channel


> Hi, is it possible to test for the prescence of an alpha channel in a
> given image map inside a VSL material?
>
> Something like:
>
> Surface properties
> {
>    do stuff
>
>    if (image has alpha)
>    {
>         Apply alpha channel of image to surface transparency
>    }
> }
>
> I want to use the same structure of the VSL material for all my
> objects to let users simply change the possible parameters that match
> the in-game material properties without having to modify the actual
> VSL code.
>
> Regards,
> Fredrik Bergholtz
>


Attachment: vsl.png
Description: PNG image

Reply via email to