Page 1 of 1

[Solved] Unlit color + alpha

Posted: Fri Feb 15, 2019 12:55 pm
by hedphelym
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).

Re: Unlit color + alpha

Posted: Fri Feb 15, 2019 8:46 pm
by dark_sylinc
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.

Re: Unlit color + alpha

Posted: Mon Feb 18, 2019 9:20 am
by hedphelym
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!