Use specmap on others mats
This commit is contained in:
parent
0121ae8db6
commit
9f2b66d195
@ -1,10 +1,12 @@
|
|||||||
#ifndef GL_ARB_bindless_texture
|
#ifndef GL_ARB_bindless_texture
|
||||||
uniform sampler2D Albedo;
|
uniform sampler2D Albedo;
|
||||||
uniform sampler2D Detail;
|
uniform sampler2D Detail;
|
||||||
|
uniform sampler2D SpecMap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GL_ARB_bindless_texture
|
#ifdef GL_ARB_bindless_texture
|
||||||
flat in sampler2D handle;
|
flat in sampler2D handle;
|
||||||
|
flat in sampler2D secondhandle;
|
||||||
flat in sampler2D thirdhandle;
|
flat in sampler2D thirdhandle;
|
||||||
#endif
|
#endif
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
@ -17,6 +19,7 @@ void main(void)
|
|||||||
{
|
{
|
||||||
#ifdef GL_ARB_bindless_texture
|
#ifdef GL_ARB_bindless_texture
|
||||||
vec4 color = texture(handle, uv);
|
vec4 color = texture(handle, uv);
|
||||||
|
float specmap = texture(secondhandle, uv).g;
|
||||||
#ifdef SRGBBindlessFix
|
#ifdef SRGBBindlessFix
|
||||||
color.xyz = pow(color.xyz, vec3(2.2));
|
color.xyz = pow(color.xyz, vec3(2.2));
|
||||||
#endif
|
#endif
|
||||||
@ -24,7 +27,8 @@ void main(void)
|
|||||||
#else
|
#else
|
||||||
vec4 color = texture(Albedo, uv);
|
vec4 color = texture(Albedo, uv);
|
||||||
vec4 detail = texture(Detail, uv_bis);
|
vec4 detail = texture(Detail, uv_bis);
|
||||||
|
float specmap = texture(SpecMap, uv).g;
|
||||||
#endif
|
#endif
|
||||||
color *= detail;
|
color *= detail;
|
||||||
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), 1.), 1.);
|
FragColor = vec4(getLightFactor(color.xyz, vec3(1.), specmap), 1.);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout(bindless_sampler) uniform sampler2D dtex;
|
layout(bindless_sampler) uniform sampler2D dtex;
|
||||||
#else
|
#else
|
||||||
uniform sampler2D Albedo;
|
uniform sampler2D Albedo;
|
||||||
|
uniform sampler2D SpecMap;
|
||||||
uniform sampler2D dtex;
|
uniform sampler2D dtex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ uniform vec3 SunDir;
|
|||||||
|
|
||||||
#ifdef GL_ARB_bindless_texture
|
#ifdef GL_ARB_bindless_texture
|
||||||
flat in sampler2D handle;
|
flat in sampler2D handle;
|
||||||
|
flat in sampler2D secondhandle;
|
||||||
#endif
|
#endif
|
||||||
in vec3 nor;
|
in vec3 nor;
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
@ -20,11 +22,13 @@ void main(void)
|
|||||||
{
|
{
|
||||||
#ifdef GL_ARB_bindless_texture
|
#ifdef GL_ARB_bindless_texture
|
||||||
vec4 color = texture(handle, uv);
|
vec4 color = texture(handle, uv);
|
||||||
|
float specmap = texture(secondhandle, uv).g;
|
||||||
#ifdef SRGBBindlessFix
|
#ifdef SRGBBindlessFix
|
||||||
color.xyz = pow(color.xyz, vec3(2.2));
|
color.xyz = pow(color.xyz, vec3(2.2));
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
vec4 color = texture(Albedo, uv);
|
vec4 color = texture(Albedo, uv);
|
||||||
|
float specmap = texture(SpecMap, uv).g;
|
||||||
#endif
|
#endif
|
||||||
if (color.a < 0.5) discard;
|
if (color.a < 0.5) discard;
|
||||||
|
|
||||||
@ -44,6 +48,6 @@ void main(void)
|
|||||||
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
||||||
|
|
||||||
|
|
||||||
vec3 LightFactor = color.xyz * (scattering * 0.3) + getLightFactor(color.xyz, vec3(1.), 1.);
|
vec3 LightFactor = color.xyz * (scattering * 0.3) + getLightFactor(color.xyz, vec3(1.), specmap);
|
||||||
FragColor = vec4(LightFactor, 1.);
|
FragColor = vec4(LightFactor, 1.);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ struct DefaultMaterial
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<size_t> DefaultMaterial::FirstPassTextures = { 1 };
|
const std::vector<size_t> DefaultMaterial::FirstPassTextures = { 1 };
|
||||||
const std::vector<size_t> DefaultMaterial::SecondPassTextures = { 0 };
|
const std::vector<size_t> DefaultMaterial::SecondPassTextures = { 0, 1 };
|
||||||
|
|
||||||
struct AlphaRef
|
struct AlphaRef
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ struct AlphaRef
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<size_t> AlphaRef::FirstPassTextures = { 0, 1 };
|
const std::vector<size_t> AlphaRef::FirstPassTextures = { 0, 1 };
|
||||||
const std::vector<size_t> AlphaRef::SecondPassTextures = { 0 };
|
const std::vector<size_t> AlphaRef::SecondPassTextures = { 0, 1 };
|
||||||
|
|
||||||
struct SphereMap
|
struct SphereMap
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ struct NormalMat
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<size_t> NormalMat::FirstPassTextures = { 2, 1 };
|
const std::vector<size_t> NormalMat::FirstPassTextures = { 2, 1 };
|
||||||
const std::vector<size_t> NormalMat::SecondPassTextures = { 0 };
|
const std::vector<size_t> NormalMat::SecondPassTextures = { 0, 1 };
|
||||||
|
|
||||||
struct DetailMat
|
struct DetailMat
|
||||||
{
|
{
|
||||||
@ -183,7 +183,7 @@ struct DetailMat
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<size_t> DetailMat::FirstPassTextures = { 1 };
|
const std::vector<size_t> DetailMat::FirstPassTextures = { 1 };
|
||||||
const std::vector<size_t> DetailMat::SecondPassTextures = { 0, 2 };
|
const std::vector<size_t> DetailMat::SecondPassTextures = { 0, 2, 1 };
|
||||||
|
|
||||||
struct SplattingMat
|
struct SplattingMat
|
||||||
{
|
{
|
||||||
@ -531,15 +531,15 @@ void IrrDriver::renderSolidSecondPass()
|
|||||||
|
|
||||||
if (UserConfigParams::m_azdo)
|
if (UserConfigParams::m_azdo)
|
||||||
{
|
{
|
||||||
multidraw2ndPass<DefaultMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
multidraw2ndPass<DefaultMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||||
multidraw2ndPass<AlphaRef>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
multidraw2ndPass<AlphaRef>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||||
multidraw2ndPass<SphereMap>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
multidraw2ndPass<SphereMap>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
||||||
multidraw2ndPass<UnlitMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
multidraw2ndPass<UnlitMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
||||||
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
||||||
multidraw2ndPass<GrassMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, DepthHandle, 0), windDir, cb->getPosition());
|
multidraw2ndPass<GrassMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, DepthHandle, 0, 0), windDir, cb->getPosition());
|
||||||
|
|
||||||
multidraw2ndPass<NormalMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0));
|
multidraw2ndPass<NormalMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||||
multidraw2ndPass<DetailMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
multidraw2ndPass<DetailMat>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0, 0));
|
||||||
}
|
}
|
||||||
else if (irr_driver->hasARB_draw_indirect())
|
else if (irr_driver->hasARB_draw_indirect())
|
||||||
{
|
{
|
||||||
|
@ -865,7 +865,7 @@ namespace MeshShader
|
|||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_object_pass2.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_object_pass2.frag").c_str());
|
||||||
AssignUniforms();
|
AssignUniforms();
|
||||||
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo");
|
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "SpecMap");
|
||||||
}
|
}
|
||||||
|
|
||||||
InstancedObjectRefPass2Shader::InstancedObjectRefPass2Shader()
|
InstancedObjectRefPass2Shader::InstancedObjectRefPass2Shader()
|
||||||
@ -876,7 +876,7 @@ namespace MeshShader
|
|||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_objectref_pass2.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_objectref_pass2.frag").c_str());
|
||||||
AssignUniforms();
|
AssignUniforms();
|
||||||
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo");
|
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "SpecMap");
|
||||||
}
|
}
|
||||||
|
|
||||||
DetailledObjectPass2Shader::DetailledObjectPass2Shader()
|
DetailledObjectPass2Shader::DetailledObjectPass2Shader()
|
||||||
@ -897,7 +897,7 @@ namespace MeshShader
|
|||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_detailledobject_pass2.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_detailledobject_pass2.frag").c_str());
|
||||||
AssignUniforms();
|
AssignUniforms();
|
||||||
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "Detail");
|
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "Albedo", 4, "Detail", 5, "SpecMap");
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectUnlitShader::ObjectUnlitShader()
|
ObjectUnlitShader::ObjectUnlitShader()
|
||||||
@ -947,7 +947,7 @@ namespace MeshShader
|
|||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_grass_pass2.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/instanced_grass_pass2.frag").c_str());
|
||||||
AssignUniforms("windDir", "SunDir");
|
AssignUniforms("windDir", "SunDir");
|
||||||
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "dtex", 4, "Albedo");
|
AssignSamplerNames(Program, 0, "DiffuseMap", 1, "SpecularMap", 2, "SSAO", 3, "dtex", 4, "Albedo", 4, "SpecMap");
|
||||||
}
|
}
|
||||||
|
|
||||||
SphereMapShader::SphereMapShader()
|
SphereMapShader::SphereMapShader()
|
||||||
|
@ -107,13 +107,13 @@ public:
|
|||||||
ObjectPass2Shader();
|
ObjectPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class InstancedObjectPass2Shader : public ShaderHelperSingleton<InstancedObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered>
|
class InstancedObjectPass2Shader : public ShaderHelperSingleton<InstancedObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InstancedObjectPass2Shader();
|
InstancedObjectPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class InstancedObjectRefPass2Shader : public ShaderHelperSingleton<InstancedObjectRefPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered>
|
class InstancedObjectRefPass2Shader : public ShaderHelperSingleton<InstancedObjectRefPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InstancedObjectRefPass2Shader();
|
InstancedObjectRefPass2Shader();
|
||||||
@ -125,7 +125,7 @@ public:
|
|||||||
DetailledObjectPass2Shader();
|
DetailledObjectPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class InstancedDetailledObjectPass2Shader : public ShaderHelperSingleton<InstancedDetailledObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
|
class InstancedDetailledObjectPass2Shader : public ShaderHelperSingleton<InstancedDetailledObjectPass2Shader>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InstancedDetailledObjectPass2Shader();
|
InstancedDetailledObjectPass2Shader();
|
||||||
@ -155,7 +155,7 @@ public:
|
|||||||
GrassPass2Shader();
|
GrassPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class InstancedGrassPass2Shader : public ShaderHelperSingleton<InstancedGrassPass2Shader, core::vector3df, core::vector3df>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Nearest_Filtered, Trilinear_Anisotropic_Filtered>
|
class InstancedGrassPass2Shader : public ShaderHelperSingleton<InstancedGrassPass2Shader, core::vector3df, core::vector3df>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Bilinear_Filtered, Nearest_Filtered, Trilinear_Anisotropic_Filtered, Trilinear_Anisotropic_Filtered>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InstancedGrassPass2Shader();
|
InstancedGrassPass2Shader();
|
||||||
|
Loading…
Reference in New Issue
Block a user