Skip to content

Doubt about average calculation in SpecularMap #33

Description

@azagaya

Hi,
I was looking at the code, and i saw that in specular map, the average calculation was like this:

   double multiplierSum = (redMultiplier + greenMultiplier + blueMultiplier  + alphaMultiplier );
    if(multiplierSum == 0.0)
        multiplierSum = 1.0;
//some other code
    if(mode == IntensityMap::AVERAGE) {
       //take the average out of all selected channels
        intensity = (r + g + b + a) / multiplierSum;
    }

But imho this is not an average, because if every channel has a multiplier of let say 0.1, then the sum is going to be 0.4, and you are going to divide the whole sum by 0.4. Shouldn't the division be the sum of each channel divided by the ammount of channels used?
I really don't know how specular maps are calculated, so it's just a question.. i can fix it if it is a bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions