Home>

I would like to implement the formula of "Specular reflection phone model on page 11 of the reference site" to make the model glossy. What should I do?
I don't know what to do from the beginning. What should i do?

/ ***************************************************** ****************************************************** **************
* Writing .vert
****************************************************** ****************************************************** ************** /
#version 400

layout (location = 0) in vec4 position;// Vertex coordinates
layout (location = 1) in vec2 in_texcoord;// Texture coordinates
layout (location = 2) in vec3 in_normal;// normal
uniform mat4 worldMatrix;// World matrix
uniform mat4 viewMatrix;// view matrix
// To fragment shader
out vec2 out_texcoord;

void main ()
{
    vec4 pos = vec4 (position.xyz, 1.0);
    out_texcoord = in_texcoord;
    gl_Position = viewMatrix * worldMatrix * pos;
}
/ ***************************************************** ****************************************************** **************
* Writing .frag
****************************************************** ****************************************************** ************** /
#version 400
// came from a fragment
in vec2 out_texcoord;
uniform sampler2D uTexture;// Texture
out vec4 out_color;// Output

void main ()
{
    out_color = texture (uTexture, out_texcoord);
}
  • Answer # 1

    OPenGL 4.0 shading language Phong shading for GLSL programming learned by example
    I'm worried that there aren't many explanations because only the implementation of is listed, but it may be helpful. I think you should borrow it. By the way, I can't read the shader, so I don't know if there is anything. I don't even know the formula.