(Modulate Bump & Base) + Bump = Specular?

[edited]Wrong terms used, I meant gloss not specular[/edited]

Is “Modulate Bump & Base) + Bump = Gloss” the right formula for a glossy finish? It seems like that’s what it would be anyway, but that would require 3 texture units. Is there any way to accomplish a glossy finish with only 2 texture units? I’m using the primary color to combine with the DOT3 bumpmap texture and then modulating the result with the base color texture…but it’s only diffused …I want wet looking things .

Also, is there a way to modulate by a certain intensity…just so that the gloss texture can be multiplied by a scale and then added to the buffer?

Final clarafication:

  1. DOT3 texture combined with primary color 2. Modulate with base texture
  2. Add a scaled DOT3 texture combined with primary color for glossy effect

[This message has been edited by WhatEver (edited 06-09-2002).]

I dont think that sounds quite correct.

Read this, it’s an excellent description of phong specular.
http://www.whisqu.se/per/docs/graphics10.htm

Nutty

I’m using phong in my equasion to calculate the light reflecting off of the surface…oh my, I see why I was misunderstood, I meant to say that I want a glossy finish…the phong method I’m using is working perfectly already, I just want areas that are reflecting the light to be white instead of the textures full intensity.

Full intensity specular, does not limit at the textures src value.

Specular is addative, so it whites-out at full intensity.

Simply put, specular is added on after the texturing, not before.

Simple equation.
RGB = (diffuse * base_texture) + specular.

Old style specular in OpenGL, used to add it on before texturing, which was incorrect, which is why the seperate specular color extension was developed.

It sounds like you’re the total lighting term of diffuse + specular, then modulating buy base map. Instead of diffuse modulate base, then add specular.

Nutty

Just to see if I understand what you’re saying, I could do this then:

Specular = DOT3 Bumpmap of sand
Diffuse = DOT3 Bumpmap of sand
BaseTexture = sandy texture

RGB = (Diffuse * BaseTexture) + Specular;

Just seeing your equasion has helped me understand what diffuse really is: scales the base textures rgb values.

[This message has been edited by WhatEver (edited 06-09-2002).]

You could do that, but ideally you want to power the specular value, to sharpen the fallof of the dot product value. The more shiny the surface, the more powering it requires.

Nutty

How do I power the specular lighting?

Multiply it by itself lots of times.

How do you do that with OpenGL though? I’m not using vertex programs, I’m only using TexEnv.

That emoticon bothers me. I always think that it should be a surprised look not a “oh, well, I’m bored of your comment” look.

It’s suppose to be a surprised look .

ahh I thought you were using Register Combiners. Maybe you want to use seperate specular color extension, and setup material surface as shiny. Dunno how this all fits together with bump-mapping though.

Checkout the Dot3 demo in my previously unreleased section on my website. There might be something in there. I fiddled with a load of TexEnv stuff, to give it a kind of glossy finish.

Nutty

Hey Nutty, your email didn’t work for me, but it worked in WM. I posted a response in my forum, you can go there through this link.

You can always calculate the lighting yourself. Do all your lighting calculations and the resulting rgb value you can just pass to opengl (with lighting disabled). Then you can do the specular to an arbitrary power. I am not sure what opengl does for specular lighting (the equation I mean). I really never use opengl lighting I just always did my own lighting, either in C with my own math or in register combiners.

Devulon

I don’t know what it’s called, but I do do the lighting using the primary color channel. In order for my DOT3 bumpmapping to work, I have to use some algorithm, that without the DOT3 bumpmap, would make my surface look like a rainbow.

I really need to learn register combiners badly. It seems a lot of you use them for certain effects…first I need to understand the TexEnv stuff though.

> Specular = DOT3 Bumpmap of sand
> Diffuse = DOT3 Bumpmap of sand
> BaseTexture = sandy texture

Note that DOT3 bumpmap for Specular is different from DOT3 bumpmap for Diffuse. The DOT3 for diffuse is between the normal and the light. The DOT3 for specular is between the viewing vector reflected through the normal’s surface and the light (which can get simplified to DOT3 between normal and half angle between viewer and light with a simple transformation).

Let me see if I understand this then.

Diffuse is when a surface doesn’t reflect any light, instead it sort of absorbs light.

Specular is when the surface reflects the light…and that’s what Phong is.

I guess I didn’t understand the terms. All I’m trying to do is get areas on my bump mapped surface to turn white when the refected surface is looking right at the light.

Right now I’m using this to set of the bumpmap:

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PRIMARY_COLOR_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);

I’m doing the Phong color setup but it only makes a texture draw at its fullest intensity and fullbright instead of white.

I actually don’t even understand what those TexEnv commands are even doing, except combining the primary color with the DOT3 bump map and resulting with a grey texture. For some reason if you use the next texture unit it’s blended with the grey bumpmap…but why? If I use a third texture unit it replaces the second texture unit…I want the third texture unit to be added to the first two so I can get my glossy surface…I’m possitive it would work too.

[This message has been edited by WhatEver (edited 06-11-2002).]

Here’s what I have going right now. It’s using Phong Specular lighting.

Run Fishy - 381KB (GeForce Only)

I’m doing the primary color calculations manually, is there and extension that can do the calculations for me? Software is slow .

>>I guess I didn’t understand the terms<<

those definitions are still wrong look them up in some graphics/physics book/site failing that look them up in a dictionary

I just looked it up at both dictionary.com and in my OpenGL book. Specular and diffuse is what I thought they were, I just didn’t quite know how to explain it in my post.

Let me give it another try .

Diffuse causes a surface to be it’s fullest intensity when the light position is perpendicular to the surface.

Specular causes a surface to reach its fullest intensity when the half vector generated from the eye pos and light pos is perpendicular to the surface.

According to this site I just found; what we’re actually doing in OpenGL is Gouraud lighting, because we’re dealing with light on a per vertex basis. It says phong is the light being calculated on a per pixel basis.

Anyway, this was the phong I was refering to: http://www.whisqu.se/per/docs/graphics10.htm

How about:

final = texture + ((bump - 0.5 ) * 2.0)

Looks good… I have that code somewhere…