Jump to content
  • Advertisement
Sign in to follow this  
Infinite_Daremo

Alpha turning to grey

This topic is 3051 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been doing a facial recognition project and all has been going well so far, but i need to apply decals to the transformed image. I've done this countless times but for some reason now when im applying a decal to the cheeks around the edges the alpha is grey. I don't know if this is happening because the mapping area isn't perfectly square or there's some simple OGL call im missing. Below is a picture of the result, all that should be visible on the cheeks is the redness. http://i39.photobucket.com/albums/e183/kingwoods/IMG_0063.png Anyone have any ideas? Randomly google'ing alpha and glTexParamf is becoming a pain in the arse.

Share this post


Link to post
Share on other sites
Advertisement
The grey colour around the cheek area shouldn't be there, its a red overlay for the cheeks. It doesnt show up in Photoshop just when im mapping the texture. Its supposed to be a decal for damaged skin cells from alcohol abuse but the alpha on the texture is coming out as grey.

This is what the applied texture should look like:
http://i39.photobucket.com/albums/e183/kingwoods/overlayAlcoholCheekL.png

Share this post


Link to post
Share on other sites
Ok, and what blending function are you using? It would be better to see source code to help debug the problem.

Share this post


Link to post
Share on other sites
Sorry for the late reply. Work finished.

Ok.

This renders a facial part and all the decals store within it.

 void CFacialPart::RenderDecals( const int iNumIndices ) const
{
glEnable(GL_TEXTURE_2D);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); // Enables texturing
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

std::vector< CFacialDecal * >::const_iterator it = m_pFacialDecals.begin();

for( ; it != m_pFacialDecals.end(); ++it ) // Render all facial decals
{
(*it)->Render( m_Vertices, m_IndexBuffer, iNumIndices );
}

glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDisable(GL_TEXTURE_2D);
glDisable (GL_BLEND);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}



And this is how a decal is rendered:

void CFacialDecal::Render( const GLfloat *pVertices, const GLubyte *pIndexBuffer, const int iNumIndices ) const
{
if( m_fBlendCapacity < F_BLEND_CUTOFF )
return;

glBindTexture(GL_TEXTURE_2D, GetTextureID() );
glColor4f(1.0f, 1.0f, 1.0f, m_fBlendCapacity);

glVertexPointer(2, GL_FLOAT, 0, pVertices);
glTexCoordPointer(2, GL_FLOAT, 0, GetTextureCoords());

glDrawElements(GL_TRIANGLES, iNumIndices, GL_UNSIGNED_BYTE, pIndexBuffer);

glColor4f(1.0f, 1.0f, 1.0f, 1.0f );

}



I don't know whats happened to the operators here :S

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!