Commit d9bfba3e authored by Matt Pharr's avatar Matt Pharr

Added implementation of Disney BSDF

Specifically, this is the extended model with integrated subsurface
scattering described in
http://blog.selfshadow.com/publications/s2015-shading-course/burley/s201
5_pbs_disney_bsdf_notes.pdf.
parent 0d5fd12d
......@@ -67,6 +67,7 @@
#include "lights/point.h"
#include "lights/projection.h"
#include "lights/spot.h"
#include "materials/disney.h"
#include "materials/fourier.h"
#include "materials/glass.h"
#include "materials/hair.h"
......@@ -423,6 +424,8 @@ std::shared_ptr<Material> MakeMaterial(const std::string &name,
material = CreateMirrorMaterial(mp);
else if (name == "hair")
material = CreateHairMaterial(mp);
else if (name == "disney")
material = CreateDisneyMaterial(mp);
else if (name == "mix") {
std::string m1 = mp.FindString("namedmaterial1", "");
std::string m2 = mp.FindString("namedmaterial2", "");
......
This diff is collapsed.
/*
pbrt source code is Copyright(c) 1998-2017
Matt Pharr, Greg Humphreys, and Wenzel Jakob.
This file is part of pbrt.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(_MSC_VER)
#define NOMINMAX
#pragma once
#endif
#ifndef PBRT_MATERIALS_DISNEY_H
#define PBRT_MATERIALS_DISNEY_H
// materials/disney.h*
#include "material.h"
#include "pbrt.h"
namespace pbrt {
// DisneyMaterial Declarations
class DisneyMaterial : public Material {
public:
// DisneyMaterial Public Methods
DisneyMaterial(const std::shared_ptr<Texture<Spectrum>> &color,
const std::shared_ptr<Texture<Float>> &metallic,
const std::shared_ptr<Texture<Float>> &eta,
const std::shared_ptr<Texture<Float>> &roughness,
const std::shared_ptr<Texture<Float>> &specularTint,
const std::shared_ptr<Texture<Float>> &anisotropic,
const std::shared_ptr<Texture<Float>> &sheen,
const std::shared_ptr<Texture<Float>> &sheenTint,
const std::shared_ptr<Texture<Float>> &clearcoat,
const std::shared_ptr<Texture<Float>> &clearcoatGloss,
const std::shared_ptr<Texture<Float>> &specTrans,
const std::shared_ptr<Texture<Spectrum>> &scatterDistance,
bool thin,
const std::shared_ptr<Texture<Float>> &flatness,
const std::shared_ptr<Texture<Float>> &diffTrans,
const std::shared_ptr<Texture<Float>> &bumpMap)
: color(color),
metallic(metallic),
eta(eta),
roughness(roughness),
specularTint(specularTint),
anisotropic(anisotropic),
sheen(sheen),
sheenTint(sheenTint),
clearcoat(clearcoat),
clearcoatGloss(clearcoatGloss),
specTrans(specTrans),
scatterDistance(scatterDistance),
thin(thin),
flatness(flatness),
diffTrans(diffTrans),
bumpMap(bumpMap) {}
void ComputeScatteringFunctions(SurfaceInteraction *si, MemoryArena &arena,
TransportMode mode,
bool allowMultipleLobes) const;
private:
// DisneyMaterial Private Data
std::shared_ptr<Texture<Spectrum>> color;
std::shared_ptr<Texture<Float>> baseColor, metallic, eta;
std::shared_ptr<Texture<Float>> roughness, specularTint, anisotropic, sheen;
std::shared_ptr<Texture<Float>> sheenTint, clearcoat, clearcoatGloss;
std::shared_ptr<Texture<Float>> specTrans;
std::shared_ptr<Texture<Spectrum>> scatterDistance;
bool thin;
std::shared_ptr<Texture<Float>> flatness, diffTrans, bumpMap;
};
DisneyMaterial *CreateDisneyMaterial(const TextureParams &mp);
} // namespace pbrt
#endif // PBRT_MATERIALS_DISNEY_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment