diff --git a/src/textures/color_ramp.cpp b/src/textures/color_ramp.cpp index 13ed01642..8579369f1 100644 --- a/src/textures/color_ramp.cpp +++ b/src/textures/color_ramp.cpp @@ -46,16 +46,20 @@ ColorRamp texture (:monosp:`color_ramp`) - ``nearest``: disable filtering and interpolation. In this mode, the plugin performs nearest neighbor lookups of texture values. - * - wrap_mode - - |string| - - Controls the behavior of texture evaluations that fall outside of the - :math:`[0, 1]` range. The following options are currently available: - - - ``repeat`` (default): tile the texture infinitely. + * - num_band + - |integer| + - Specifies the number of color bands used in ColorRamp - - ``mirror``: mirror the texture along its boundaries. +* - posx + - |float| + - Specifies the position of color bands used in ColorRamp + - x starts from 0 to num_band - 1 + - Used for interpolation factor - - ``clamp``: clamp coordinates to the edge of the texture. +* - colorx + - |Color3f| + - Specifies the 3 channels of color bands used in ColorRamp + - Used for interpolation color results * - raw - |bool| @@ -99,18 +103,33 @@ at all. .. tabs:: .. code-tab:: xml - :name: bitmap-texture + :name: color-ramp - + - + + + + + .. code-tab:: python - 'type': 'bitmap', + 'type': 'color_ramp', 'filename': 'texture.png', - 'wrap_mode': 'mirror' + "mode": "linear", + "num_band": 2, + "pos0": 0.0, + "pos1": 1.0, + "color0": { + 'type': 'rgb', + 'value': [0.0, 0.0, 0.0] + }, + "color1": { + 'type': 'rgb', + 'value': [1.0, 1.0, 1.0] + }, */ @@ -329,7 +348,6 @@ class ColorRamp final : public Texture { } - // m_base_color in principled UnpolarizedSpectrum eval(const SurfaceInteraction3f &si, Mask active) const override { MI_MASKED_FUNCTION(ProfilerPhase::TextureEvaluate, active); @@ -368,8 +386,6 @@ class ColorRamp final : public Texture { } } - // m_roughness, m_anisotropic, m_sheen, m_sheen_tint, m_spec_trans, m_flatness, - // m_spec_tint, m_clearcoat, m_clearcoat, m_metallic in principled Float eval_1(const SurfaceInteraction3f &si, Mask active = true) const override { @@ -672,7 +688,7 @@ class ColorRamp final : public Texture { m_name); } - /// Construct 2D distribution upon first access, avoid races + // Construct 2D distribution upon first access, avoid races MI_INLINE void init_distr() const { std::lock_guard lock(m_mutex); if (!m_distr2d) { @@ -681,7 +697,7 @@ class ColorRamp final : public Texture { } } - // Calculate the weight of cardinal and B-splines interpolation + // Calculate the weight of cardinal and B-spline interpolation // Borrow from Blender MI_INLINE void key_curve_position_weights(Float t, Float *data, std::string type) const { if(type == "cardinal") { @@ -1356,7 +1372,6 @@ class ColorRamp final : public Texture { ref m_bitmap; std::string m_name; - // Single factor ScalarFloat m_factor; // Bitmap or color interpolator @@ -1378,4 +1393,4 @@ class ColorRamp final : public Texture { MI_IMPLEMENT_CLASS_VARIANT(ColorRamp, Texture) MI_EXPORT_PLUGIN(ColorRamp, "Color Ramp") -NAMESPACE_END(mitsuba) +NAMESPACE_END(mitsuba) \ No newline at end of file