Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
denghilbert committed Jul 25, 2023
1 parent 55d1c61 commit 395a77e
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/textures/color_ramp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ColorRamp texture (:monosp:`color_ramp`)
---------------------------------
.. pluginparameters::
:extra-rows: 7
:extra-rows: 10
* - filename
- |string|
Expand Down Expand Up @@ -85,21 +85,8 @@ ColorRamp texture (:monosp:`color_ramp`)
- Tensor array containing the texture data.
- |exposed|, |differentiable|
This plugin provides a bitmap texture that performs interpolated lookups given
a JPEG, PNG, OpenEXR, RGBE, TGA, or BMP input file.
When loading the plugin, the data is first converted into a usable color representation
for the renderer:
* In :monosp:`rgb` modes, sRGB textures are converted into a linear color space.
* In :monosp:`spectral` modes, sRGB textures are *spectrally upsampled* to plausible
smooth spectra :cite:`Jakob2019Spectral` and stored an intermediate representation
that enables efficient queries at render time.
* In :monosp:`monochrome` modes, sRGB textures are converted to grayscale.
These conversions can alternatively be disabled with the :paramtype:`raw` flag,
e.g. when textured data is already in linear space or does not represent colors
at all.
This plugin provides an interpolator based on the bitmap texture factor. It currently supports RGB and monochrome modes.
The interpolation for Spectral mode will be added.
.. tabs::
.. code-tab:: xml
Expand Down Expand Up @@ -348,6 +335,7 @@ class ColorRamp final : public Texture<Float, Spectrum> {

}

// Interpolate RGB
UnpolarizedSpectrum eval(const SurfaceInteraction3f &si,
Mask active) const override {
MI_MASKED_FUNCTION(ProfilerPhase::TextureEvaluate, active);
Expand All @@ -374,6 +362,8 @@ class ColorRamp final : public Texture<Float, Spectrum> {
if (channels == 1)
return interpolate_1dim_bitmap(si, active);
else {
// This function is equivalent to removing ColorRamp node between bitmap texture and bsdf
// TODO: Add spectral mode for ColorRamp
if constexpr (is_spectral_v<Spectrum>)
return interpolate_spectral(si, active);
else
Expand All @@ -386,6 +376,7 @@ class ColorRamp final : public Texture<Float, Spectrum> {
}
}

// Interpolate Float properties such as roughness, specular, etc.
Float eval_1(const SurfaceInteraction3f &si,
Mask active = true) const override {

Expand Down Expand Up @@ -555,12 +546,13 @@ class ColorRamp final : public Texture<Float, Spectrum> {
std::string to_string() const override {
if (m_bitmap_factor) {
std::ostringstream oss;
oss << "BitmapTexture[" << std::endl
oss << "ColorRamp[" << std::endl
<< " name = \"" << m_name << "\"," << std::endl
<< " resolution = \"" << resolution() << "\"," << std::endl
<< " raw = " << (int) m_raw << "," << std::endl
<< " mean = " << m_mean << "," << std::endl
<< " transform = " << string::indent(m_transform) << std::endl
<< " number of band = " << string::indent(m_num_band) << std::endl
<< "]";
return oss.str();
}
Expand Down

0 comments on commit 395a77e

Please sign in to comment.