mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 11:43:16 +02:00
trying to add the skymap on translucents
This commit is contained in:
parent
19416fe722
commit
4202e60ac3
5 changed files with 20 additions and 3 deletions
|
@ -125,4 +125,16 @@ vec3 evalLightmappedColor(mat4 invViewMat, float shadowAttenuation, float obscur
|
|||
}
|
||||
<@endfunc@>
|
||||
|
||||
|
||||
|
||||
<@func declareEvalGlobalLightColor()@>
|
||||
|
||||
<$declareEvalSkyboxGlobalColor()$>
|
||||
|
||||
vec3 evalGlobalLightColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, float metallic, vec3 emissive, float roughness) {
|
||||
return evalSkyboxGlobalColor(invViewMat, shadowAttenuation, obscurance, position, normal, albedo, metallic, emissive, roughness);
|
||||
}
|
||||
<@endfunc@>
|
||||
|
||||
|
||||
<@endif@>
|
||||
|
|
|
@ -98,7 +98,7 @@ void lightBatchSetter(const ShapePipeline& pipeline, gpu::Batch& batch) {
|
|||
if (pipeline.locations->lightBufferUnit >= 0) {
|
||||
DependencyManager::get<DeferredLightingEffect>()->setupKeyLightBatch(batch,
|
||||
pipeline.locations->lightBufferUnit,
|
||||
-1);
|
||||
pipeline.locations->lightAmbientMapUnit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
<@include model/Material.slh@>
|
||||
|
||||
<@include DeferredGlobalLight.slh@>
|
||||
<$declareEvalAmbientSphereGlobalColor()$>
|
||||
|
||||
<$declareEvalGlobalLightColor()$>
|
||||
|
||||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
@ -58,7 +59,7 @@ void main(void) {
|
|||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
||||
_fragColor = vec4(evalAmbientSphereGlobalColor(
|
||||
_fragColor = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
|
|
|
@ -60,6 +60,7 @@ void ShapePlumber::addPipeline(const Filter& filter, const gpu::ShaderPointer& p
|
|||
slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), Slot::EMISSIVE_LIGHTMAP_MAP));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("occlusionMap"), Slot::OCCLUSION_MAP));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), Slot::LIGHT_BUFFER));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("skyboxMap"), Slot::LIGHT_AMBIENT_MAP));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("normalFittingMap"), Slot::NORMAL_FITTING_MAP));
|
||||
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
@ -77,6 +78,7 @@ void ShapePlumber::addPipeline(const Filter& filter, const gpu::ShaderPointer& p
|
|||
locations->skinClusterBufferUnit = program->getBuffers().findLocation("skinClusterBuffer");
|
||||
locations->materialBufferUnit = program->getBuffers().findLocation("materialBuffer");
|
||||
locations->lightBufferUnit = program->getBuffers().findLocation("lightBuffer");
|
||||
locations->lightAmbientMapUnit = program->getBuffers().findLocation("skyboxMap");
|
||||
|
||||
ShapeKey key{filter._flags};
|
||||
auto gpuPipeline = gpu::Pipeline::create(program, state);
|
||||
|
|
|
@ -203,6 +203,7 @@ public:
|
|||
static const int OCCLUSION_MAP = 5;
|
||||
|
||||
static const int LIGHT_BUFFER = 4;
|
||||
static const int LIGHT_AMBIENT_MAP = 6;
|
||||
static const int NORMAL_FITTING_MAP = 10;
|
||||
};
|
||||
|
||||
|
@ -220,6 +221,7 @@ public:
|
|||
int skinClusterBufferUnit;
|
||||
int materialBufferUnit;
|
||||
int lightBufferUnit;
|
||||
int lightAmbientMapUnit;
|
||||
};
|
||||
using LocationsPointer = std::shared_ptr<Locations>;
|
||||
|
||||
|
|
Loading…
Reference in a new issue