Jump to content
  • Advertisement
Sign in to follow this  
davidcoleman

Object looks translucent (not intended)

This topic is 3612 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

My objects render translucent but I want the standard phong rendering look Where is the problem? GL.Light(LightName.Light0, LightParameter.Ambient, 0F); GL.Light(LightName.Light0, LightParameter.Diffuse, 1F); GL.Lightv(LightName.Light0, LightParameter.Ambient, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); GL.Lightv(LightName.Light0, LightParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Lightv(LightName.Light0, LightParameter.Specular, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Materialv(MaterialFace.Front, MaterialParameter.Ambient,new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); GL.Materialv(MaterialFace.Front, MaterialParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Materialv(MaterialFace.Front, MaterialParameter.Specular, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Shininess, 100F); GL.Materialv(MaterialFace.Front, MaterialParameter.Emission,new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); GL.Enable(EnableCap.ColorMaterial); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0);

Share this post


Link to post
Share on other sites
Advertisement
It was not GL_BLEND...

I have tried also
GL.Enable(EnableCap.Normalize);
GL.Enable(EnableCap.RescaleNormal);
with no change

http://img222.imageshack.us/my.php?image=translucentnh3.png

I do not have calculated normals... can it be it? When I make face normals, then it is almost compleetly dark

Share this post


Link to post
Share on other sites
if you want lighting....then you need (correct) normals. per vertex.
so
glNormal() gLVertex()
glNormal() gLVertex()
glNormal() gLVertex()
etc

When normals arent correct this obviously shows, but NOT by translucency.

if GL_BLEND is disabled, translucency might creep trhough via texture.
glDisable (GL_BLEND);
if blend is enabled, is only causes 'good' translucency with the proper glBlendFunc set.
so are you sure you're seeing translucency ?

check if all is ok WITHOUT light.
then ONLY enable the light, and if this is causing problemns, it shouldnt be something transparent.

in the screen i see NO transparancy at all
(also, am a bit confused now by transparancy/translucency. what should be wrong with the pic in http://img222.imageshack.us/my.php?image=translucentnh3.png
??? exactly)

Share this post


Link to post
Share on other sites
I haven't looked very closely at your post or the replies, but I just wanted to point out that sometimes you can get something that looks arguably "translucent" if depth testing is not enabled and/or setup correctly.

That's probably not your problem, but I thought its worth a mention.

Share this post


Link to post
Share on other sites
It seems we come from different backgrounds... I meant translucent as 3D studio max translucent parameter... not transparent but the light bounces within object... like Sub-Surfsace-Scattering, wax...

Here is another image
(the small brown line leeds up there to the light source)

If I turn off the light object is compleetly white. I tried now enabling depthtesting before rendering triangles but the result is the same

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!