Author Topic: Texture transparency and RTT  (Read 3324 times)

0 Members and 1 Guest are viewing this topic.

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Texture transparency and RTT
I'm using RTT to draw stuff on a ship's texture. However, I'd need the parts I haven't drawn on to remain transparent, instead of showing up as black (or garbage-coloured if I don't clear it to black), but this seems impossible to do. If I could make the ship be drawn using additive blending then that'd work too, but apparently that's not possible either.

Am I missing something? If it's indeed impossible to 1) make some pixels transparent using RTT and 2) clear the whole texture to be entirely transparent and also 3) to make a whole ship get drawn using additive blending, then would one of those would be easy to add?

Things I've tried (and which didn't work):

- Trying to paint transparency by first setting a transparent colour with gr.setColor().
- Setting gr.CurrentOpacityType = ALPHABLEND_FILTER in an $On Object Render hook made for that ship.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Texture transparency and RTT
i once tried to trick the game into rendering the hud to a texture, it didnt quite work. and the main issue was that there is no way to draw to the alpha channel. i suspect its something to do with the internal texture format of the rtt texture (i doubt it even has an alpha channel).
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Texture transparency and RTT
Due to my discovery of how to use -trans textures, being able to directly paint alpha on an rtt texture isn't really necessary anymore for me. Whether it'd have a use for other folks I leave up to them.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Texture transparency and RTT
isn't that kind of deprecated?

i still kind of want this sort of thing. would probably be better if we just make it so you can specify the pixel format when creating a dynamic texture. it seems to be rgb888, but i kinda want rgba8888, might also want some other formats available like a8 or rgb565.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Texture transparency and RTT
isn't that kind of deprecated?

Maybe, but it's not removed. It also seems like the only way to have any kind of rtt transparency, so I guess it shouldn't be too hard to keep it from getting removed either.

 
Re: Texture transparency and RTT
Does the problem with alpha channel pointed here only concern the rtt texture?
Because i wonder if it would be possible to render a fixed image with alpha that would simulate the helmet view like this :

it would have to follow your view
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Texture transparency and RTT
Does the problem with alpha channel pointed here only concern the rtt texture?

Yes, I'm pretty sure it does. It would be easy to test to make sure though, and maybe I'll remember to do that later today.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Texture transparency and RTT
that kinda thing has nothing to do with rtt. thats merely taking a texture and drawing it on top of the scene. you dont need to create a texture on the fly for that. you would just need to create a large high resolution texture, with alpha, and scale it to fit the screen and (in freespace context) draw it right before the hud gets drawn. obviously when you do this, its hard to make a texture that works well for all available resolutions and aspect ratios, and it may get stretched in an undesired or ugly way (such as getting warped or blockey). you can get around this a few ways, make a few textures and use the one that closest matches your res and/or aspect ratio, you can apply a blur shader or other to it, you can also do both.

a lot of people seem to misunderstand what rtt is for. rtt is used when you need to do one of these:
render the scene to a texture for use on a model in the game (like a gun/missile/turret camera display on a panel, or a security camera monitor in an fps game).
make the content of a texture interactive (like the control panels in doom3)
simple procedural animations based on events in the game (like radar and other cockpit panel elements, or hud glass)

of course this doesnt mean you cant find some other uses for it. however render to texture is a very expensive operation and should be avoided if there is a better method for doing something.
« Last Edit: March 31, 2011, 08:59:46 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 
Re: Texture transparency and RTT
Nuke  : i knew for the rtt i was asking about alpha channel in other cas than rtt.
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1

  

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Texture transparency and RTT
Nuke  : i knew for the rtt i was asking about alpha channel in other cas than rtt.

i think all the image draw functions can work with alpha channels. the problem with rtt and transparency is most likely the internal pixel format of the texture simply does not support alpha data. of course use textures with alpha in texture formats that support it (8888, dxt5) and you should have no problem doing something like in the image you posted.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN