2022-02-13.01-55-21.mp4
- Clone
$ git clone https://github.com/aniketrajnish/specular-lighting-opengl.git
- Open the solution file using VS 2014 or newer.
- Import the albedo and specular maps in the
\assets
folder. - Change the albedo and specular names in
cube.hpp
Texture tex("assets/your_name.png", "material.diffuse");
Texture tex_specular("assets/your_name.png", "material.specular");
- Change the RGBA values of colour buffer in the rendering loop of
main.cpp
glClearColor(// your RGBA here);
Properties of cubes can be changed by making the following changes in main.cpp
- Declaration
Cube cubes[//desired number];
- Adding / Removing position vectors of the cubes accordingly
glm::vec3 cubePositions[] = {
// add / remove here
};
- Initialization
for (unsigned int i = 0; i < //desired number; i++) {
cubes[i] = Cube(cubePositions[i], glm::vec3(//desired size));
cubes[i].init();
}
Properties of lamps can be changed by making the following changes in main.cpp
- Declaration
Lamp lamps[//desired number];
- Adding / Removing position vectors of the lamps accordingly
glm::vec3 pointLightPositions[] = {
// add / remove here
};
- Initialization
for (unsigned int i = 0; i < //desired number; i++) {
lamps[i] = Lamp(// rgb of desired color,
//desired ambience, //desired diffusion, //desired specular value,
1.0f, 0.07f, 0.032f, // attenuation constants
pointLightPositions[i], //desired size;
lamps[i].init();
}
Properties of spotlight can be changed by making the following changes in main.cpp
- Initialization
SpotLight s = {
Camera::cam.pos, Camera::cam.cameraFront,
//desired inner cut off, //desired outer cut off,
1.0f, 0.07f, 0.032f, // attenuation constants
//desired ambience, //desired diffusion, //desired specular value
};