Alpha and Opacity - only 3 levels?

frogpipe

Yesterdayz Trainz Member
I just made a plane in gmax, stuck an alpha texture on it, and imported it into trainz.

the TGA was black, with an alpha channel that faded from pure black to pure white.

dxt1_zps3ff59c28.jpg


Alpha channel is shown in the upper right corner.

What I got in game was 3 bands, one totally transparent (like it was invisible), one semi-gray (like smoked glass), and one opaque (in this case black).

Is that all the game engine does?
 
Don't know the answer, but following this question with interest.

I've made several similar objects for use as ground shadows in my assets, they all involve a gradually fading alpha more or less like your image above. Sometimes in TS2010 I see them rendered quite crudely - like distinct contours or steps in shading. Somewhere along the line I must have fiddled with my graphics settings, either in Trainz itself or in my general Nvidia settings, because now I see the same assets portrayed in Trainz the way they were meant to be - continuous soft fading from opaque to transparent. I just don't know what settings control this.
 
Unuh... OpenGL looks like a monkey hurled his waste at my monitor. Seriously, there are flickers of what the game is supposed to look like, but mostly it's a acid trip of triangles and colors spooged all over the screen - with an average FPS of 0.0000004

It's horrible

I think I may be doing something wrong, because I sure seem to see nice faded shadows on cars and things I've downloaded. I must be doing something wrong in gmax...

Everything I can find on transparency in gmax is about alpha'd number textures and so on where you want a sharp edge and not a faded one...
 
OK, so stick with DirectX. Try the different anti-aliasing settings under video options. That seems like a logical thing to look at.

Also, what's in the file black25.texture.txt ? I seem to recall from AssetX that there is a line or two that you can put in there that specify what kind of alpha it is (masked or blended).
 
I'll give those a shot...

Black25.texture.txt contains :
normal=black25.tga
alpha=black25.tga
tile=st
 
The line normal=black25.tga is definitely not right. It's not a normal map. Did you actually look or just guess at what you have in that file?

This line should read; Primary=black25.tga

 
Then it probably does, it was generated by gmax and is on another computer that I can't check right now...
 
Ah, OK.

The lines I was thinking of are extra to the ones already mentioned. Like you, I'm not at my home computer either, but I think they look like AlphaHint=

I'm not sure those extra lines will make any difference, but may be worth exploring their effects.

My main hope still lies with the anti-alias settings or something like that.
 
Ok, I'll have to check tomorrow, but I think you've led me to the answer. There is an alpha mode that is mask, where it is expected that the alpha channel has only WHITE and BLACK and I think the game is using this mode.

If so, adding Alphahint=semitransparent should do the trick. We'll see.
 
I suspect it's more than just those lines. If the game was only seeing black and white in the alpha, then you would not have seen what you called the 'semi-gray' band. It suggests the game already 'knows' that it's supposed to be a blended alpha, but for some reason it's not displaying it very accurately. That's why anti-aliasing rings a bell for me. Aliasing controls how sharp or fuzzy color transitions appear.
 
The alpha channel can only be a mask nowadays not blended. Trainz inability to render alpha channels satisfactorily has been one of my major gripes since early days. In MSTS one could use alpha channels to model coach windows but try that in Trainz and as soon as you get overlapping alpha channels all hell breaks loose and you have see-through coaches. For an incompetant and inadequate modeller like me this has been a great limitation and I have given up. I doubt whether anything will ever be done to really correct this as I suspect it would need a major rewrite of the graphics engine.
 
The alpha channel can only be a mask nowadays not blended..

It's not quite so 'black and white' to make a very bad pun. In cases where you will not be looking through more than one transparency, you can still use blended alphas quite effectively. A case in point is a ground shadow such as under the porch and under the vehicle. Note the edges of the shadows are fuzzy as intended.

dodgeairflowflyinga2.jpg
 
The cause might also be a "crap" video card, the OP never said what he is having in his PC. My experience with alpha mask layered objects or even alpha blended ones in the past was, if I used a lowly specced/rated video card, I sometimes got crappy alpha displays in Trainz. I now mainly use high specced video cards in my PCs and with these I never experience alpha issues, be these on scenery items like a graduated light beam or even on coach and locomotive windows (my created CSR/Bradken Classes locos with the blue windows) or whatever.

Since TS09 appeared, I ONLY use alpha masked layers on my semi transparent textures, again, since then never ever did I experience anything else but the alpha effect I was trying to create.

But then again, it might be the DirectX/OpenGL settings of the OP which could be the cause on alpha blended objects but for me, on alpha mask layered textures I usually try both DirectX and OpenGL settings to test and I usually find no difference with either setting.

Cheers

VinnyBarb
 
VB

When you say "alpha masked semi-transparent", do you mean the alpha is a single shade of gray? If so, then yes, I would expect no problems because it's not a blended alpha. But if you look at frogpipe's texture image with the smooth shading gradient in the alpha, what would you expect it to look like in the game (and assuming a good video card)?

DR
 
It appears to be antialiasing.

The line alphahint did nothing, but switching from antialiasing x2 to x32 (max setting) in nVidia control panel worked.

Note this is NOT a setting in trainz.
 
VB

When you say "alpha masked semi-transparent", do you mean the alpha is a single shade of gray? If so, then yes, I would expect no problems because it's not a blended alpha. But if you look at frogpipe's texture image with the smooth shading gradient in the alpha, what would you expect it to look like in the game (and assuming a good video card)?

DR

What I meant was using a single TGA texture with a graduated alpha layer on it, just like the OP's picture shows. Like in a light beam shining from a lamp/light for example. I probably did not make myself too clear above, I still get sometimes confused with the terms "alpha blending" and "alpha masking", to know which is which exactly. As long as I know how to make my alpha layered textures and these do work as intended, that is good enough for me.

Since the OP found the cause of his problem, I guess all this might be irrelevant.

Cheers

VinnyBarb
 
So the remedy was the external anti-alias setting. That's good to know. Does a high setting (32x) cause any negative performance issues?

Vinnybarb - yes, terminology is everything when trying to solve someone's technical problem. One way to remember the difference between masking and blending is that masking always produces 'hard' edges while blending produces 'soft' edges (sometimes you need to zoom right in to the individual pixels in order to see this). Semi-transparency is not a good way to distinguish a mask from a blend, since both types of alpha can produce a semi-transparent effect. And it is incorrect to refer to the alpha as a "layer". It's not a layer, it's a "channel". Layers don't change the number of bits in the image, but adding or deleting a channel does.
 
So the remedy was the external anti-alias setting. That's good to know. Does a high setting (32x) cause any negative performance issues?

Not so far as I can tell.

Oh and I'm running an nVidia GTX550Ti card. Really smoothed out all the other shadows as well - the ones like Jointed Rail has directly below their rolling stock, not those stupid box models that the game engine uses - I keep the shadows turned OFF they are hideous.
 
I notice that Trainz also has its own internal anti-alias settings, the choices being - none, x2, x4. I had these set to 'none' on my system, but as the picture above shows, I was still able to see blended alphas OK. When I changed to x4 I could not see any difference. So I wonder what the heck they do?
 
Back
Top