Alpha Transparency Problem with Lighting

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
papaonn
Kobold
Posts: 30
Joined: Wed Nov 13, 2013 5:59 pm
x 1

Alpha Transparency Problem with Lighting

Post by papaonn »

Hi All,

I am setting my object to be transparent but found that it is affected by the lighting direction,
for some direction the object is transparent well, for some other direction the object is just not transparent as expected.

I tried to avoid the affection of the lighting, but there is no option since all the emissive, ambient, diffuse, specular colours option that i could deal with are all affected by lightings.

I would like it to glow at a specific colour with some transparency and without affecting of the light object.
How could i achieve this?

below is the code that i used currently to generate an object with glow effect with transparency (but affected by light object)

Code: Select all

Ogre::MaterialPtr lpMaterial = Ogre::MaterialManager::getSingletonPtr()->getByName(objName);
    
    Ogre::Technique * lpTechnique = lpMaterial->getTechnique(0);
    Ogre::Pass * lpPass = lpTechnique->getPass(0);
        
    lpPass->setAmbient(Ogre::ColourValue(red, green, blue, alpha));
    
    lpPass->setCullingMode(Ogre::CULL_NONE);
    
    lpPass->setDepthWriteEnabled(false);
    
    lpPass->setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
    

User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Alpha Transparency Problem with Lighting

Post by tod »

Like this?
lpPass->setLightingEnabled (false);
papaonn
Kobold
Posts: 30
Joined: Wed Nov 13, 2013 5:59 pm
x 1

Re: Alpha Transparency Problem with Lighting

Post by papaonn »

Hi as mentioned earlier, if i disable the lighting there will be no alpha transparency at all since the transparency is relying on the colour of light reflection.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Alpha Transparency Problem with Lighting

Post by bstone »

Emissive colors are not affected by light.
Post Reply