sun shines brughter

This commit is contained in:
Pawel Felcyn 2024-01-04 21:48:56 +01:00
parent 656756dc0a
commit 60a5c80adc
3 changed files with 9 additions and 9 deletions

View File

@ -9,8 +9,8 @@ uniform vec3 cameraPos;
uniform vec3 color; uniform vec3 color;
uniform vec3 sunDir; //uniform vec3 sunDir;
uniform vec3 sunColor; //uniform vec3 sunColor;
uniform vec3 lightPos; uniform vec3 lightPos;
uniform vec3 lightColor; uniform vec3 lightColor;
@ -114,7 +114,7 @@ void main()
vec3 ambient = AMBIENT*color; vec3 ambient = AMBIENT*color;
vec3 attenuatedlightColor = lightColor/pow(length(lightPos-worldPos),2); vec3 attenuatedlightColor = lightColor/pow(length(lightPos-worldPos),2);
vec3 ilumination; vec3 ilumination;
ilumination = ambient+PBRLight(lightDir,attenuatedlightColor,normal,viewDir); ilumination = ambient+PBRLight(lightDir,attenuatedlightColor * 300,normal,viewDir);
//flashlight //flashlight
//vec3 spotlightDir= normalize(spotlightDirTS); //vec3 spotlightDir= normalize(spotlightDirTS);
@ -126,7 +126,7 @@ void main()
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir); ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//sun //sun
ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir); //ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1); outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);

View File

@ -15,12 +15,12 @@ out vec3 worldPos;
uniform vec3 lightPos; uniform vec3 lightPos;
uniform vec3 spotlightPos; uniform vec3 spotlightPos;
uniform vec3 cameraPos; uniform vec3 cameraPos;
uniform vec3 sunDir; //uniform vec3 sunDir;
out vec3 viewDirTS; out vec3 viewDirTS;
out vec3 lightDirTS; out vec3 lightDirTS;
out vec3 spotlightDirTS; out vec3 spotlightDirTS;
out vec3 sunDirTS; //out vec3 sunDirTS;
void main() void main()
{ {
@ -38,6 +38,6 @@ void main()
lightDirTS = TBN*L; lightDirTS = TBN*L;
vec3 SL = normalize(spotlightPos-worldPos); vec3 SL = normalize(spotlightPos-worldPos);
spotlightDirTS = TBN*SL; spotlightDirTS = TBN*SL;
sunDirTS = TBN*sunDir; //sunDirTS = TBN*sunDir;
} }

View File

@ -88,8 +88,8 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
glm::vec3 lightsColors[NUM_LIGHTS]; glm::vec3 lightsColors[NUM_LIGHTS];
glm::vec3 lightsDirections[NUM_LIGHTS]; glm::vec3 lightsDirections[NUM_LIGHTS];
glUniform3f(glGetUniformLocation(program, "sunDir"), sun.sunDir.x, sun.sunDir.y, sun.sunDir.z); /*glUniform3f(glGetUniformLocation(program, "sunDir"), sun.sunDir.x, sun.sunDir.y, sun.sunDir.z);
glUniform3f(glGetUniformLocation(program, "sunColor"), sun.sunColor.x, sun.sunColor.y, sun.sunColor.z); glUniform3f(glGetUniformLocation(program, "sunColor"), sun.sunColor.x, sun.sunColor.y, sun.sunColor.z);*/
glUniform3f(glGetUniformLocation(program, "lightPos"), sun.sunPos.x, sun.sunPos.y, sun.sunPos.z); glUniform3f(glGetUniformLocation(program, "lightPos"), sun.sunPos.x, sun.sunPos.y, sun.sunPos.z);
glUniform3f(glGetUniformLocation(program, "lightColor"), sun.sunColor.x, sun.sunColor.y, sun.sunColor.z); glUniform3f(glGetUniformLocation(program, "lightColor"), sun.sunColor.x, sun.sunColor.y, sun.sunColor.z);