More lighting changes
This commit is contained in:
@@ -31,6 +31,5 @@ float4 fragmentMain(in FragmentParameter params) : SV_Target
|
||||
result += pLightEnv.pointLights[lightIndex].illuminate(lightingParams, brdf);
|
||||
}
|
||||
result += brdf.evaluateAmbient();
|
||||
// gamma correction
|
||||
return float4(result, brdf.getAlpha());
|
||||
}
|
||||
@@ -101,5 +101,5 @@ float4 fragmentMain(
|
||||
|
||||
float factor = (output.texCoords.y - lowerLimit) / (upperLimit - lowerLimit);
|
||||
factor = clamp(factor, 0.0, 1.0);
|
||||
return lerp(float4(pSkyboxData.fogBlend.xyz, 1), finalColor, factor);
|
||||
return lerp(float4(pSkyboxData.fogBlend.xyz, 1), finalColor, factor) * 100;
|
||||
}
|
||||
@@ -84,14 +84,14 @@ float3 agxEotf(float3 val) {
|
||||
val = mul(agx_mat_inv, val);
|
||||
|
||||
// sRGB IEC 61966-2-1 2.2 Exponent Reference EOTF Display
|
||||
//val = pow(val, float3(2.2));
|
||||
val = pow(val, float3(2.2));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
float3 agxLook(float3 val, float avgLum) {
|
||||
float3 agxLook(float3 val) {
|
||||
const float3 lw = float3(0.2126, 0.7152, 0.0722);
|
||||
float luma = dot(val, lw) / (9.6 * avgLum + 0.00001);
|
||||
float luma = dot(val, lw);
|
||||
|
||||
// Default
|
||||
float3 offset = pToneMappingParams.offset.xyz;
|
||||
@@ -108,10 +108,9 @@ float3 agxLook(float3 val, float avgLum) {
|
||||
float4 toneMapping(float2 uv : UV) : SV_Target
|
||||
{
|
||||
float3 hdrValue = pToneMappingParams.hdrInputTexture.Sample(pToneMappingParams.hdrSampler, uv).rgb;
|
||||
float avgLum = pToneMappingParams.averageLuminance[0];
|
||||
|
||||
float3 value = agx(hdrValue);
|
||||
value = agxLook(value, avgLum);
|
||||
float3 value = agx(hdrValue / 1000);
|
||||
value = agxLook(value);
|
||||
value = agxEotf(value);
|
||||
|
||||
return float4(value, 1);
|
||||
|
||||
@@ -15,7 +15,7 @@ struct DirectionalLight : ILightEnv
|
||||
float3 illuminate<B:IBRDF>(LightingParameter params, B brdf)
|
||||
{
|
||||
float3 dir_WS = -normalize(direction.xyz);
|
||||
return brdf.evaluate(params.viewDir_WS, dir_WS, color.xyz);
|
||||
return brdf.evaluate(params.viewDir_WS, dir_WS, color.xyz * color.w);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ struct PointLight : ILightEnv
|
||||
float3 lightDir_WS = position_WS.xyz - params.position_WS;
|
||||
float d = length(lightDir_WS);
|
||||
float illuminance = max(1 - d / colorRange.w, 0);
|
||||
return illuminance * brdf.evaluate(params.viewDir_WS, normalize(lightDir_WS), colorRange.xyz);
|
||||
return illuminance * brdf.evaluate(params.viewDir_WS, normalize(lightDir_WS), colorRange.xyz * position_WS.w);
|
||||
}
|
||||
|
||||
bool insidePlane(Plane plane, float3 position)
|
||||
|
||||
@@ -4,8 +4,8 @@ using namespace Seele;
|
||||
|
||||
DirectionalLightActor::DirectionalLightActor(PScene scene) : Actor(scene) { attachComponent<Component::DirectionalLight>(); }
|
||||
|
||||
DirectionalLightActor::DirectionalLightActor(PScene scene, Vector color, Vector direction) : Actor(scene) {
|
||||
attachComponent<Component::DirectionalLight>(Vector4(color, 0), Vector4(direction, 0));
|
||||
DirectionalLightActor::DirectionalLightActor(PScene scene, Vector color, float intensity, Vector direction) : Actor(scene) {
|
||||
attachComponent<Component::DirectionalLight>(Vector4(color, intensity), Vector4(direction, 0));
|
||||
}
|
||||
|
||||
DirectionalLightActor::~DirectionalLightActor() {}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Seele {
|
||||
class DirectionalLightActor : public Actor {
|
||||
public:
|
||||
DirectionalLightActor(PScene scene);
|
||||
DirectionalLightActor(PScene scene, Vector color, Vector direction);
|
||||
DirectionalLightActor(PScene scene, Vector color, float intensity, Vector direction);
|
||||
virtual ~DirectionalLightActor();
|
||||
Component::DirectionalLight& getDirectionalLightComponent();
|
||||
const Component::DirectionalLight& getDirectionalLightComponent() const;
|
||||
|
||||
@@ -4,8 +4,8 @@ using namespace Seele;
|
||||
|
||||
PointLightActor::PointLightActor(PScene scene) : Actor(scene) { attachComponent<Component::PointLight>(); }
|
||||
|
||||
PointLightActor::PointLightActor(PScene scene, Vector position, Vector color, float attenuation) : Actor(scene) {
|
||||
attachComponent<Component::PointLight>(Vector4(position, 1), Vector4(color, attenuation));
|
||||
PointLightActor::PointLightActor(PScene scene, Vector position, float intensity, Vector color, float attenuation) : Actor(scene) {
|
||||
attachComponent<Component::PointLight>(Vector4(position, intensity), Vector4(color, attenuation));
|
||||
}
|
||||
|
||||
PointLightActor::~PointLightActor() {}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Seele {
|
||||
class PointLightActor : public Actor {
|
||||
public:
|
||||
PointLightActor(PScene scene);
|
||||
PointLightActor(PScene scene, Vector position, Vector color, float attenuation);
|
||||
PointLightActor(PScene scene, Vector position, float intensity, Vector color, float attenuation);
|
||||
virtual ~PointLightActor();
|
||||
Component::PointLight& getPointLightComponent();
|
||||
const Component::PointLight& getPointLightComponent() const;
|
||||
|
||||
@@ -34,7 +34,7 @@ class Asset {
|
||||
std::string name;
|
||||
std::string assetId;
|
||||
Status status;
|
||||
uint64 byteSize;
|
||||
uint64 byteSize = 0;
|
||||
};
|
||||
DEFINE_REF(Asset)
|
||||
} // namespace Seele
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Seele {
|
||||
namespace Component {
|
||||
struct DirectionalLight {
|
||||
Vector4 color;
|
||||
Vector4 colorIntensity;
|
||||
Vector4 direction;
|
||||
};
|
||||
} // namespace Component
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Seele {
|
||||
namespace Component {
|
||||
struct PointLight {
|
||||
// give the lights a radius so that they are not actual points
|
||||
Vector4 positionWSRadius;
|
||||
Vector4 positionWS;
|
||||
Vector4 colorRange;
|
||||
};
|
||||
} // namespace Component
|
||||
|
||||
Reference in New Issue
Block a user