mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Adding the drawKeyLight shader
This commit is contained in:
parent
79f700e8ce
commit
3e7795ec11
2 changed files with 6 additions and 13 deletions
|
@ -68,7 +68,7 @@ const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
|||
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), ZONE_DEFERRED_TRANSFORM_BUFFER));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("keylightBuffer"), ZONE_KEYLIGHT_BUFFER));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), ZONE_KEYLIGHT_BUFFER));
|
||||
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
|
|
|
@ -45,22 +45,15 @@ void main(void) {
|
|||
vec3 fragNormal = vec3(getViewInverse() * vec4(spherePos, 0.0));
|
||||
|
||||
|
||||
LightAmbient lightAmbient = getLightAmbient();
|
||||
Light light = getLight();
|
||||
|
||||
vec3 lightDirection = getLightDirection(light);
|
||||
vec3 lightIrradiance = getLightIrradiance(light);
|
||||
|
||||
float roughness = 0.1;
|
||||
float levels = getLightAmbientMapNumMips(lightAmbient);
|
||||
float lod = min(((roughness)* levels), levels);
|
||||
vec3 ambientMap = evalSkyboxLight(fragNormal, lod).xyz;
|
||||
vec3 ambientSH = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(lightAmbient), fragNormal).xyz;
|
||||
|
||||
// vec3 ambient = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(lightAmbient), fragNormal).xyz;
|
||||
// _fragColor = vec4( 0.5 * (fragNormal + vec3(1.0)), 1.0);
|
||||
|
||||
vec3 ambient = (sphereUV.x > 0 ? ambientMap : ambientSH);
|
||||
vec3 color = lightIrradiance;
|
||||
|
||||
const float INV_GAMMA_22 = 1.0 / 2.2;
|
||||
_fragColor = vec4(pow(ambient, vec3(INV_GAMMA_22)), 1.0);
|
||||
_fragColor = vec4(pow(color, vec3(INV_GAMMA_22)), 1.0);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue