Update GI calculation
This commit is contained in:
parent
855191cd88
commit
9d7837dac6
@ -29,8 +29,8 @@ uniform vec2 ssaoTextureUVScale;
|
|||||||
|
|
||||||
float VisibilityOfSunLight_Map();
|
float VisibilityOfSunLight_Map();
|
||||||
float VisibilityOfSunLight_Model();
|
float VisibilityOfSunLight_Model();
|
||||||
vec3 Radiosity_Map(float detailAmbientOcclusion);
|
vec3 Radiosity_Map(float detailAmbientOcclusion, float ssao);
|
||||||
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction);
|
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction, float ssao);
|
||||||
|
|
||||||
float VisibilityOfSunLight() {
|
float VisibilityOfSunLight() {
|
||||||
return VisibilityOfSunLight_Map() *
|
return VisibilityOfSunLight_Map() *
|
||||||
@ -44,11 +44,17 @@ vec3 EvaluateSunLight(){
|
|||||||
vec3 EvaluateAmbientLight(float detailAmbientOcclusion) {
|
vec3 EvaluateAmbientLight(float detailAmbientOcclusion) {
|
||||||
#if USE_SSAO
|
#if USE_SSAO
|
||||||
float ssao = texture2D(ssaoTexture, gl_FragCoord.xy * ssaoTextureUVScale).x;
|
float ssao = texture2D(ssaoTexture, gl_FragCoord.xy * ssaoTextureUVScale).x;
|
||||||
detailAmbientOcclusion *= ssao;
|
#else
|
||||||
|
float ssao = 1.0;
|
||||||
#endif
|
#endif
|
||||||
return Radiosity_Map(detailAmbientOcclusion);
|
return Radiosity_Map(detailAmbientOcclusion, ssao);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 EvaluateDirectionalAmbientLight(float detailAmbientOcclusion, vec3 direction) {
|
vec3 EvaluateDirectionalAmbientLight(float detailAmbientOcclusion, vec3 direction) {
|
||||||
return BlurredReflection_Map(detailAmbientOcclusion, direction);
|
#if USE_SSAO
|
||||||
|
float ssao = texture2D(ssaoTexture, gl_FragCoord.xy * ssaoTextureUVScale).x;
|
||||||
|
#else
|
||||||
|
float ssao = 1.0;
|
||||||
|
#endif
|
||||||
|
return BlurredReflection_Map(detailAmbientOcclusion, direction, ssao);
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
float VisibilityOfSunLight_Map();
|
float VisibilityOfSunLight_Map();
|
||||||
float VisibilityOfSunLight_Model();
|
float VisibilityOfSunLight_Model();
|
||||||
vec3 Radiosity_Map(float detailAmbientOcclusion);
|
vec3 Radiosity_Map(float detailAmbientOcclusion, float ssao);
|
||||||
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction);
|
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction, float ssao);
|
||||||
|
|
||||||
float VisibilityOfSunLight() {
|
float VisibilityOfSunLight() {
|
||||||
return VisibilityOfSunLight_Map() *
|
return VisibilityOfSunLight_Map() *
|
||||||
@ -35,9 +35,9 @@ vec3 EvaluateSunLight(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec3 EvaluateAmbientLight(float detailAmbientOcclusion) {
|
vec3 EvaluateAmbientLight(float detailAmbientOcclusion) {
|
||||||
return Radiosity_Map(detailAmbientOcclusion);
|
return Radiosity_Map(detailAmbientOcclusion, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 EvaluateDirectionalAmbientLight(float detailAmbientOcclusion, vec3 direction) {
|
vec3 EvaluateDirectionalAmbientLight(float detailAmbientOcclusion, vec3 direction) {
|
||||||
return BlurredReflection_Map(detailAmbientOcclusion, direction);
|
return BlurredReflection_Map(detailAmbientOcclusion, direction, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ vec3 DecodeRadiosityValue(vec3 val){
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
vec3 Radiosity_Map(float detailAmbientOcclusion, float ssao) {
|
||||||
vec3 col = DecodeRadiosityValue
|
vec3 col = DecodeRadiosityValue
|
||||||
(texture3D(radiosityTextureFlat,
|
(texture3D(radiosityTextureFlat,
|
||||||
radiosityTextureCoord).xyz);
|
radiosityTextureCoord).xyz);
|
||||||
@ -52,7 +52,9 @@ vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
|||||||
(texture3D(radiosityTextureZ,
|
(texture3D(radiosityTextureZ,
|
||||||
radiosityTextureCoord).xyz);
|
radiosityTextureCoord).xyz);
|
||||||
col = max(col, 0.);
|
col = max(col, 0.);
|
||||||
col *= 1.5;
|
col *= 1.5 * ssao;
|
||||||
|
|
||||||
|
detailAmbientOcclusion *= ssao;
|
||||||
|
|
||||||
// ambient occlusion
|
// ambient occlusion
|
||||||
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
||||||
@ -67,7 +69,7 @@ vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
|||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction)
|
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction, float ssao)
|
||||||
{
|
{
|
||||||
vec3 col = DecodeRadiosityValue
|
vec3 col = DecodeRadiosityValue
|
||||||
(texture3D(radiosityTextureFlat,
|
(texture3D(radiosityTextureFlat,
|
||||||
@ -83,7 +85,9 @@ vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction)
|
|||||||
(texture3D(radiosityTextureZ,
|
(texture3D(radiosityTextureZ,
|
||||||
radiosityTextureCoord).xyz);
|
radiosityTextureCoord).xyz);
|
||||||
col = max(col, 0.);
|
col = max(col, 0.);
|
||||||
col *= 1.5;
|
col *= 1.5 * ssao;
|
||||||
|
|
||||||
|
detailAmbientOcclusion *= ssao;
|
||||||
|
|
||||||
// ambient occlusion
|
// ambient occlusion
|
||||||
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
||||||
|
@ -38,7 +38,7 @@ vec3 DecodeRadiosityValue(vec3 val){
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
vec3 Radiosity_Map(float detailAmbientOcclusion, float ssao) {
|
||||||
vec3 col = DecodeRadiosityValue
|
vec3 col = DecodeRadiosityValue
|
||||||
(texture3D(radiosityTextureFlat,
|
(texture3D(radiosityTextureFlat,
|
||||||
radiosityTextureCoord).xyz);
|
radiosityTextureCoord).xyz);
|
||||||
@ -53,7 +53,9 @@ vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
|||||||
(texture3D(radiosityTextureZ,
|
(texture3D(radiosityTextureZ,
|
||||||
radiosityTextureCoord).xyz);
|
radiosityTextureCoord).xyz);
|
||||||
col = max(col, 0.);
|
col = max(col, 0.);
|
||||||
col *= 1.5;
|
col *= 1.5 * ssao;
|
||||||
|
|
||||||
|
detailAmbientOcclusion *= ssao;
|
||||||
|
|
||||||
// ambient occlusion
|
// ambient occlusion
|
||||||
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
||||||
@ -68,7 +70,7 @@ vec3 Radiosity_Map(float detailAmbientOcclusion) {
|
|||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction)
|
vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction, float ssao)
|
||||||
{
|
{
|
||||||
vec3 col = DecodeRadiosityValue
|
vec3 col = DecodeRadiosityValue
|
||||||
(texture3D(radiosityTextureFlat,
|
(texture3D(radiosityTextureFlat,
|
||||||
@ -84,7 +86,9 @@ vec3 BlurredReflection_Map(float detailAmbientOcclusion, vec3 direction)
|
|||||||
(texture3D(radiosityTextureZ,
|
(texture3D(radiosityTextureZ,
|
||||||
radiosityTextureCoord).xyz);
|
radiosityTextureCoord).xyz);
|
||||||
col = max(col, 0.);
|
col = max(col, 0.);
|
||||||
col *= 1.5;
|
col *= 1.5 * ssao;
|
||||||
|
|
||||||
|
detailAmbientOcclusion *= ssao;
|
||||||
|
|
||||||
// ambient occlusion
|
// ambient occlusion
|
||||||
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
float amb = texture3D(ambientShadowTexture, ambientShadowTextureCoord).x;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user