mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
better highlights blending
This commit is contained in:
parent
5e04b399d8
commit
3196c5ca77
3 changed files with 9 additions and 22 deletions
|
@ -140,7 +140,8 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
|||
|
||||
// Blend on transparent
|
||||
state->setBlendFunction(key.isTranslucent(),
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
// gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||
|
||||
// Good to go add the brand new pipeline
|
||||
|
@ -2175,11 +2176,6 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran
|
|||
const FBXMeshPart& part = mesh.parts.at(partIndex);
|
||||
model::MaterialPointer material = part._material;
|
||||
|
||||
float shininess = 0;
|
||||
if (translucent) {
|
||||
shininess = material->getShininess();
|
||||
}
|
||||
|
||||
if (material == nullptr) {
|
||||
// qCDebug(renderutils) << "WARNING: material == nullptr!!!";
|
||||
}
|
||||
|
|
|
@ -130,18 +130,6 @@ template <> void render::jobRun(const DrawTransparentDeferred& job, const SceneC
|
|||
const float MOSTLY_OPAQUE_THRESHOLD = 0.75f;
|
||||
const float TRANSPARENT_ALPHA_THRESHOLD = 0.0f;
|
||||
|
||||
/* // render translucent meshes afterwards
|
||||
{
|
||||
GLenum buffers[2];
|
||||
int bufferCount = 0;
|
||||
buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;
|
||||
buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;
|
||||
batch._glDrawBuffers(bufferCount, buffers);
|
||||
args->_alphaThreshold = MOSTLY_OPAQUE_THRESHOLD;
|
||||
}
|
||||
|
||||
renderItems(sceneContext, renderContext, renderedItems, renderContext->_maxDrawnTransparentItems);
|
||||
*/
|
||||
{
|
||||
GLenum buffers[3];
|
||||
int bufferCount = 0;
|
||||
|
@ -155,5 +143,8 @@ template <> void render::jobRun(const DrawTransparentDeferred& job, const SceneC
|
|||
|
||||
args->_context->render((*args->_batch));
|
||||
args->_batch = nullptr;
|
||||
|
||||
// reset blend function to standard...
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ vec4 evalNormalColor(vec3 dir, float opacity) {
|
|||
return vec4(0.5 * dir + vec3(0.5), opacity);
|
||||
}
|
||||
|
||||
vec4 evalAmbienGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss, float opacity) {
|
||||
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss, float opacity) {
|
||||
|
||||
// Need the light now
|
||||
Light light = getLight();
|
||||
|
@ -85,7 +85,7 @@ vec4 evalAmbienGlobalColor(float shadowAttenuation, vec3 position, vec3 normal,
|
|||
vec3 fragEyeDir;
|
||||
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
|
||||
|
||||
vec3 color = diffuse.rgb * getLightColor(light) * getLightAmbientIntensity(light);
|
||||
vec3 color = opacity * diffuse.rgb * getLightColor(light) * getLightAmbientIntensity(light);
|
||||
|
||||
vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss);
|
||||
|
||||
|
@ -118,7 +118,7 @@ void main(void) {
|
|||
vec3 fragSpecular = getMaterialSpecular(mat);
|
||||
float fragGloss = getMaterialShininess(mat);
|
||||
|
||||
vec4 fragColor = evalAmbienGlobalColor(1.0,
|
||||
vec4 fragColor = evalGlobalColor(1.0,
|
||||
fragPosition,
|
||||
fragNormal,
|
||||
fragDiffuse,
|
||||
|
@ -126,5 +126,5 @@ void main(void) {
|
|||
fragGloss,
|
||||
fragOpacity);
|
||||
|
||||
gl_FragColor = fragColor; //vec4(fragColor, fragOpacity);
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue