PDA

View Full Version : The Alpha Experiment- It's all about: A Thinner Mask?


Vodhin
06-17-2006, 12:34 AM
The Alpha Experiment
And what color can do to the results

http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0060.jpg

Hi all, you know I've been working on colored light strings as a custom scenery project... Well, all is going very well except for that little bug where the ojects beyond the alpha texture doesn't show up...

Stop me if you already know this...

I figured that if I was going to have colored lights, then I should have colored bulbs. This is prooving to be more interesting than I had planned. I made a white, red, blue and green image of a bulb, and a negative of the white as an alpha. I never would have guessed that there'd be a problem... but I noticed that one bulb seemed to be more 'friendly' with other scenery pieces, and I checked what might cause it.

I thought that it was the reversed model (so you can see the bulb from the other side) that might be the culprit behind the "X-Ray" effect. So made 7 onesided 2D objects using those textures, as you see above, and assigned the SIAlpha to each one (except for the last 3). They are colored, in order above, Blue, Green, Red, White, White (usingSIAlphaDS), White (SIAlphaMask- which just was plain invisible), & White (A special model that I folded over itself- note the shadow...)

Take another look at the bulbs above, you'll see their faint tints. Now... I was making lights for a coaster and had that dreaded x-ray effect, so I put a coaster behind these...

http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0061.jpg

Look closely at the Blue (1st) and Red (3rd) bulbs, and the last one, too. Something's going on here... It seems that the red bulb is showing part of the track (so's the blue, but very faint). I thought, what about a station:

http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0063.jpg

Well, now that's interesting... It seems that certian RCT3 elements show through the alpha depending on color... lets see what happens with a train...

http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0064.jpg

Huh... It seems that the different colors are affecting what other colors are showing throught the alpha texture. Let's try some walls and see what happens.

First Brick Walls
http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0065.jpg

Ok... This is getting really interesting.... How about recolorable walls:

A Green Wall
http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0066.jpg

A Blue Wall
http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0067.jpg

And a Red Wall
http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0068.jpg


Changing the colors of the objects behind the alpha textures also seems to have an effect, so the alphas are working as filters, kinda like filters work on black and white film, I think RCT3 uses something similar to make the alpha behave. I'm thinking that there is one color, perhaps a neutral gray (r128 g128 b128) that might allow for all colors to get drawn through the alpha, but deminished, is it would be in real life.

So I tried a few other experiments and came to the conclusion that magenta might be the magic color, as it's opposite effect seems to have great results (of course, magenta is the reverse of green, so maybe a pure green would work, too- the green bulb isn't true green).

http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0087.jpg

Now let me skip over the dreary color tests and show you something interesting in this last shot:

http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0091.jpg

These are the last two special tests to see if I could get a 2 sided alpha with just one plane. The tall bulb was made by altering the texture (and it's alpha mask) to have 2 images of the bulb, and I folded the plane in half- snapping the verticies togetrher (but not welding them). I was pretty much expecting to see the bulb on the back side, but I wasn't expecting to see the second bulb- the one using the SIAlphaDS tecture type. So having a single plane with the SIAplhaDS type works as a two sided object.

More to come....


[EDIT] More information appears in Post #8

Aceana
06-17-2006, 01:09 AM
Very interesting...

We must look into this further.

Cyberleader
06-17-2006, 07:54 AM
Whoa, that is interesting. I have noticed that some of the 'ghosts' in Screamworx tend to, as it were, 'go through the walls'

Vodhin
06-17-2006, 10:45 AM
A thought occurs to me- pergaps the mask should be magenta, not black? I will try this when I get home tonight ;)

JCat
06-17-2006, 10:52 AM
Whoa, that is interesting. I have noticed that some of the 'ghosts' in Screamworx tend to, as it were, 'go through the walls'

Yep, as noted in the included issues when the pack was released. What's more interesting is, they don't always have that infinite pass through problem. You can pick up the same ghost moments later and it won't have that problem; same goes for scenery - you can lay a piece of scenery behind a ghost, and it will show a transpareny right through. Load up RCT3 later and retry the same thing - and it appears solid. Don't know if it has something to do with color, time of day, location... etc.

That magenta theory may be prove interesting... let me know how that turns out, Vodhin.

Vodhin
06-17-2006, 03:30 PM
JCat... It might have to do with the angle at which you look through the object- something that's almost never going to be exactly the same. I did this test with the game paused, so time of day should not be the culprit. I think it's more an orientation issue, and wether or not the game has drawn 'through' a side:

Look at the first 3 bulbs in the first pics above - no shadows, right? Now look at this one, taken later after placing the same objects on the other side of the track (They're elevated one notch)


http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0093.jpg

It also come to mind that Iceatcs found that a neutral gray color worked for windows, but I don't remember what- the texture, the alpha mask or what- so I will try tis along with the magenta tests later tonight...

weasel497
06-17-2006, 08:36 PM
Odd...

Vodhin
06-17-2006, 11:00 PM
Blue
Seems to be the winner for the color of the alpha image

http://www.vodhin.net/CustomScenery/Vodhin/Alphas/Shot0094.jpg




It's not without some strange behavior like before, but I think I understand what's happening that causes the "X-Ray" effect: We have an image (here the positive version of the bulb- black image on a gray background) and we have a Mask for the image (A blue image of the bulb on a black background. This isn't enough for the superimposition of one object onto another-

in Film (like the original Star Wars) you needed a mask for the object and a mask for the background so 4 images get put together to make the composite.

In TV (like the green screen in TV Weather) it's the same formula, but a computer is making the mask on the fly, just like RCT3. Soooooo...

I think the object MUST have two meshes: The object (regular image) with it's negative mask (The alpha attaches to the same mesh) and a negative image (set as SIAlphaMask) with a positive alpha attached (Would be the same as the regular image if on a white background?

The above would completely explain why my SIAlphaMask version of the bulb didn't show up at all: there was no Hole in RCT3 for the image to appear in...

Testing continues :D

marnetmar
06-17-2006, 11:02 PM
Very cool find Vodhin, keep up the excellent work :up: :up:

Vodhin
06-18-2006, 12:36 AM
I must report that the two mesh idea has not prooved itself. The object cancels itself out to provide a completely solid image... I tried several different variations of the mask assignment to no avail- yet. It could be that there is a color set involved that I have yet to come across.

The model I used has the two planes occupy the exact same points, which also may have contributed to the failure, though I imagined that if one was behind the other, it should be that you see one set from one side, and the other from behind..

Looking at my screenshots (more on my local PC) I realize that the primary image's alpha mask texture is doing exactly as it should: preventing objects behind it from getting drawn, it's just that the image itself doesn't seem to be getting drawn in it's place, or just not dark enough to block out the ground beyond. Or maybe not... The street lamps in RCT3 have perect tansparancies- there must be a clue there...


More later...

k_peek_2000
06-18-2006, 01:27 AM
I have no idea what any of you guys are talking about lol.

weasel497
06-18-2006, 01:49 AM
I have no idea what any of you guys are talking about lol.

I'm with you all the way man!!!

Vodhin
06-18-2006, 09:50 AM
I'm just sharing my notes on making transparent & translucent models- I can stop if you like...

East_Aer82
06-18-2006, 10:01 AM
I appreciate you sharing Vodhin. I've been having some issues learning, and everything helps.

weasel497
06-18-2006, 03:58 PM
Keep sharing with us Vod, I may need some of this info. I was stating that I don't really get it.

Vodhin
06-18-2006, 04:02 PM
I'm just kidding :p... I've tried sooo many combinations of color/masks that I have run out of ideas- except...

One that just comes to mind:you cannot have white (or less than 50% black?) in the object's main image... We need the textures from the single streetlight... oh, how I wish...

weasel497
06-18-2006, 08:03 PM
If you ask Frontier nicely... They might hand it over to you.

Vodhin
06-18-2006, 11:31 PM
My latest trials have lead me to believe that for transparancies to behave, the negative mask needs to be a little thinner in it's lines: think of an X painted on a piece of glass. The X is 32 pixels wide, but the mask needs to be 28 pixels wide- it looks like RCT3 might be resizing the textures, and a blend of white area is mixing with the black area and causing the main image to not quite fill in the whole mask opening for it, thus creating null space within in the composite (an area where the mask blocks out the rest of the game but there is nothing to fill it in with).

This explains the wierd outline x-ray effect, but not the changing colors x-ray one... Experiments continue, heading for lattice work towers and other like building sets...