mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01: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,
|
||||
StaticCertJsonVersionOne,
|
||||
OwnershipChallengeFix,
|
||||
ZoneLightInheritModes,
|
||||
ZoneLightInheritModes = 82,
|
||||
ZoneStageRemoved
|
||||
};
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void main(void) {
|
|||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
|
||||
|
||||
/* vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
|
@ -81,8 +81,6 @@ void main(void) {
|
|||
opacity);
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
*/
|
||||
|
||||
_fragColor = vec4(albedo, opacity);
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,16 @@
|
|||
// 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 gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
||||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$>
|
||||
|
||||
|
@ -26,6 +32,8 @@ in vec3 _normal;
|
|||
in vec3 _tangent;
|
||||
in vec3 _color;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
void main(void) {
|
||||
Material mat = getMaterial();
|
||||
int matKey = getMaterialKey(mat);
|
||||
|
@ -40,6 +48,15 @@ void main(void) {
|
|||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||
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);
|
||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||
|
||||
|
@ -52,13 +69,22 @@ void main(void) {
|
|||
float scattering = getMaterialScattering(mat);
|
||||
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||
|
||||
packForwardFragment(
|
||||
viewNormal,
|
||||
opacity,
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
fragPosition,
|
||||
viewNormal,
|
||||
albedo,
|
||||
roughness,
|
||||
getMaterialMetallic(mat),
|
||||
emissive,
|
||||
occlusionTex,
|
||||
scattering);
|
||||
fresnel,
|
||||
metallic,
|
||||
roughness),
|
||||
opacity);
|
||||
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue