Skip to content

Commit

Permalink
ambinet lighting in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Try committed Mar 4, 2024
1 parent 073174c commit 8b47916
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion game/graphics/sky/sky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void Sky::updateLight(const int64_t now) {

Vec3 direct;
direct = Vec3(1.0f) * DirectSunLux;
ambient = groundAlbedo * DirectSunLux * aDirect * sunOcclude * 0.03f;// * scale;
ambient = groundAlbedo * DirectSunLux * aDirect * sunOcclude * 0.02f;

sun.setColor(direct*sunMul);
ambient = ambient*ambMul;
Expand Down
2 changes: 1 addition & 1 deletion game/world/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ void World::execTriggerEvent(const TriggerEvent& e) {
if(e.target=="EVT_LEFT_ROOM_01_TRAP_MOVER_FOR_DMG_MASTER" ||
e.target=="EVT_LEFT_UP_01_TOGGLE_TRIGGER_01" ||
e.target=="EVT_RIGHT_ROOM_01_SPAWN_ROT_02_SOUND")
return; // known problem on dragonisland.zen, skop for now
return; // known problem on dragonisland.zen, skip for now
Tempest::Log::d("unable to process trigger: \"",e.target,"\"");
}
}
Expand Down
2 changes: 1 addition & 1 deletion shader/common.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const float Fd_LambertInv = (M_PI);
/* Color value is multiplied to achive adequate albedo and correctness in GI.
* Need to scale it back, when material receives direct light.
*/
const float GColorScaleInv = (6);
const float GColorScaleInv = 8;//(6);
const float GColorScale = (1.0/GColorScaleInv);

float linearDepth(float d, vec3 clipInfo) {
Expand Down
1 change: 1 addition & 0 deletions shader/lighting/ambient_light.frag
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ void main() {
outColor = vec4(color, 1);
// outColor = vec4(vec3(1-ao), 0);
// outColor = vec4(linear, 0);
// outColor = vec4(srgbEncode(linear), 0);
}
5 changes: 2 additions & 3 deletions shader/lighting/rt/probe_lighting.comp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ vec3 resolveMiss(const vec3 rayOrigin, const vec3 rayDirection) {
}

vec3 resolveSecondBounce(vec3 pos, vec3 norm, uint selfProbeId) {
return scene.ambient;
return scene.ambient;// * 2.0;

// doesn't look coherent yet - need to keep offscreen data for long term
const ivec3 gridPos = ivec3(round(pos/(probeGridStep*1)));
Expand All @@ -115,8 +115,7 @@ vec3 resolveSecondBounce(vec3 pos, vec3 norm, uint selfProbeId) {

// probeId = selfProbeId;
// return vec3(0.01,0,0)*scene.GSunIntensity;
const vec3 ambient = scene.ambient;
return ambient * 4.0 * Fd_LambertInv;
return scene.ambient;
// return resolveMiss(pos, -norm);
// return vec3(0);
}
Expand Down
10 changes: 5 additions & 5 deletions shader/lighting/sky_exposure.comp
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@ void main() {
const float cldVal = textureLod(cloudsLUT, vec2(scene.isNight,0), 0).a;
const float clouds = (1.0 - pow(cldVal, 4));

const vec3 sunColor = scene.sunColor * tr * clouds;
const vec3 ambient = scene.ambient * tr;// * clouds;
const vec3 sunColor = scene.sunColor * tr;// * clouds;
const vec3 ambient = scene.ambient * tr;// * clouds;

vec3 light = sunColor*Fd_Lambert*1.5 + ambient + skyIrradiance();
vec3 light = sunColor*Fd_Lambert*1.25 + ambient + skyIrradiance();
float lum = (vmax+vmin) * 0.5 * scene.GSunIntensity;
//lum = dot(light, vec3(1.0/3.0));
lum = dot(light, vec3(0.2125, 0.7154, 0.0721))*0.6 + lum*0.4;

// float lum = tr.b;
scene.sunColor = sunColor * push.sunOcclusion;
scene.ambient = ambient;
scene.sunColor = sunColor * clouds * push.sunOcclusion;
scene.ambient = ambient * clouds;
scene.exposure = 1.0 / max(lum+push.baseL, 0.0000005);
scene.luminanceMed = lum;
}
Expand Down
3 changes: 2 additions & 1 deletion shader/lighting/tonemapping.frag
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void main() {
vec3 color = textureLod(textureD, uv, 0).rgb;
{
// outColor = vec4(srgbEncode(color), 1);
// outColor = vec4(color, 1);
// return;
}

Expand All @@ -134,7 +135,7 @@ void main() {
color = color * vec3(contrast);

// Tonemapping
color = acesTonemap(color);
color = acesTonemap(color)*1.28;

// Gamma
//color = srgbEncode(color);
Expand Down
4 changes: 3 additions & 1 deletion shader/lighting/tonemapping.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ vec3 textureLinear(vec3 rgb) {
// emissive objects, spells
return acesTonemapInv(linear);
#else
// return vec3(0.58, 0.49, 0.46); // brick
// return vec3(0.52, 0.41, 0.36); // wood
// return vec3(0.33, 0.34, 0.18); // leaves
// return vec3(0.48, 0.53, 0.30); // grass
// return vec3(0.9);
// return acesTonemapInv(linear*0.8);
// return acesTonemapInv(linear*0.78+0.001);
return acesTonemapInv(linear*0.78+0.001)*GColorScaleInv; // adjusted to have 'realistic' albedo values
#endif
}
Expand Down

0 comments on commit 8b47916

Please sign in to comment.