mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 20:17:01 +02:00
Working on the shaders
This commit is contained in:
parent
dd71035bf0
commit
f22429d098
3 changed files with 39 additions and 15 deletions
|
@ -202,7 +202,7 @@ enum class EntityVersion : PacketVersion {
|
||||||
HazeEffect,
|
HazeEffect,
|
||||||
StaticCertJsonVersionOne,
|
StaticCertJsonVersionOne,
|
||||||
OwnershipChallengeFix,
|
OwnershipChallengeFix,
|
||||||
ZoneLightInheritModes,
|
ZoneLightInheritModes = 82,
|
||||||
ZoneStageRemoved
|
ZoneStageRemoved
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ void main(void) {
|
||||||
vec3 fragNormal;
|
vec3 fragNormal;
|
||||||
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
|
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
|
||||||
|
|
||||||
/* vec4 color = vec4(evalSkyboxGlobalColor(
|
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||||
cam._viewInverse,
|
cam._viewInverse,
|
||||||
1.0,
|
1.0,
|
||||||
1.0,
|
1.0,
|
||||||
|
@ -81,8 +81,6 @@ void main(void) {
|
||||||
opacity);
|
opacity);
|
||||||
color.rgb += emissive * isEmissiveEnabled();
|
color.rgb += emissive * isEmissiveEnabled();
|
||||||
|
|
||||||
*/
|
// _fragColor = vec4(albedo, opacity);
|
||||||
|
_fragColor = color;
|
||||||
_fragColor = vec4(albedo, opacity);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,16 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include ForwardBufferWrite.slh@>
|
<! <@include ForwardBufferWrite.slh@> !>
|
||||||
|
|
||||||
|
<@include ForwardGlobalLight.slh@>
|
||||||
|
<$declareEvalSkyboxGlobalColor()$>
|
||||||
|
|
||||||
<@include model/Material.slh@>
|
<@include model/Material.slh@>
|
||||||
|
|
||||||
|
<@include gpu/Transform.slh@>
|
||||||
|
<$declareStandardCameraTransform()$>
|
||||||
|
|
||||||
<@include MaterialTextures.slh@>
|
<@include MaterialTextures.slh@>
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$>
|
||||||
|
|
||||||
|
@ -26,6 +32,8 @@ in vec3 _normal;
|
||||||
in vec3 _tangent;
|
in vec3 _tangent;
|
||||||
in vec3 _color;
|
in vec3 _color;
|
||||||
|
|
||||||
|
out vec4 _fragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
int matKey = getMaterialKey(mat);
|
int matKey = getMaterialKey(mat);
|
||||||
|
@ -40,6 +48,15 @@ void main(void) {
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
albedo *= _color;
|
albedo *= _color;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value
|
||||||
|
if (metallic <= 0.5) {
|
||||||
|
metallic = 0.0;
|
||||||
|
} else {
|
||||||
|
fresnel = albedo;
|
||||||
|
metallic = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
float roughness = getMaterialRoughness(mat);
|
float roughness = getMaterialRoughness(mat);
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
@ -52,13 +69,22 @@ void main(void) {
|
||||||
float scattering = getMaterialScattering(mat);
|
float scattering = getMaterialScattering(mat);
|
||||||
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||||
|
|
||||||
packForwardFragment(
|
vec3 fragPosition = _position.xyz;
|
||||||
viewNormal,
|
|
||||||
opacity,
|
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||||
|
cam._viewInverse,
|
||||||
|
1.0,
|
||||||
|
1.0,
|
||||||
|
fragPosition,
|
||||||
|
viewNormal,
|
||||||
albedo,
|
albedo,
|
||||||
roughness,
|
fresnel,
|
||||||
getMaterialMetallic(mat),
|
metallic,
|
||||||
emissive,
|
roughness),
|
||||||
occlusionTex,
|
opacity);
|
||||||
scattering);
|
|
||||||
|
color.rgb += emissive * isEmissiveEnabled();
|
||||||
|
|
||||||
|
// _fragColor = vec4(albedo, opacity);
|
||||||
|
_fragColor = color;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue