save current state

This commit is contained in:
samcake 2016-06-09 14:35:44 -07:00
parent 7bd686167e
commit 0b873365ed
3 changed files with 35 additions and 5 deletions

View file

@ -301,6 +301,7 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
const auto geometryBuffer = DependencyManager::get<GeometryCache>();
const auto framebufferCache = DependencyManager::get<FramebufferCache>();

View file

@ -144,9 +144,7 @@ vec3 integrate(double cosTheta, double skinRadius) {
double a = -(_PI);
double inc = 0.001;
if (cosTheta > 0)
inc = 0.01;
double inc = 0.1;
while (a <= (_PI)) {
double sampleAngle = theta + a;
@ -304,7 +302,7 @@ gpu::TexturePointer SubsurfaceScattering::generatePreIntegratedScattering(Render
const int WIDTH = 128;
const int HEIGHT = 128;
auto scatteringLUT = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, WIDTH, HEIGHT));
// diffuseScatter(scatteringLUT);
// diffuseScatter(scatteringLUT);
diffuseScatterGPU(profileMap, scatteringLUT, args);
return scatteringLUT;
}

View file

@ -20,11 +20,42 @@ vec3 scatter(float r) {
}
vec3 integrate(float cosTheta, float skinRadius) {
// Angle from lighting direction.
float theta = acos(cosTheta);
vec3 totalWeights = vec3(0.0);
vec3 totalLight= vec3(0.0);
vec3 skinColour = vec3(1.0);
float a = -(_PI);
float inc = 0.1;
while (a <= (_PI)) {
float sampleAngle = theta + a;
float diffuse = clamp(cos(sampleAngle), 0.0, 1.0);
// Distance.
float sampleDist = abs(2.0 * skinRadius * sin(a * 0.5));
// Profile Weight.
vec3 weights = scatter(sampleDist);
totalWeights += weights;
totalLight += diffuse * weights /** (skinColour * skinColour)*/;
a += inc;
}
vec3 result = sqrt(totalLight / totalWeights);
return min(result, vec3(1.0));
}
in vec2 varTexCoord0;
out vec4 outFragColor;
void main(void) {
outFragColor = vec4(scatter(varTexCoord0.x * 2.0), 1.0);
outFragColor = vec4(integrate(varTexCoord0.x * 2.0 - 1, 2.0 * varTexCoord0.y), 1.0);
}