Calculate specular

This is a discussion on Calculate specular within the Game Programming forums, part of the General Programming Boards category; hi! lets say i want to calculate specularity to do something like this: http://plouj.com/projects/erlang-ray...aced-r27-1.png i have: light vector surface normal ...

  1. #1
    Registered User Devils Child's Avatar
    Join Date
    Jan 2008
    Posts
    244

    Calculate specular

    hi!

    lets say i want to calculate specularity to do something like this:
    http://plouj.com/projects/erlang-ray...aced-r27-1.png

    i have:
    • light vector
    • surface normal
    • camera look vector


    i want:
    specularity
    all i get when trying to do this is something that doesn't look much like specular, but more like a paintball match. i'm not very good at vector maths, so i'm asking YOU

    anyone got an idea?
    thanks

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    From the D3D SDK
    Specular Lighting = Cs * sum[Ls * (N H)^P * Atten * Spot]

    Cs = specular color
    Ls = light specular color
    N = vertex normal
    H = halfway vector
    P = reflection power
    Atten = attenutation factor
    Spot = spotlight attenuation factor
    True specular - no halfway vector (Phong)

    R = 2 * (N dot L) * N - L
    I = Ai * Ac * Di * Dc * (N dot L) * Si * Sc * (R dot V)^n

    Ai = ambient intensity
    Ac = ambient color
    Di = diffuse intensity
    Dc= diffuse color
    N = normal
    L = Light direction
    Si = specular intensity
    Sc = specular color
    R = reflection vector
    V = view direction
    n = specular power

  3. #3
    Registered User Devils Child's Avatar
    Join Date
    Jan 2008
    Posts
    244
    this should help. thanks
    i'll come back if it doesn't work

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Right Triangle Program
    By BSmith4740 in forum C# Programming
    Replies: 9
    Last Post: 02-26-2008, 11:24 PM
  2. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  3. how to calculate all files in disk?
    By kirmelyte in forum C Programming
    Replies: 1
    Last Post: 04-30-2006, 02:47 PM
  4. Small program that has to calculate miles per gallon
    By Guti14 in forum C++ Programming
    Replies: 6
    Last Post: 01-06-2004, 01:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21