Commit f4992a87 authored by BrutPitt's avatar BrutPitt
Browse files

ver. 1.4.2 Release

parent 75aeff48
......@@ -42,6 +42,7 @@ LAYOUT_BINDING(4) uniform _tMat {
mat4 mvMatrix;
mat4 mvpMatrix;
mat4 mvLightM;
mat4 mvpLightM;
} m;
in gl_PerVertex
......
......@@ -84,6 +84,7 @@ LAYOUT_BINDING(4) uniform _tMat {
mat4 mvMatrix;
mat4 mvpMatrix;
mat4 mvLightM;
mat4 mvpLightM;
} m;
#ifndef GL_ES
......
......@@ -173,9 +173,9 @@ void main()
if(depth<=.01) { discard; outColor = vec4(0.0); return; }
float z = restoreZ(depth);
vec4 vtx = vec4(viewRay * z, z, 1.0);
vec4 vtx = getVertexFromDepth(viewRay,z);
vec3 N = getSimpleNormal(z, prevData);
vec3 N = getSimpleNormal(vtx, prevData);
float AO = 0.0;
const int RAD = 64;
......
......@@ -79,6 +79,7 @@ LAYOUT_BINDING(4) uniform _tMat {
mat4 mvMatrix;
mat4 mvpMatrix;
mat4 mvLightM;
mat4 mvpLightM;
} m;
#if !defined(GL_ES) && !defined(GLCHAOSP_NO_USES_GLSL_SUBS)
......@@ -250,6 +251,18 @@ float restoreZ(float D)
#endif
}
vec4 getVertexFromDepth(vec2 uv, float z)
{
/*
vec4 vtx = vec4(uv, z, 1.0);
vtx = inverse(m.pMatrix) * vtx;
vtx /= vtx.w;
return vtx;
*/
return vec4(uv*z, z, 1.0);
}
float form_01_to_m1p1(float f) { return 2. * f - 1.; }
float form_m1p1_to_01(float f) { return f*.5 + .5; }
......@@ -274,6 +287,23 @@ float specularBlinnPhong(vec3 V, vec3 L, vec3 N)
}
float pow5(float x)
{
return (x * x) * (x * x) * x;
}
#define M_PI 3.141592653589793
// Material F linear F sRGB
// Water (0.02, 0.02, 0.02) (0.15, 0.15, 0.15)
// Plastic / Glass (Low) (0.03, 0.03, 0.03) (0.21, 0.21, 0.21)
// Plastic High (0.05, 0.05, 0.05) (0.24, 0.24, 0.24)
// Glass (high) / Ruby (0.08, 0.08, 0.08) (0.31, 0.31, 0.31)
// Diamond (0.17, 0.17, 0.17) (0.45, 0.45, 0.45)
// Iron (0.56, 0.57, 0.58) (0.77, 0.78, 0.78)
// Copper (0.95, 0.64, 0.54) (0.98, 0.82, 0.76)
// Gold (1.00, 0.71, 0.29) (1.00, 0.86, 0.57)
// Aluminium (0.91, 0.92, 0.92) (0.96, 0.96, 0.97)
// Silver (0.95, 0.93, 0.88) (0.98, 0.97, 0.95)
LAYOUT_INDEX(idxGGX) SUBROUTINE(_lightModel)
float specularGGX(vec3 V, vec3 L, vec3 N)
{
......@@ -284,19 +314,27 @@ float specularGGX(vec3 V, vec3 L, vec3 N)
float dotLH = max(0.0, dot(L,H));
float dotNH = max(0.0, dot(N,H));
float dotNL = max(0.0, dot(N,L));
float dotNV = max(0.0, dot(N,-V));
// D (GGX normal distribution)
float denom = dotNH * dotNH * (alphaSqr - 1.0) + 1.0;
float D = alphaSqr / (3.141592653589793 * denom * denom);
float D = alphaSqr / (M_PI * denom * denom);
// F (Fresnel term)
float F = u.ggxFresnel + (1.0 - u.ggxFresnel) * pow(1.0 - dotLH, 5.0);
float k = 0.5 * alpha;
float k2 = k * k;
// F (Fresnel term) - Schlick approx
//float F = u.ggxFresnel + (1.0 - u.ggxFresnel) * pow5(1.0 - dotLH);
float F = mix(pow5(1.0 - dotLH), 1.0, u.ggxFresnel);
return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2);
}
//float k = 0.5 * alpha; // IBL lighting
float k = (alpha + 2.0 * u.ggxRoughness + 1.0) * .125; //direct light approssimation - divided 8.0 -> *.125
//float G = dotNL*dotNV / ((dotNL * (1.0 - k) + k) * (dotNV * (1. - k) + k));
float G = dotNL / mix(dotNL, 1.0, k) * mix(dotNV, 1.0, k); // *dotNV -> normalized
return D * F * G;
//float k2 = k * k;
//return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2);
}
vec4 getParticleNormal(vec2 coord)
{
......@@ -309,26 +347,29 @@ vec4 getParticleNormal(vec2 coord)
return N;
}
vec3 getSimpleNormal(float z, sampler2D depthData)
{
float gradA = restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2( 1., 0.)), 0).w) - z;
float gradB = restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2( 0., 1.)), 0).w) - z;
//float gradA = restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2( 1., 0.)), 0).w) - z;
//float gradB = restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2( 0., 1.)), 0).w) - z;
float gradA = restoreZ(texture(depthData,(gl_FragCoord.xy + vec2( 1., 0.))*u.invScrnRes ).w) - z;
float gradB = restoreZ(texture(depthData,(gl_FragCoord.xy + vec2( 0., 1.))*u.invScrnRes ).w) - z;
vec2 m = u.invScrnRes * -z;// * vec2(u.scrnRes.x/u.scrnRes.y * u.halfTanFOV, u.halfTanFOV);
float invTanFOV = u.dpAdjConvex/u.halfTanFOV;
float invTanFOV = u.dpAdjConvex /u.halfTanFOV;
//vec3 N0 = cross(vec3(vec2( 1., 0.)*m, gradA*invTanFOV), vec3(vec2( 0., 1.)*m, gradB*invTanFOV));
vec3 N0 = cross(vec3(vec2( 1., 0.)*m, gradA*invTanFOV), vec3(vec2( 0., 1.)*m, gradB*invTanFOV));
return normalize (N0);
}
vec3 getSelectedNormal(float z, sampler2D depthData)
{
float gradA = restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2( 1., 0.)), 0).w) - z;
float gradB = restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2( 0., 1.)), 0).w) - z;
float gradC = z - restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2(-1., 0.)), 0).w);
float gradD = z - restoreZ(texelFetch(depthData,ivec2(gl_FragCoord.xy + vec2( 0.,-1.)), 0).w);
float gradA = restoreZ(texture(depthData,(gl_FragCoord.xy + vec2( 1., 0.))*u.invScrnRes ).w) - z;
float gradB = restoreZ(texture(depthData,(gl_FragCoord.xy + vec2( 0., 1.))*u.invScrnRes ).w) - z;
float gradC = z - restoreZ(texture(depthData,(gl_FragCoord.xy + vec2(-1., 0.))*u.invScrnRes ).w);
float gradD = z - restoreZ(texture(depthData,(gl_FragCoord.xy + vec2( 0.,-1.))*u.invScrnRes ).w);
vec2 m = u.invScrnRes * -z; //vec2(u.scrnRes.x/u.scrnRes.y * u.halfTanFOV, u.halfTanFOV);
float invTanFOV = u.dpAdjConvex/u.halfTanFOV;
......@@ -341,6 +382,60 @@ vec3 getSelectedNormal(float z, sampler2D depthData)
return normalize (N0);
}
vec2 getFOVPos(vec2 pos)
{
return (pos*2.0-1.0) * vec2(u.scrnRes.x*u.invScrnRes.y * u.halfTanFOV, u.halfTanFOV);
}
vec3 getSimpleNormal(vec4 vtx, sampler2D depthData)
{
vec2 uv1 = (gl_FragCoord.xy + vec2( 1., 0.))*u.invScrnRes;
vec2 uv2 = (gl_FragCoord.xy + vec2( 0., 1.))*u.invScrnRes;
float gradA = restoreZ(texture(depthData, uv1).w);
float gradB = restoreZ(texture(depthData, uv2).w);
vec4 vtxA = getVertexFromDepth(getFOVPos(uv1), gradA);
vec4 vtxB = getVertexFromDepth(getFOVPos(uv2), gradB);
vec3 invTanFOV = vec3(1.0, 1.0, u.dpAdjConvex);
vec3 v1 = (vtx.xyz-vtxA.xyz) * invTanFOV;
vec3 v2 = (vtx.xyz-vtxB.xyz) * invTanFOV;
vec3 N0 = cross(v1,v2);
return normalize (vec3(-N0.xy, N0.z));
}
vec3 getSelectedNormal(vec4 vtx, sampler2D depthData)
{
vec2 uv1 = (gl_FragCoord.xy + vec2( 1., 0.))*u.invScrnRes;
vec2 uv2 = (gl_FragCoord.xy + vec2( 0., 1.))*u.invScrnRes;
vec2 uv3 = (gl_FragCoord.xy + vec2(-1., 0.))*u.invScrnRes;
vec2 uv4 = (gl_FragCoord.xy + vec2( 0.,-1.))*u.invScrnRes;
float gradA = restoreZ(texture(depthData, uv1).w);
float gradB = restoreZ(texture(depthData, uv2).w);
float gradC = restoreZ(texture(depthData, uv3).w);
float gradD = restoreZ(texture(depthData, uv4).w);
vec4 vtxA = getVertexFromDepth(getFOVPos(uv1), gradA);
vec4 vtxB = getVertexFromDepth(getFOVPos(uv2), gradB);
vec4 vtxC = getVertexFromDepth(getFOVPos(uv3), gradC);
vec4 vtxD = getVertexFromDepth(getFOVPos(uv4), gradD);
vec3 invTanFOV = vec3(1.0, 1.0, u.dpAdjConvex);
float z = vtx.z;
//vec3 V1 = (abs(dotA-dotC)<u.dpNormalTune && dotA<dotC ? (vtx.xyz-vtxA.xyz) : (vtxC.xyz-vtx.xyz)) * invTanFOV;
//vec3 V2 = (abs(dotB-dotD)<u.dpNormalTune && dotB<dotD ? (vtx.xyz-vtxB.xyz) : (vtxD.xyz-vtx.xyz)) * invTanFOV;
vec3 V1 = (abs(gradA-gradC)>=u.dpNormalTune && abs(gradA-z)<abs(z-gradC) ? (vtx.xyz-vtxA.xyz) : (vtxC.xyz-vtx.xyz)) * invTanFOV;
vec3 V2 = (abs(gradB-gradD)>=u.dpNormalTune && abs(gradB-z)<abs(z-gradD) ? (vtx.xyz-vtxB.xyz) : (vtxD.xyz-vtx.xyz)) * invTanFOV;
vec3 N0 = cross(V1, V2);
return normalize (vec3(-N0.xy, N0.z));
}
#define RENDER_AO uint(1)
#define RENDER_DEF uint(2)
#define RENDER_SHADOW uint(4)
......@@ -36,7 +36,6 @@ vec2 poissonDisk[16] = vec2[](
);
in vec2 viewRay;
in vec2 viewRayLight;
in vec2 vTexCoord;
out vec4 outColor;
......@@ -143,7 +142,7 @@ vec4 SampleTextureCatmullRom( vec2 uv)
return result;
}
float getStrognAO(float AO)
float getStrongAO(float AO)
{
return u.aoStrong<.001 ? 1.0 : pow(AO,u.aoStrong);
}
......@@ -171,7 +170,7 @@ vec4 pixelColorLight(vec3 vtx, vec4 color, vec4 N, float AO, float shadow)
float specular = lightModel(V, light, N.xyz);
#endif
float aoD = getStrognAO(AO);
float aoD = getStrongAO(AO);
vec3 lColor = smoothstep(u.sstepColorMin, u.sstepColorMax,
(aoD*color.rgb * u.lightColor * lambertian * u.lightDiffInt + //diffuse component
u.lightColor * specular * u.lightSpecInt) * shadow +
......@@ -293,20 +292,20 @@ float buildSmoothScattereShadow(vec4 frag)
float buildSmoothShadow(vec4 frag)
{
vec4 pt = vec4(viewRay*-frag.z, frag.z, 1.0);
//vec4 pt = vec4(viewRay*-frag.z, frag.z, 1.0);
vec4 pt = getVertexFromDepth(-viewRay, frag.z);
//float dist = distance(pt.xyz,
vec4 fragPosLightSpace = m.mvpLightM * pt;
mat4 tMat = m.pMatrix * m.mvLightM;
vec4 fragPosLightSpace = tMat * pt;
// perform perspective divide and port to [0,1] range
vec3 projCoords = 0.5 * (fragPosLightSpace.xyz)/fragPosLightSpace.w + .5;
if(projCoords.z>1.0) return 0.0;
// get depth of current fragment from light's perspective
//float bias = 0.005 * tan(acos(clamp(dot(normalize(u.lightDir),frag.xyz), 0., .9999)));
float currentDepth = restoreZ(projCoords.z) + u.shadowBias;
float currentDepth = restoreZ(projCoords.z);
currentDepth += -currentDepth*.0025 + u.shadowBias;
vec2 stepTex = u.shadowGranularity*u.invScrnRes;
......@@ -320,7 +319,7 @@ float buildSmoothShadow(vec4 frag)
float closestDepth = restoreZ(texture(shadowTex, projCoords.xy+vec2(x,y)*stepTex).r);
shadow += (currentDepth < closestDepth ? u.shadowDarkness*u.shadowDarkness*invDiv : invDiv) ; // 1.0/9.0
/*
/* Real more accuracy ???
vec4 pt = vec4((viewRay+vec2(x,y)*stepTex)*-frag.z-(vec2(x,y)*stepTex), frag.z, 1.0);
vec4 fragPosLightSpace = tMat * pt;
......@@ -395,7 +394,7 @@ void main()
if(depth<=.01) { discard; outColor = vec4(0.0); return; }
float z = restoreZ(depth);
vec4 vtx = vec4(viewRay *z, z, 1.0);
vec4 vtx = getVertexFromDepth(viewRay, z);
//float AO = bicubic(uv, 3); //texelFetch(aoTex,ivec2(uv), 0).w;
float AO = bool(u.pass&RENDER_AO) ? getBlurredAO(uv) : 1.0;
......@@ -408,13 +407,19 @@ void main()
//vec3 N = blurredNormals(uv).xyz;
//vec3 N = 2.0 * texelFetch(aoTex,ivec2(uv), 0).xyz - 1.0;
vec3 N = getSelectedNormal(z, prevData);
//vec3 N = getSimpleNormal(z, prevData);
//vec4 N = vec4(getSelectedNormal(z, prevData), 1.0);
vec4 N = vec4(getSelectedNormal(vtx, prevData), 1.0);
//vec4 N = vec4(getSimpleNormal(vtx, prevData), 1.0);
vec4 color = texture(prevData,uv);
vtx = vec4(viewRay, z, 1.0);
vtx = inverse(m.pMatrix) * vtx;
vtx /= vtx.w;
outColor = pixelColorLight(vtx.xyz, color, vec4(N, 1.0), AO, shadow);
outColor = pixelColorLight(vtx.xyz, color, N, AO, shadow);
//outColor = vec4(AO);
......@@ -430,7 +435,7 @@ void main()
vec3 lightColor = unPackColor8(packedColor.x).yzw;
vec3 baseColor = unPackColor8(packedColor.y).yzw;
*/
float aoD = getStrognAO(AO);
float aoD = getStrongAO(AO);
lightColor = smoothstep(u.sstepColorMin, u.sstepColorMax,
aoD *lightColor * shadow +
AO * (baseColor*u.lightAmbInt + vec3(u.lightAmbInt)) * .5);
......
......@@ -79,7 +79,6 @@ LAYOUT_BINDING(9) uniform _clippingPlanes {
} pl;
out vec2 viewRay;
out vec2 viewRayLight;
#if !defined(GL_ES)
out gl_PerVertex
......@@ -96,5 +95,4 @@ void main(void)
vTexCoord = texCoord[gl_VertexID];
gl_Position = vec4(vPos.xy,.0f,1.f);
viewRay = vPos.xy * vec2(u.scrnRes.x*u.invScrnRes.y * u.halfTanFOV, u.halfTanFOV);
viewRayLight = vPos.xy * vec2(u.scrnRes.x*u.invScrnRes.y * tan(radians(45.0)*.5), tan(radians(45.0)*.5));
}
\ No newline at end of file
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -153,7 +153,7 @@ set(CMAKE_EXECUTABLE_SUFFIX ".html")
else()
if(${CMAKE_BUILD_TYPE} MATCHES "MinSizeRel")
# one file no memory option: -s SINGLE_FILE=1 --memory-init-file 0
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(M_EMCC_BINARYEN "--no-heap-copy --closure 1 -s WASM=1 -s LZ4=1")
set(M_EMCC_SHELL_FILE "--shell-file \"${CMAKE_SOURCE_DIR}/mVeryMinimal.html\"")
else() # Release
......@@ -183,8 +183,8 @@ set(CMAKE_EXECUTABLE_SUFFIX ".html")
# -s FULL_ES3=1 -s OFFSCREENCANVAS_SUPPORT=1
set(M_EMCC_OGL_OPTIONS "-s USE_WEBGL2=1 -s USE_GLFW=3 -s LEGACY_GL_EMULATION=0 -s OFFSCREENCANVAS_SUPPORT=1 ")
# merge all EMCC_OPTIONS -s BINARYEN_TRAP_MODE=clamp
set(M_EMCC_OPTIONS "-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s ALLOW_MEMORY_GROWTH=1 -s PRECISE_F32=1 ${M_EMCC_SHELL_FILE} ${M_EMCC_OGL_OPTIONS} ${M_EMCC_BINARYEN} ${M_EMCC_EMBED_FILES}")
# merge all EMCC_OPTIONS -s BINARYEN_TRAP_MODE=clamp -s PRECISE_F32=1 -s PRECISE_F32=1
set(M_EMCC_OPTIONS "-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s ALLOW_MEMORY_GROWTH=1 ${M_EMCC_SHELL_FILE} ${M_EMCC_OGL_OPTIONS} ${M_EMCC_BINARYEN} ${M_EMCC_EMBED_FILES}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${EMSOUT}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${M_GLOBAL_FLAGS} ${OGL_EMITTER_TYPE} ${M_EMCC_FLAGS} ${M_EMCC_OPTIONS} ${GLAPP_DISABLE_DLA} -Wno-parentheses -Wno-format-security -Wno-logical-op-parentheses -Wno-unused-value -Wdelete-non-virtual-dtor")
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2026
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Particles", "Particles.vcxproj", "{7BE468C8-02A3-41A6-9553-99A208C2D4D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug noThread OpenGL 4.1|Win32 = Debug noThread OpenGL 4.1|Win32
Debug noThread OpenGL 4.1|x64 = Debug noThread OpenGL 4.1|x64
Debug OpenGL 4.1|Win32 = Debug OpenGL 4.1|Win32
Debug OpenGL 4.1|x64 = Debug OpenGL 4.1|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release noThread OpenGL 4.1|Win32 = Release noThread OpenGL 4.1|Win32
Release noThread OpenGL 4.1|x64 = Release noThread OpenGL 4.1|x64
Release OpenGL 4.1|Win32 = Release OpenGL 4.1|Win32
Release OpenGL 4.1|x64 = Release OpenGL 4.1|x64
Release Viewports|Win32 = Release Viewports|Win32
Release Viewports|x64 = Release Viewports|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug noThread OpenGL 4.1|Win32.ActiveCfg = Debug noThread OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug noThread OpenGL 4.1|Win32.Build.0 = Debug noThread OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug noThread OpenGL 4.1|x64.ActiveCfg = Debug noThread OpenGL 4.1|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug noThread OpenGL 4.1|x64.Build.0 = Debug noThread OpenGL 4.1|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug OpenGL 4.1|Win32.ActiveCfg = Debug OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug OpenGL 4.1|Win32.Build.0 = Debug OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug OpenGL 4.1|x64.ActiveCfg = Debug OpenGL 4.1|x64
......@@ -33,14 +27,14 @@ Global
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug|Win32.Build.0 = Debug|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug|x64.ActiveCfg = Debug|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Debug|x64.Build.0 = Debug|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release noThread OpenGL 4.1|Win32.ActiveCfg = Release singleThread OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release noThread OpenGL 4.1|Win32.Build.0 = Release singleThread OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release noThread OpenGL 4.1|x64.ActiveCfg = Release singleThread OpenGL 4.1|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release noThread OpenGL 4.1|x64.Build.0 = Release singleThread OpenGL 4.1|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release OpenGL 4.1|Win32.ActiveCfg = Release OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release OpenGL 4.1|Win32.Build.0 = Release OpenGL 4.1|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release OpenGL 4.1|x64.ActiveCfg = Release OpenGL 4.1|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release OpenGL 4.1|x64.Build.0 = Release OpenGL 4.1|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release Viewports|Win32.ActiveCfg = Release Viewports|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release Viewports|Win32.Build.0 = Release Viewports|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release Viewports|x64.ActiveCfg = Release Viewports|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release Viewports|x64.Build.0 = Release Viewports|x64
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release|Win32.ActiveCfg = Release|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release|Win32.Build.0 = Release|Win32
{7BE468C8-02A3-41A6-9553-99A208C2D4D9}.Release|x64.ActiveCfg = Release|x64
......
This diff is collapsed.
......@@ -12,25 +12,18 @@
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug noThread OpenGL 4.1|Win32'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release OpenGL 4.1|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Viewports|Win32'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release singleThread OpenGL 4.1|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release OpenGL 4.1|Win32'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
......@@ -48,25 +41,18 @@
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug noThread OpenGL 4.1|x64'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release OpenGL 4.1|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Viewports|x64'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release singleThread OpenGL 4.1|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release OpenGL 4.1|x64'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
......
......@@ -100,13 +100,8 @@ void particlesBaseClass::clearScreenBuffers()
glClearBufferfv(GL_DEPTH , 0, &f);
}
#if !defined(GLCHAOSP_LIGHTVER)
if(showAxes() == noShowAxes) glClear(GL_COLOR_BUFFER_BIT); //glClearBufferfv(GL_COLOR, GL_DRAW_BUFFER, value_ptr(vec4(0.0f)));
if(!showAxes()) glClearBufferfv(GL_COLOR, 0, value_ptr(backgroundColor()));
if(blendActive || showAxes()) {
#else
glClearBufferfv(GL_COLOR, 0, value_ptr(vec4(0.0f)));
if(blendActive) {
#endif
glEnable(GL_BLEND);
glBlendFunc(getSrcBlend(), getDstBlend());
}
......@@ -126,6 +121,7 @@ void particlesBaseClass::restoreGLstate()
GLuint particlesBaseClass::render(GLuint fbIdx, emitterBaseClass *emitter)
{
const GLsizei shadowDetail = theApp->useDetailedShadows() ? GLsizei(2) : GLsizei(1);
const float lightReduction = theApp->useDetailedShadows() ? .3333 : .25f;
auto updateCommons = [&] () {
getUData().scrnRes = vec2(getRenderFBO().getSizeX(), getRenderFBO().getSizeY());
......@@ -147,13 +143,14 @@ GLuint particlesBaseClass::render(GLuint fbIdx, emitterBaseClass *emitter)
} else getUPlanes().atLeastOneActive = false;
};
const bool isAO_RD_SHDW = ( useAO() || postRenderingActive() || useShadow());
const bool blendActive = getBlendState() || showAxes();
const bool isAO_SHDW = ( useAO() || useShadow());
const bool isAO_RD_SHDW = (isAO_SHDW || postRenderingActive());
const bool isSolid = ( getDepthState() || getLightState());
const bool isShadow = ( useShadow() && isSolid);
const uint idxPixelColor =
uData.renderType = (getBlendState() && !isSolid) ? pixColIDX::pixBlendig :
getBlendState() || !isAO_RD_SHDW ? pixColIDX::pixDirect :
uData.renderType = (blendActive && !isSolid) ? pixColIDX::pixBlendig :
blendActive || !isAO_RD_SHDW ? pixColIDX::pixDirect :
isAO_SHDW && !postRenderingActive() ? pixColIDX::pixAO :
pixColIDX::pixDR ;
auto selectSubroutines = [&]() {
......@@ -193,11 +190,12 @@ GLuint particlesBaseClass::render(GLuint fbIdx, emitterBaseClass *emitter)
getUData().zNear = getTMat()->getPerspNear();
getUData().zFar = getTMat()->getPerspFar();
//getUData().zFar = getTMat()->getPOV().z*3.f;
// Shadow pass
/////////////////////////////////////////////
#if !defined(GLCHAOSP_LIGHTVER) || defined(GLCHAOSP_LIGHTVER_EXPERIMENTAL)
if(isShadow && !getBlendState()) {
if(isShadow && !blendActive) {
if(shadowDetail>1) glViewport(0,0, getWidth()*shadowDetail, getHeight()*shadowDetail);
if(autoLightDist()) {
vec3 vL(normalize(getLightDir()));
......@@ -217,10 +215,11 @@ GLuint particlesBaseClass::render(GLuint fbIdx, emitterBaseClass *emitter)
getPlanesUBlock().updateBufferData();
tMat.setLightView(getLightDir()*.25f);
tMat.setLightView(getLightDir()*lightReduction);
tMat.tM.mvLightM = tMat.tM.mvLightM * tMat.tM.mMatrix;
tMat.updateBufferData();
updateBufferData();
......@@ -283,14 +282,15 @@ GLuint particlesBaseClass::render(GLuint fbIdx, emitterBaseClass *emitter)
#if defined(GLCHAOSP_LIGHTVER_EXPERIMENTAL)
if(!getBlendState() && isAO_RD_SHDW) {
#else
if(!getBlendState() && isAO_RD_SHDW && !showAxes()) {
if(!blendActive && isAO_RD_SHDW) {
#endif
tMat.setLightView(getLightDir()*.25f);
tMat.setLightView(getLightDir()*lightReduction);
mat4 m(1.f);
m = translate(m,getTMat()->getPOV()/*+getTMat()->getTrackball().getPosition()*/);
//m = translate(m,getTMat()->getPOV());
tMat.tM.mvLightM = getTMat()->tM.mvLightM * m;
tMat.tM.mvpLightM = tMat.tM.pMatrix * tMat.tM.mvLightM;
getUData().halfTanFOV = tanf(getTMat()->getPerspAngleRad()*.5);
......@@ -914,8 +914,6 @@ GLuint fxaaClass::render(GLuint texIn)
#else
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#endif
//glClearBufferfv(GL_COLOR, 0, value_ptr(vec4(0.0f)));
//glClear(GL_COLOR_BUFFER_BIT);
#ifdef GLAPP_REQUIRE_OGL45
glBindTextureUnit(0, texIn);
......@@ -1007,7 +1005,15 @@ void postRenderingClass::bindRender()
bindPipeline();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo.getFB(0));
glClearBufferfv(GL_COLOR, 0, value_ptr(vec4(0.0f)));
#ifdef GLCHAOSP_LIGHTVER
const vec4 bkg(theWnd->getParticlesSystem()->shaderPointClass::backgroundColor());
#else
const vec4 bkg(renderEngine->getWhitchRenderMode()==RENDER_USE_POINTS ?
theWnd->getParticlesSystem()->shaderPointClass::backgroundColor() :
theWnd->getParticlesSystem()->shaderBillboardClass::backgroundColor());
#endif
glClearBufferfv(GL_COLOR, 0, value_ptr(bkg));
......@@ -1153,7 +1159,15 @@ void ambientOcclusionClass::bindRender()
bindPipeline();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo.getFB(0));
glClearBufferfv(GL_COLOR, 0, value_ptr(vec4(0.0f)));
#ifdef GLCHAOSP_LIGHTVER
const vec4 bkg(theWnd->getParticlesSystem()->shaderPointClass::backgroundColor());
#else
const vec4 bkg(renderEngine->getWhitchRenderMode()==RENDER_USE_POINTS ?
theWnd->getParticlesSystem()->shaderPointClass::backgroundColor() :
theWnd->getParticlesSystem()->shaderBillboardClass::backgroundColor());
#endif
glClearBufferfv(GL_COLOR, 0, value_ptr(bkg));
#ifdef GLAPP_REQUIRE_OGL45
glBindTextureUnit(6, noiseTexture);
......@@ -1231,6 +1245,13 @@ void shadowClass::bindRender()
const GLfloat f=1.0f;
glClearBufferfv(GL_DEPTH , 0, &f);
// for Chrome76 message: "texture is not renderable" if only zBuffer... need ColorBuffer
// FireFox68 Works fine also only with zBuffer w/o ColorBuffer