[Solved] Unlit color + alpha

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
hedphelym
Gremlin
Posts: 166
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 10
Contact:

[Solved] Unlit color + alpha

Post by hedphelym » Fri Feb 15, 2019 12:55 pm

Is there a way to create unlit material that supports setting the alpha value?
(I do not have textures, just color).
I have not found a way to set the alpha value, closest I get is to set in the blend block, turns it somewhat transparent, but I cannot control the alpha strength.

Am I missing something obvious here? Or does it not work out of the box?
(For PBS materials it works, but I need unlit, since this is for debug shapes that does not need light).
Last edited by hedphelym on Thu Feb 21, 2019 7:15 pm, edited 1 time in total.
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4078
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 232
Contact:

Re: Unlit color + alpha

Post by dark_sylinc » Fri Feb 15, 2019 8:46 pm

Call:

Code: Select all

datablock->setUseColour( true );
datablock->setColour( ColourValue( 1, 1, 1, alpha ) );
For scripts, setUseColour should be getting called automatically if we detect the colour isn't set to 100% opaque white.
Without the setUseColour, your setColour calls will be ignored and will trigger an assert in debug builds.
1 x

hedphelym
Gremlin
Posts: 166
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 10
Contact:

Re: Unlit color + alpha

Post by hedphelym » Mon Feb 18, 2019 9:20 am

Thank you I found the things you mention, buI then missed this:

Code: Select all

blendBlock.setBlendType(Ogre::SceneBlendType::SBT_TRANSPARENT_ALPHA);
This then solved it, it now works as expected!
1 x

Post Reply