Tone, Opacity, and Alpha Channel

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Metalero
Posts: 14
Joined: Tue Sep 07, 2010 4:02 pm

Tone, Opacity, and Alpha Channel

Post by Metalero »

Well, I have generally used irrlicht for 2D stuff.

And one thing I´ve never tryed to implmente, was Tone, Opacity and Alpha Channel (all in one) in a texture

I mean:

Tone: add a kind of additive color, composed by : (Red, Green, Blue, Gray)
Opacity: total opacity of the texture (like using EMT_TRANSPARENT_VERTEX_ALPHA)
Alpha Chanel: use alpha chanel of the picture of the texture (EMT_TRANSPARENT_ALPHA_CHANNEL)

The thing is, I cannot convine that two materialKind in one, and tone is not available in any material ( EMT_LIGHTMAP_ADD is the most close, but it doesn´t provide Grey parameter)


So, I use the clasic method of accessing all pixels and "play with them".
This method works great, with a very big problem: lost of performance when I change Tone or opacity (I use material EMT_TRANSPARENT_ALPHA_CHANNEL for alpha channel) in an update, FPS goes down:

With 16 textures (128 * 196) it work at 10 FPS

I know it is because I´m using the CPU instead using the GPU, so the question is:

Is there any method to do this using GPU capabilities in irrlicht?

Thanks.



(Sorry for my English, I speak Spanish XD)
Last edited by Metalero on Fri Mar 18, 2011 1:22 am, edited 1 time in total.
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

um.... last time i checked opcacity means same thing as alpha...

and what do you mean by "tone"

you can have an SColor/ SColorf and pretty much make ANY color. there are a lot. 256^3 colors :?

uh... im not sure what you are asking:

do you mean like accesing low-level video driver?

i think you can choose low-level params like poly shape types and then you can "play with the pixels" with fragment shaders and vertex shaders...
Metalero
Posts: 14
Joined: Tue Sep 07, 2010 4:02 pm

Post by Metalero »

Well, yes, alpha and opacity it´s the same, but wath I mean is:

Alpha chanel -> use alpha data from de image file
Opacity -> posibility of varying alpha by code, to make a texture (wich has alpha channel) more or less translucent

Tone, is the same as using EMT_LIGHTMAP_ADD meterial type, and vary the 2° texture color

Shortly, I want to mix EMT_LIGHTMAP_ADD, EMT_TRANSPARENT_VERTEX_ALPH and, EMT_TRANSPARENT_ALPHA_CHANNEL in the same material, without having to change pixel by pixel manually, wich is very low in big textures.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You might achieve that by adding a new material renderer, but usually it's far easier to add a new shader on your own which does exactly that.
agamemnus
Posts: 283
Joined: Sun Jan 31, 2010 6:06 pm

Post by agamemnus »

Assuming he knows how to make such a shader and apply it in Irrlicht. :P

If anyone gets around to making this or something similar, I would be very interested in using it!
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

shader will be 10^7 faster
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No.
Post Reply