tonemapping

This commit is contained in:
Natalia Nowakowska 2024-01-14 23:39:28 +01:00
parent 471f466b4e
commit be237d4822
35 changed files with 46 additions and 25 deletions

Binary file not shown.

BIN
grk/.vs/grk-cw/v16/.suo Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
grk/Debug/grk-cw6.exe Normal file

Binary file not shown.

BIN
grk/Debug/grk-cw6.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>E:\micha\studia\grafika_komputerowa\grk\grk\Debug\grk-cw6.exe</FullPath>
<FullPath>D:\grk2024\dgrk-2023-planeta\grk\Debug\grk-cw6.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />

View File

@ -1,39 +1,39 @@
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(513,5): warning MSB8028: The intermediate directory (Debug\) contains files shared from another project (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj). This can lead to incorrect clean and rebuild behavior.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(491,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji.
main.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
E:\micha\studia\grafika_komputerowa\grk\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY'
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(96,16): warning C4305: 'initializing': truncation from 'double' to 'float'
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(152,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(156,52): warning C4305: 'argument': truncation from 'double' to 'T'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
D:\grk2024\dgrk-2023-planeta\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : zobacz poprzednią definicję „APIENTRY”
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(96,16): warning C4305: "inicjowanie": obcięcie z "double" do "float"
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(153,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(157,52): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(160,50): warning C4305: 'argument': truncation from 'double' to 'T'
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(161,50): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(164,49): warning C4305: 'argument': truncation from 'double' to 'T'
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(165,49): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(168,48): warning C4305: 'argument': truncation from 'double' to 'T'
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(169,48): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(172,48): warning C4305: 'argument': truncation from 'double' to 'T'
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(173,48): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
E:\micha\studia\grafika_komputerowa\grk\grk\cw 6\src\ex_6_1.hpp(176,48): warning C4305: 'argument': truncation from 'double' to 'T'
D:\grk2024\dgrk-2023-planeta\grk\cw 6\src\ex_6_1.hpp(177,48): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
Box.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
grk-cw6.vcxproj -> E:\micha\studia\grafika_komputerowa\grk\grk\Debug\grk-cw6.exe
Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka
grk-cw6.vcxproj -> D:\grk2024\dgrk-2023-planeta\grk\Debug\grk-cw6.exe

View File

@ -1,2 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|E:\micha\studia\grafika_komputerowa\grk\grk\|
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|D:\grk2024\dgrk-2023-planeta\grk\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,21 +4,35 @@ float AMBIENT = 0.1;
uniform vec3 color;
uniform vec3 lightPos;
uniform vec3 lightColor;
in vec3 vecNormal;
in vec3 worldPos;
in vec2 vtc;
vec4 textureColor;
out vec4 outColor;
vec3 outputColor;
uniform sampler2D colorTexture;
vec3 toneMapping(vec3 color){
float exposure = 0.06;
vec3 mapped = 1 - exp(-color*exposure);
return mapped;
}
void main()
{
vec3 lightDir = normalize(lightPos - worldPos);
vec3 normal = normalize(vecNormal);
float diffuse = max(0, dot(normal, lightDir));
textureColor = texture2D(colorTexture, vtc);
vec3 distance = lightColor/(lightPos - worldPos)*(lightPos - worldPos);
outputColor = vec3(textureColor) * min(1, AMBIENT + diffuse)* distance;
//gamma correction
//outputColor = pow(outputColor, vec3(1.0/2.2));
vec4 textureColor = texture2D(colorTexture, vtc);
outColor = vec4(vec3(textureColor) * min(1, AMBIENT + diffuse), 1.0);
outputColor = toneMapping(outputColor);
outColor = vec4(outputColor , 1.0);
}

View File

@ -51,7 +51,7 @@ glm::vec3 shipDir = glm::vec3(1.f, 0.f, 0.f);
float aspectRatio = 1.f;
glm::vec3 lightColor = glm::vec3(0.9, 0.7, 0.8);
glm::vec3 lightColor = glm::vec3(100.f, 100.f, 100.f);
glm::mat4 createCameraMatrix()
{
@ -117,7 +117,8 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(programTex, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(programTex, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
glUniform3f(glGetUniformLocation(program, "lightPos"), 0.0, 0.0, 0.0);
glUniform3f(glGetUniformLocation(programTex, "lightPos"), 0.0, 0.0, 0.0);
glUniform3f(glGetUniformLocation(programTex, "lightColor"), lightColor.x, lightColor.y, lightColor.z);
Core::DrawContext(context);
glUseProgram(0);
}

View File

@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.852
# Visual Studio Version 16
VisualStudioVersion = 16.0.31019.35
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grk-cw1", "cw 1\grk-cw1.vcxproj", "{1B448102-E76C-4347-BDC7-40D02A567DB6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grk-cw6", "cw 6\grk-cw6.vcxproj", "{3952C396-B1C6-44CD-96DD-C1AC15D32978}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@ -15,6 +17,10 @@ Global
{1B448102-E76C-4347-BDC7-40D02A567DB6}.Debug|x86.Build.0 = Debug|Win32
{1B448102-E76C-4347-BDC7-40D02A567DB6}.Release|x86.ActiveCfg = Release|Win32
{1B448102-E76C-4347-BDC7-40D02A567DB6}.Release|x86.Build.0 = Release|Win32
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Debug|x86.ActiveCfg = Debug|Win32
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Debug|x86.Build.0 = Debug|Win32
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Release|x86.ActiveCfg = Release|Win32
{3952C396-B1C6-44CD-96DD-C1AC15D32978}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE