View Full Version : calculating specular

whats the better method of calculating specular, ive seen the two following methods used

A/ float specular_amount = dot( light, reflect( -view, bumpmap ) );

B/ float specular_amount = max( dot( half, bumpmap ), 0.0 );

i remember reading that one of them was more correct and another was an faster approximate epresentation, going on that ild say (A) was the correct method. but in testing they're both very similar and IMO ild say (B) looks better, so anyways, in short im in my normal mindstate confusion.

cheerz ed

sqrt[-1]

06-23-2005, 05:36 PM

a) Is Phong

b) Is Blinn-Phong

(Assuming you take these values and raise them to a power)

a) is usually better as it does not suffer from issues that b) does under low tessilation.

I think a) and b) need different exponents to look the same... (Also it is a good idea to clamp the dot in a)

Read this:

http://www.delphi3d.net/articles/viewarticle.php?article=phong.htm

^Fishman

06-23-2005, 08:20 PM

My version of a) is here, this is what I use. BTW specValue is taken from a specularity texture.

float specular = pow(clamp(dot(reflect(-viewVec, bump), lightVec), 0.0, 1.0), specValue);

a) is usually better as it does not suffer from issues that b) does under low tessilation.b/ seems ok if u normalize the halfvector

I think a) and b) need different exponents to look the sameyeah ive seen that

thanks for the info (and link) anyways sqrt[-1] that sums it up

noticed this link on another forum

http://people.csail.mit.edu/wojciech/BRDFValidation/ExperimentalValidation-talk.pdf

after reading the pdf, when i said "and IMO ild say (B) looks better" in the initial question it seems as if it looks better cause it is accurate, dam now ive gotta change over from A->B :)

Christian SchÃ¼ler

08-03-2006, 04:15 AM

dot(R,L) is the model for a fuzzy light source reflected by a perfect mirror.

dot(N,H) is the model for a perfect point light source reflected by a fuzzy surface.

Both models are valid.

Jackis

08-03-2006, 08:16 AM

Very simple math says, that:

- suppose alpha is the angle between normal and half-vector

- suppose betta is the angle between light and reflected vector

- suppose A is the angle between normal and view-vector (due to reflection bidirection it is also equal to the angle between normal and reflected vector)

- suppose B is the angle between half-vector and view-vector (due to half-vector definition it is also equal to the angle between half-vector and light)

1st equation is very simple:

B + alpha = A (or 'A + alpha = betta' depending on your picture)

2nd euation is also not very different:

betta + B = alpha + A (or 'betta + A = alpha + B')

Solve it and you get:

betta = 2 * alpha

So, the angle for Phong specular equation is twice bigger than for Blinn's one.

Imagine, that we have a directional light looking directly from our head (V is equal to L). We see it's reflection only if we are quite perpendicular to the surface, as Phong says. But Blinn allows us to see more reflected light, which is not very natural for a perfect mirror, but it is natural for a micro-facet fuzzy mirrored surface.

Humus

08-03-2006, 10:08 PM

Originally posted by zed:

b/ seems ok if u normalize the halfvectorIt will still have issues. The halfvector is not a linear attribute. You'll see it sort of bend near triangle edges if the triangles are large.

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.