HDR: Better handling of model-combined for backwards compatibility
This commit is contained in:
parent
f5bc6df9fb
commit
05994100ea
3 changed files with 26 additions and 4 deletions
|
@ -16,7 +16,12 @@ please see Docs/README.model-combined.eff for documentation
|
||||||
<normalmap-dds type="int">0</normalmap-dds>
|
<normalmap-dds type="int">0</normalmap-dds>
|
||||||
<normalmap-tiling type="float">1.0</normalmap-tiling>
|
<normalmap-tiling type="float">1.0</normalmap-tiling>
|
||||||
<texture n="2">
|
<texture n="2">
|
||||||
<type>null-normalmap</type>
|
<image>Aircraft/Generic/Effects/null_bumpspec.png</image>
|
||||||
|
<type>2d</type>
|
||||||
|
<filter>linear-mipmap-linear</filter>
|
||||||
|
<wrap-s>clamp</wrap-s>
|
||||||
|
<wrap-t>clamp</wrap-t>
|
||||||
|
<internal-format>normalized</internal-format>
|
||||||
</texture>
|
</texture>
|
||||||
<!-- Light Map -->
|
<!-- Light Map -->
|
||||||
<lightmap-enabled type="int">0</lightmap-enabled>
|
<lightmap-enabled type="int">0</lightmap-enabled>
|
||||||
|
@ -1330,6 +1335,16 @@ please see Docs/README.model-combined.eff for documentation
|
||||||
<type>sampler-2d</type>
|
<type>sampler-2d</type>
|
||||||
<value type="int">1</value>
|
<value type="int">1</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>normalmap_enabled</name>
|
||||||
|
<type>int</type>
|
||||||
|
<value><use>normalmap-enabled</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>normalmap_tiling</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>normalmap-tiling</use></value>
|
||||||
|
</uniform>
|
||||||
</pass>
|
</pass>
|
||||||
</technique>
|
</technique>
|
||||||
|
|
||||||
|
|
|
@ -9,18 +9,24 @@ in mat3 TBN;
|
||||||
|
|
||||||
uniform sampler2D color_tex;
|
uniform sampler2D color_tex;
|
||||||
uniform sampler2D normal_tex;
|
uniform sampler2D normal_tex;
|
||||||
|
uniform int normalmap_enabled;
|
||||||
|
uniform float normalmap_tiling;
|
||||||
|
|
||||||
const float DEFAULT_COMBINED_METALNESS = 0.0;
|
const float DEFAULT_COMBINED_METALNESS = 0.0;
|
||||||
const float DEFAULT_COMBINED_ROUGHNESS = 0.1;
|
const float DEFAULT_COMBINED_ROUGHNESS = 0.1;
|
||||||
|
|
||||||
vec2 encodeNormal(vec3 n);
|
vec2 encodeNormal(vec3 n);
|
||||||
|
vec3 decodeSRGB(vec3 screenRGB);
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gbuffer0.rgb = pow(texture(color_tex, texCoord).rgb, vec3(2.2)); // Gamma correction
|
gbuffer0.rgb = decodeSRGB(texture(color_tex, texCoord).rgb);
|
||||||
gbuffer0.a = 1.0;
|
gbuffer0.a = 1.0;
|
||||||
|
|
||||||
vec3 normal = texture(normal_tex, texCoord).rgb * 2.0 - 1.0;
|
vec3 normal = vec3(0.5, 0.5, 1.0);
|
||||||
|
if (normalmap_enabled > 0) {
|
||||||
|
normal = texture(normal_tex, texCoord * normalmap_tiling).rgb * 2.0 - 1.0;
|
||||||
|
}
|
||||||
normal = normalize(TBN * normal);
|
normal = normalize(TBN * normal);
|
||||||
gbuffer1 = encodeNormal(normal);
|
gbuffer1 = encodeNormal(normal);
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,11 @@ const float DEFAULT_METALNESS = 0.0;
|
||||||
const float DEFAULT_ROUGHNESS = 0.8;
|
const float DEFAULT_ROUGHNESS = 0.8;
|
||||||
|
|
||||||
vec2 encodeNormal(vec3 n);
|
vec2 encodeNormal(vec3 n);
|
||||||
|
vec3 decodeSRGB(vec3 screenRGB);
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gbuffer0.rgb = pow(texture(color_tex, texCoord).rgb, vec3(2.2)); // Gamma correction
|
gbuffer0.rgb = decodeSRGB(texture(color_tex, texCoord).rgb);
|
||||||
gbuffer0.a = 1.0;
|
gbuffer0.a = 1.0;
|
||||||
gbuffer1 = encodeNormal(normalVS);
|
gbuffer1 = encodeNormal(normalVS);
|
||||||
gbuffer2 = vec4(DEFAULT_METALNESS,
|
gbuffer2 = vec4(DEFAULT_METALNESS,
|
||||||
|
|
Loading…
Add table
Reference in a new issue