Cycles: Support user-defined shutter curve
Previously shutter was instantly opening, staying opened for the shutter time period of time and then instantly closing. This isn't quite how real cameras are working, where shutter is opening with some curve. Now it is possible to define user curve for how much shutter is opened across the sampling period of time. This could be used for example to make motion blur trails softer.
This commit is contained in:
@@ -37,7 +37,7 @@ void util_cdf_invert(const int resolution,
|
||||
float x = i / (float)half_size;
|
||||
int index = upper_bound(cdf.begin(), cdf.end(), x) - cdf.begin();
|
||||
float t;
|
||||
if(index < cdf.size()) {
|
||||
if(index < cdf.size() - 1) {
|
||||
t = (x - cdf[index])/(cdf[index+1] - cdf[index]);
|
||||
} else {
|
||||
t = 0.0f;
|
||||
@@ -49,11 +49,11 @@ void util_cdf_invert(const int resolution,
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i <= resolution; i++) {
|
||||
for(int i = 0; i < resolution; i++) {
|
||||
float x = from + range * (float)i * inv_resolution;
|
||||
int index = upper_bound(cdf.begin(), cdf.end(), x) - cdf.begin();
|
||||
float t;
|
||||
if(index < cdf.size()) {
|
||||
if(index < cdf.size() - 1) {
|
||||
t = (x - cdf[index])/(cdf[index+1] - cdf[index]);
|
||||
} else {
|
||||
t = 0.0f;
|
||||
|
Reference in New Issue
Block a user