Remove rimlight material
This commit is contained in:
parent
0e4b9040d6
commit
822c8725dd
@ -1,39 +0,0 @@
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D DiffuseMap;
|
||||
uniform sampler2D SpecularMap;
|
||||
uniform sampler2D SSAO;
|
||||
uniform vec3 ambient;
|
||||
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec3 nor;
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
float rim = 1.0 - dot(nor, vec3(0., 0., -1));
|
||||
rim = smoothstep(0.5, 1.5, rim) * 0.15;
|
||||
|
||||
vec4 color = texture(Albedo, uv);
|
||||
vec2 tc = gl_FragCoord.xy / screen;
|
||||
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
||||
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
||||
float ao = texture(SSAO, tc).x;
|
||||
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent * (1. - color.a);
|
||||
FragColor = vec4(color.xyz * LightFactor + rim, 1.);
|
||||
}
|
||||
|
@ -610,7 +610,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
GroupedSM<SM_DEFAULT_STANDARD>::reset();
|
||||
GroupedSM<SM_DEFAULT_TANGENT>::reset();
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::reset();
|
||||
GroupedSM<SM_RIMLIT>::reset();
|
||||
GroupedSM<SM_SPHEREMAP>::reset();
|
||||
GroupedSM<SM_SPLATTING>::reset();
|
||||
GroupedSM<SM_UNLIT>::reset();
|
||||
@ -702,27 +701,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
draw<MeshShader::ObjectRefPass2Shader>(mesh, GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet[i], GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet[i]->TextureMatrix);
|
||||
}
|
||||
|
||||
glUseProgram(MeshShader::ObjectRimLimitShader::Program);
|
||||
glBindVertexArray(getVAO(EVT_STANDARD));
|
||||
for (unsigned i = 0; i < GroupedSM<SM_RIMLIT>::MeshSet.size(); i++)
|
||||
{
|
||||
const GLMesh &mesh = *GroupedSM<SM_RIMLIT>::MeshSet[i];
|
||||
assert(mesh.VAOType == EVT_STANDARD);
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::ObjectRimLimitShader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
draw<MeshShader::ObjectRimLimitShader>(mesh, GroupedSM<SM_RIMLIT>::MVPSet[i], GroupedSM<SM_RIMLIT>::TIMVSet[i], GroupedSM<SM_RIMLIT>::MeshSet[i]->TextureMatrix);
|
||||
}
|
||||
|
||||
glUseProgram(MeshShader::SphereMapShader::Program);
|
||||
glBindVertexArray(getVAO(EVT_STANDARD));
|
||||
for (unsigned i = 0; i < GroupedSM<SM_SPHEREMAP>::MeshSet.size(); i++)
|
||||
|
@ -336,7 +336,6 @@ void Shaders::loadShaders()
|
||||
MeshShader::InstancedObjectRefPass2Shader::init();
|
||||
MeshShader::InstancedGrassPass2Shader::init();
|
||||
MeshShader::DetailledObjectPass2Shader::init();
|
||||
MeshShader::ObjectRimLimitShader::init();
|
||||
MeshShader::UntexturedObjectShader::init();
|
||||
MeshShader::ObjectRefPass2Shader::init();
|
||||
MeshShader::ObjectUnlitShader::init();
|
||||
@ -856,54 +855,6 @@ namespace MeshShader
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
}
|
||||
|
||||
GLuint ObjectRimLimitShader::Program;
|
||||
GLuint ObjectRimLimitShader::uniform_MM;
|
||||
GLuint ObjectRimLimitShader::uniform_IMM;
|
||||
GLuint ObjectRimLimitShader::uniform_TM;
|
||||
GLuint ObjectRimLimitShader::uniform_ambient;
|
||||
GLuint ObjectRimLimitShader::TU_Albedo;
|
||||
|
||||
void ObjectRimLimitShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectpass_rimlit.frag").c_str());
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
GLuint uniform_SpecularMap = glGetUniformLocation(Program, "SpecularMap");
|
||||
GLuint uniform_SSAO = glGetUniformLocation(Program, "SSAO");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
TU_Albedo = 3;
|
||||
|
||||
glUseProgram(Program);
|
||||
glUniform1i(uniform_DiffuseMap, 0);
|
||||
glUniform1i(uniform_SpecularMap, 1);
|
||||
glUniform1i(uniform_SSAO, 2);
|
||||
glUniform1i(uniform_Albedo, TU_Albedo);
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void ObjectRimLimitShader::setUniforms(const core::matrix4 &ModelMatrix,
|
||||
const core::matrix4 &InverseModelMatrix,
|
||||
const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
if (UserConfigParams::m_ubo_disabled)
|
||||
bypassUBO(Program);
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_IMM, 1, GL_FALSE, InverseModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
glUniform3f(uniform_ambient, s.r, s.g, s.b);
|
||||
}
|
||||
|
||||
GLuint UntexturedObjectShader::Program;
|
||||
GLuint UntexturedObjectShader::uniform_MM;
|
||||
GLuint UntexturedObjectShader::uniform_ambient;
|
||||
|
@ -163,17 +163,6 @@ public:
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix);
|
||||
};
|
||||
|
||||
class ObjectRimLimitShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_TM, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const core::matrix4 &TextureMatrix);
|
||||
};
|
||||
|
||||
class UntexturedObjectShader
|
||||
{
|
||||
public:
|
||||
|
@ -195,13 +195,6 @@ void STKAnimatedMesh::render()
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for_in(mesh, ShadedMesh[SM_RIMLIT])
|
||||
{
|
||||
GroupedSM<SM_RIMLIT>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for_in (mesh, ShadedMesh[SM_UNLIT])
|
||||
{
|
||||
GroupedSM<SM_UNLIT>::MeshSet.push_back(mesh);
|
||||
|
@ -31,8 +31,6 @@ ShadedMaterial MaterialTypeToShadedMaterial(video::E_MATERIAL_TYPE type, video::
|
||||
return SM_SPLATTING;
|
||||
else if (type == irr_driver->getShader(ES_OBJECTPASS_REF) || type == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
||||
return SM_ALPHA_REF_TEXTURE;
|
||||
else if (type == irr_driver->getShader(ES_OBJECTPASS_RIMLIT) && textures[0])
|
||||
return SM_RIMLIT;
|
||||
else if (type == irr_driver->getShader(ES_GRASS) || type == irr_driver->getShader(ES_GRASS_REF))
|
||||
return SM_GRASS;
|
||||
else if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
|
||||
|
@ -25,7 +25,6 @@ enum ShadedMaterial
|
||||
SM_DEFAULT_STANDARD,
|
||||
SM_DEFAULT_TANGENT,
|
||||
SM_ALPHA_REF_TEXTURE,
|
||||
SM_RIMLIT,
|
||||
SM_SPHEREMAP,
|
||||
SM_SPLATTING,
|
||||
SM_GRASS,
|
||||
|
@ -368,14 +368,6 @@ void STKMeshSceneNode::render()
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for_in(mesh, ShadedMesh[SM_RIMLIT])
|
||||
{
|
||||
GroupedSM<SM_RIMLIT>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
|
||||
for_in(mesh, ShadedMesh[SM_SPHEREMAP])
|
||||
{
|
||||
GroupedSM<SM_SPHEREMAP>::MeshSet.push_back(mesh);
|
||||
|
Loading…
Reference in New Issue
Block a user