PDA

View Full Version : Correct Specularity with Texturing



Ali S. Alfaraj
10-21-2010, 03:20 AM
Hello friends,

I'm using texture mapping on some of my objects in openGl. I want to display correct specularity with texturing using Blending (GL_BLIND). I'm not sure how that is done and hope you can help.

Ali

ZbuffeR
10-21-2010, 04:16 AM
Define what you mean by "correct specularity" ?

MaxH
10-21-2010, 11:26 AM
If you're doing old-fashioned, basic, OpenGL (like me), you can show specular highlights on textured objects by doing a simple, two-pass, rendering. It's discussed on page 296 of the OpenGL SuperBible. I have the 2nd Edition. The page # might be different in later editions. I've coded up this technique and find that it works quite well.

Dark Photon
10-22-2010, 05:22 AM
Need to know what you think "correct" means, but if you mean having specular highlights that have a distinct color and are applied after diffuse texturing, check out GL_SEPARATE_SPECULAR_COLOR (if using fixed-function pipe). If using GLSL, you can emulate this.

Ali S. Alfaraj
10-23-2010, 11:38 PM
Hello,

Thanks for the replies.

When I apply texture mapping on my object, the light specularity changes. I'm using a solid sphere as my light source. When applying the texture mapping, the solid sphere (my light) color changes to the same color as that for the texture? I don't want that to happen.

MaxH
10-24-2010, 01:03 PM
When applying the texture mapping, the solid sphere (my light) color changes to the same color as that for the texture?Have you checked the OpenGL SuperBible p. 296 yet?
There's a one paragraph discussion of your problem and some code that shows you how to fix it.

Ali S. Alfaraj
10-24-2010, 06:23 PM
Hi MaxH, Can you tell what chapter I can found this paragraph?

Also, I want to point out that I want to correct specularity using GL_BLEND.

MaxH
10-25-2010, 11:41 AM
Hi MaxH, Can you tell what chapter I can found this paragraph?
Also, I want to point out that I want to correct specularity using GL_BLEND. In the OpenGL SuperBible Second Edition, it's in Chapter 8 "Texture Mapping" on page 296.
There's a section called "Lighting with Textures" with a page titled "Rendering Specular Highlights".

Ali S. Alfaraj
10-26-2010, 11:51 PM
Thanks MaxH. unfortunately the edition I downloaded for Opengl super Bible no longer contain this section.

MaxH
10-27-2010, 12:21 AM
Thanks MaxH. unfortunately the edition I downloaded for Opengl super Bible no longer contain this section. Google 'OpenGL SuperBible Second Edition'. Looks like you can download it for free.