Alpha transparency and object viewer.

View previous topic View next topic Go down

Alpha transparency and object viewer.

Post by graymac on Thu Feb 12, 2015 10:51 pm

I'm producing a lot of objects using PNG textures with alpha transparency instead of the traditional "transparent (color value) R,G,B".
The results are good in Open v 1.4.3.0, superior to the set color method.
The problem is, when using the Object viewer, the weirdest effects occur. I don't know why, but  imagine its perhaps due to Viewer's different handling of backface culling compared to the actual program itself??? Route Viewer is also unhappy with alpha transparencies.
Anyone else got the same problem, or found a getaround???
* The Object Viewer included with Richard Ward's rewritten v1.4.3.2 does the same, by the way.


graymac

Posts : 1704
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: Alpha transparency and object viewer.

Post by Dexter on Fri Feb 13, 2015 1:55 am

Yeah, this was happening to me as well. I would say the Object Viewer struggles to display the alpha channel of the png correctly, it must be a code problem. Moreover, leaving an alpha channel in a png is way more demanding than sticking with the traditional TransparentColor method.

Dexter

Posts : 1780
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Alpha transparency and object viewer.

Post by Quork on Fri Feb 13, 2015 6:23 am

Depends on the purpose. For simple transparencies (none and full) the colour-keying is better I think. But if you need demi-transparencies, alpha channels are the only way to go. And I don't think it's that much of an impact on modern GPUs, since they have to deal with alpha transparencies everywhere now.

Quork

Posts : 1030
Join date : 2012-05-05
Age : 25
Location : Frankfurt am Main (Frankfurt on Main), Hessen (Hesse), European Union (Deutschland (Germany))

http://www.parkbahnschmiden.de/

Back to top Go down

Re: Alpha transparency and object viewer.

Post by graymac on Fri Feb 13, 2015 3:01 pm

Moreover, leaving an alpha channel in a png is way more demanding than sticking with the traditional TransparentColor method.

I checked the fps and it seems not to be a problem using alpha transparencies. One test item was a pile of trees with alphatrans, produced with the "Forest Builder" utility. Lots of rotations and x/z offsets to 3 decimal places but no drop in fps.

graymac

Posts : 1704
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: Alpha transparency and object viewer.

Post by leezer3 on Mon Feb 16, 2015 12:25 pm

Only just got as far as replying to this Smile

The phenomon you are seeing is a problem caused by incorrect Z-Sorting.

Z-Sorting is whereby the graphics driver/ OpenBVE engine renders each model and attempts to determine what should be shown actually on screen.
If this sorting is wrong, which is normally caused by looking at one alpha face through another, or one semi-transparent face through another, then you'll see a semi-transparent version of the face behind's texture painted on the solid face, or a gap if your viewing angle leads you to look through a completely transparent area in the second texture.
Color key transparencies aren't affected, as the transparency will be dealt with internally to the OpenBVE engine, as opposed to be being passed off to the graphics card drivers.

Not sure why it only affects Object Viewer/ Route Viewer, but I suspect the renderer is slightly different to allow for AA/AF in the main game. You might try forcing AA/ AF to maximum through your graphics card driver.
AFAIK, Richard Ward hasn't done much (If anything) to the base game renderer, which would probably require a complete rewrite of the OpenGL drawing.

Final note-
The potential performance issues are again going to be connected to the graphics card in use. In normal usage, OpenBVE is heavily CPU & disk read dependent.
However, if you're using large numbers of alpha transparencies, the graphics card will start having to do much more work, especially if you start pushing AA/AF as well. Try large numbers of alpha transparencies on an older integrated graphics card, and I think you should see a far bigger effect Smile

Edit:
OpenGL article, look at the last part and the diagrams and it may explain a little (Or confuse you more Razz ) - https://www.opengl.org/wiki/Transparency_Sorting

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 747
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: Alpha transparency and object viewer.

Post by graymac on Mon Feb 16, 2015 2:45 pm

Well, I didn't understand much of that link, though I'm sure its all very true.
What I did just now was to run the same test piece on a laptop I use with more basic graphics and that was fine.
Then I ran it on the old office knacker machine with no extra graphic card (using v.1.4.2.0) and it ran at around 45-55fps and displayed the problem objects correctly.
So its definitely only the dev tools that display wrongly,  rather than the prog itself.

Also remember, the program offers interpolation options, which cause strange effects when not correctly set - I found  the default settings weren't right*, so probably the tools aren't right either. But the tools have no options to adjust, it's "one size fits all" !!

*   *These settings display all the CTS stuff  correctly.

graymac

Posts : 1704
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: Alpha transparency and object viewer.

Post by Stevegr on Mon Feb 16, 2015 10:22 pm

For some reason I make my work by running it in Open Bve.

I can't think of any better way to find out how something looks in the sim itself.

Stevegr

Posts : 119
Join date : 2013-01-01
Location : CARDIFF

https://sites.google.com/a/bve4trains.com/bve4trains/

Back to top Go down

Re: Alpha transparency and object viewer.

Post by Sponsored content Today at 2:32 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum