Author Topic: TGA transparency  (Read 2747 times)

Mr War

  • Guest
TGA transparency
« on: 30 January 2011, 17:03:46 »
Hi,

I believe there are two types/treatments of transparency used in GLEST.
1) to show a team colour where the TGA is transparent
b) to be literally transparent - to show the tiles behind something

How do you achieve the latter? I want to add blending/shadow at the bottom of a building to give the effect of softening the edges to the ground

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: TGA transparency
« Reply #1 on: 30 January 2011, 19:36:13 »
Alpha on double-sided meshes becomes team color in game.  Alpha on single-sided meshes becomes transparency in game.
Code: [Select]
[URL=http://img200.imageshack.us/i/57289533.png/][IMG]http://img200.imageshack.us/img200/5909/57289533.png[/img][/URL]
« Last Edit: 7 October 2016, 21:49:37 by filux »

Mr War

  • Guest
Re: TGA transparency
« Reply #2 on: 30 January 2011, 20:30:24 »
Thanks, that's really useful!


silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: TGA transparency
« Reply #3 on: 29 April 2011, 06:37:48 »
Is this seriously the way you mark a mesh as using team-texture ?!?

If so, then the blender export script is defective.

You should set a mesh as two-sided if (and-only-if) you intend for back facing facets to be seen (ie, have translucent/transparent mesh or texture, or 'holes' in the mesh).

There'll be a new model viewer/hacker tool available "very soon" (tm) that will let you change mesh properties (two-sided and team texture are separate properties) as well as mesh opacity and diffuse colour, and add/change textures for all five slots.

If the blender export script is using 'two-sided' to set both the two-sided and team-texture mesh props, it might get much more use than I expected.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: TGA transparency
« Reply #4 on: 29 April 2011, 06:40:32 »
If the blender export script is using 'two-sided' to set both the two-sided and team-texture mesh props, it might get much more use than I expected.

it had me shaking my head too

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: TGA transparency
« Reply #5 on: 29 April 2011, 08:27:20 »
Aren't all meshes currently rendered two-sided in the game anyway?

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: TGA transparency
« Reply #6 on: 29 April 2011, 08:49:25 »
Aren't all meshes currently rendered two-sided in the game anyway?

Nope. Meshes with the two-sided property are, meshes without are not.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: TGA transparency
« Reply #7 on: 29 April 2011, 09:31:23 »
Then I fear your suspicions of a broken export script seem to be correct.

These planes are single-sided in Blender.  Not so in GAE.
Code: [Select]
[URL=http://img717.imageshack.us/i/screen2om.jpg/][IMG]http://img717.imageshack.us/img717/7582/screen2om.th.jpg[/img][/URL][URL=http://img717.imageshack.us/i/screen3hw.jpg/][IMG]http://img717.imageshack.us/img717/3064/screen3hw.th.jpg[/img][/URL]
So apparently the exporter is using the sidedness only to tell whether to use team color or transparency, and setting everything as double-sided regardless.

These meshes were not set as double-sided, as evidenced by the transparency (they're just bent planes), but they're clearly being rendered as double-sided in both the g3d viewer and the game.
Code: [Select]
[URL=http://img821.imageshack.us/i/screen4nv.jpg/][IMG]http://img821.imageshack.us/img821/245/screen4nv.th.jpg[/img][/URL][URL=http://img821.imageshack.us/i/screenshot4jy.jpg/][IMG]http://img821.imageshack.us/img821/3863/screenshot4jy.th.jpg[/img][/URL][URL=http://img848.imageshack.us/i/screenshot3z.jpg/][IMG]http://img848.imageshack.us/img848/8177/screenshot3z.th.jpg[/img][/URL]
« Last Edit: 7 October 2016, 21:49:20 by filux »

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: TGA transparency
« Reply #8 on: 29 April 2011, 09:35:49 »
This should work under linux, (only doubt is the OpenTK dlls... but I think they are x-platform)

[Link to G3dHack alpha2 removed, see here for latest version]

needs mono + mono.winforms.
« Last Edit: 3 June 2011, 11:49:52 by silnarm »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

 

anything