Skip to content

Commit

Permalink
change all instances of "exposureScale" to "linearExposureScale"
Browse files Browse the repository at this point in the history
...to make it clear this value is a flat multiplier, not a log2 exponent
  • Loading branch information
pmolodo committed Dec 18, 2024
1 parent 846dd7f commit 07496b0
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 45 deletions.
8 changes: 4 additions & 4 deletions pxr/imaging/hd/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ HdCamera::HdCamera(SdfPath const &id)
, _exposureIso(100.0f)
, _exposureFStop(1.0f)
, _exposureResponsivity(1.0f)
, _exposureScale(1.0f)
, _linearExposureScale(1.0f)
, _lensDistortionType(HdCameraTokens->standard)
, _lensDistortionK1(0.0f)
, _lensDistortionK2(0.0f)
Expand Down Expand Up @@ -271,11 +271,11 @@ HdCamera::Sync(HdSceneDelegate * sceneDelegate,
_exposureResponsivity = vExposureResponsivity.Get<float>();
}

const VtValue vExposureScale =
const VtValue vLinearExposureScale =
sceneDelegate->GetCameraParamValue(
id, HdCameraTokens->linearExposureScale);
if (!vExposureScale.IsEmpty()) {
_exposureScale = vExposureScale.Get<float>();
if (!vLinearExposureScale.IsEmpty()) {
_linearExposureScale = vLinearExposureScale.Get<float>();
}

const VtValue vLensDistortionType =
Expand Down
10 changes: 5 additions & 5 deletions pxr/imaging/hd/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PXR_NAMESPACE_OPEN_SCOPE
(exposureIso) \
(exposureFStop) \
(exposureResponsivity) \
(linearExposureScale) \
(linearExposureScale) \
\
/* how to match window with different aspect */ \
(windowPolicy) \
Expand Down Expand Up @@ -245,7 +245,7 @@ class HdCamera : public HdSprim
///
/// This the same as the value stored in the exposure attribute on the
/// underlying camera. Note that in most cases, you will want to use
/// GetExposureScale() instead of this method, as it is the computed
/// GetLinearExposureScale() instead of this method, as it is the computed
/// end result of all related exposure attributes.
/// GetExposure() is retained as-is for backward compatibility.
float GetExposure() const {
Expand All @@ -257,8 +257,8 @@ class HdCamera : public HdSprim
/// Scaling the image brightness by this value will cause the various
/// exposure controls on \ref UsdGeomCamera to behave like those of a real
/// camera to control the exposure of the image.
float GetExposureScale() const {
return _exposureScale;
float GetLinearExposureScale() const {
return _linearExposureScale;
}

TfToken GetLensDistortionType() const {
Expand Down Expand Up @@ -344,7 +344,7 @@ class HdCamera : public HdSprim
float _exposureIso;
float _exposureFStop;
float _exposureResponsivity;
float _exposureScale;
float _linearExposureScale;

// lens distortion
TfToken _lensDistortionType;
Expand Down
18 changes: 9 additions & 9 deletions pxr/imaging/hd/cameraSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ HdCameraSchema::GetExposureResponsivity() const
}

HdFloatDataSourceHandle
HdCameraSchema::GetExposureScale() const
HdCameraSchema::GetLinearExposureScale() const
{
return _GetTypedDataSource<HdFloatDataSource>(
HdCameraSchemaTokens->linearExposureScale);
Expand Down Expand Up @@ -213,7 +213,7 @@ HdCameraSchema::BuildRetained(
const HdFloatDataSourceHandle &exposureIso,
const HdFloatDataSourceHandle &exposureFStop,
const HdFloatDataSourceHandle &exposureResponsivity,
const HdFloatDataSourceHandle &exposureScale,
const HdFloatDataSourceHandle &linearExposureScale,
const HdBoolDataSourceHandle &focusOn,
const HdFloatDataSourceHandle &dofAspect,
const HdContainerDataSourceHandle &splitDiopter,
Expand Down Expand Up @@ -311,9 +311,9 @@ HdCameraSchema::BuildRetained(
_values[_count++] = exposureResponsivity;
}

if (exposureScale) {
if (linearExposureScale) {
_names[_count] = HdCameraSchemaTokens->linearExposureScale;
_values[_count++] = exposureScale;
_values[_count++] = linearExposureScale;
}

if (focusOn) {
Expand Down Expand Up @@ -480,10 +480,10 @@ HdCameraSchema::Builder::SetExposureResponsivity(
}

HdCameraSchema::Builder &
HdCameraSchema::Builder::SetExposureScale(
const HdFloatDataSourceHandle &exposureScale)
HdCameraSchema::Builder::SetLinearExposureScale(
const HdFloatDataSourceHandle &linearExposureScale)
{
_exposureScale = exposureScale;
_linearExposureScale = linearExposureScale;
return *this;
}

Expand Down Expand Up @@ -548,7 +548,7 @@ HdCameraSchema::Builder::Build()
_exposureIso,
_exposureFStop,
_exposureResponsivity,
_exposureScale,
_linearExposureScale,
_focusOn,
_dofAspect,
_splitDiopter,
Expand Down Expand Up @@ -656,7 +656,7 @@ HdCameraSchema::GetExposureResponsivityLocator()

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetExposureScaleLocator()
HdCameraSchema::GetLinearExposureScaleLocator()
{
static const HdDataSourceLocator locator =
GetDefaultLocator().Append(
Expand Down
14 changes: 7 additions & 7 deletions pxr/imaging/hd/cameraSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class HdCameraSchema : public HdSchema
HdFloatDataSourceHandle GetExposureResponsivity() const;

HD_API
HdFloatDataSourceHandle GetExposureScale() const;
HdFloatDataSourceHandle GetLinearExposureScale() const;

HD_API
HdBoolDataSourceHandle GetFocusOn() const;
Expand Down Expand Up @@ -218,9 +218,9 @@ class HdCameraSchema : public HdSchema
HD_API
static const HdDataSourceLocator &GetExposureResponsivityLocator();

/// Prim-level relative data source locator to locate exposureScale.
/// Prim-level relative data source locator to locate linearExposureScale.
HD_API
static const HdDataSourceLocator &GetExposureScaleLocator();
static const HdDataSourceLocator &GetLinearExposureScaleLocator();

/// Prim-level relative data source locator to locate namespacedProperties.
HD_API
Expand Down Expand Up @@ -257,7 +257,7 @@ class HdCameraSchema : public HdSchema
const HdFloatDataSourceHandle &exposureIso,
const HdFloatDataSourceHandle &exposureFStop,
const HdFloatDataSourceHandle &exposureResponsivity,
const HdFloatDataSourceHandle &exposureScale,
const HdFloatDataSourceHandle &linearExposureScale,
const HdBoolDataSourceHandle &focusOn,
const HdFloatDataSourceHandle &dofAspect,
const HdContainerDataSourceHandle &splitDiopter,
Expand Down Expand Up @@ -326,8 +326,8 @@ class HdCameraSchema : public HdSchema
Builder &SetExposureResponsivity(
const HdFloatDataSourceHandle &exposureResponsivity);
HD_API
Builder &SetExposureScale(
const HdFloatDataSourceHandle &exposureScale);
Builder &SetLinearExposureScale(
const HdFloatDataSourceHandle &linearExposureScale);
HD_API
Builder &SetFocusOn(
const HdBoolDataSourceHandle &focusOn);
Expand Down Expand Up @@ -366,7 +366,7 @@ class HdCameraSchema : public HdSchema
HdFloatDataSourceHandle _exposureIso;
HdFloatDataSourceHandle _exposureFStop;
HdFloatDataSourceHandle _exposureResponsivity;
HdFloatDataSourceHandle _exposureScale;
HdFloatDataSourceHandle _linearExposureScale;
HdBoolDataSourceHandle _focusOn;
HdFloatDataSourceHandle _dofAspect;
HdContainerDataSourceHandle _splitDiopter;
Expand Down
2 changes: 1 addition & 1 deletion pxr/imaging/hd/hdSchemaDefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@
('exposureIso', T_FLOAT, dict(ADD_LOCATOR = True)),
('exposureFStop', T_FLOAT, dict(ADD_LOCATOR = True)),
('exposureResponsivity', T_FLOAT, dict(ADD_LOCATOR = True)),
('exposureScale', T_FLOAT, dict(ADD_LOCATOR = True)),
('linearExposureScale', T_FLOAT, dict(ADD_LOCATOR = True)),
('focusOn', T_BOOL, {}),
('dofAspect', T_FLOAT, {}),
('splitDiopter', 'HdSplitDiopterSchema', {}),
Expand Down
3 changes: 2 additions & 1 deletion pxr/usd/usdGeom/wrapCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ WRAP_CUSTOM {
.def("SetFromCamera", &UsdGeomCamera::SetFromCamera,
(arg("camera"),
arg("time") = UsdTimeCode::Default()))
.def("ComputeLinearExposureScale", &UsdGeomCamera::ComputeLinearExposureScale,
.def("ComputeLinearExposureScale",
&UsdGeomCamera::ComputeLinearExposureScale,
(arg("time") = UsdTimeCode::Default()))
;
}
Expand Down
4 changes: 2 additions & 2 deletions pxr/usdImaging/usdImaging/cameraAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ UsdImagingCameraAdapter::Get(UsdPrim const& prim,
return vShutterClose;
} else if (key == HdCameraTokens->exposure) {
// The raw exponential compensation attribute.
// See "exposureScale" below for the computed linear multiplier ratio.
// See "linearExposureScale" below for the computed linear multiplier.
VtValue vExposureExponent;
cam.GetExposureAttr().Get(&vExposureExponent, time); // conversion n/a
return vExposureExponent;
Expand All @@ -264,7 +264,7 @@ UsdImagingCameraAdapter::Get(UsdPrim const& prim,
cam.GetExposureResponsivityAttr().Get(&vExposureResponsivity, time); // conversion n/a
return vExposureResponsivity;
} else if (key == HdCameraTokens->linearExposureScale) {
// The computed linear exposure multiplier ratio
// The computed linear exposure multiplier.
return VtValue(cam.ComputeLinearExposureScale(time));
}

Expand Down
32 changes: 16 additions & 16 deletions pxr/usdImaging/usdImaging/dataSourceCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,22 @@ class _Vec4fArrayToVec4dArrayDataSource
typename HdTypedSampledDataSource<VtArray<GfVec4f>>::Handle _dataSource;
};

class _CameraExposureScaleDataSource
class _CameraLinearExposureScaleDataSource
: public HdTypedSampledDataSource<float>
{
public:
HD_DECLARE_DATASOURCE(_CameraExposureScaleDataSource);
HD_DECLARE_DATASOURCE(_CameraLinearExposureScaleDataSource);

_CameraExposureScaleDataSource(
_CameraLinearExposureScaleDataSource(
const SdfPath &sceneIndexPath,
UsdGeomCamera usdCamera,
const UsdImagingDataSourceStageGlobals &stageGlobals)
: _sceneIndexPath(sceneIndexPath)
, _usdCamera(usdCamera)
, _stageGlobals(stageGlobals)
{
static const HdDataSourceLocator exposureScaleLocator =
HdCameraSchema::GetExposureScaleLocator();
static const HdDataSourceLocator linearExposureScaleLocator =
HdCameraSchema::GetLinearExposureScaleLocator();

static const std::vector<TfToken> inputNames = {
UsdGeomTokens->exposure,
Expand All @@ -141,7 +141,7 @@ class _CameraExposureScaleDataSource
prim.GetAttribute(inputName),
_stageGlobals,
_sceneIndexPath,
exposureScaleLocator));
linearExposureScaleLocator));
}
}

Expand Down Expand Up @@ -204,7 +204,7 @@ HdDataSourceBaseHandle
UsdImagingDataSourceCamera::Get(const TfToken &name)
{
if (name == HdCameraSchemaTokens->linearExposureScale) {
return _CameraExposureScaleDataSource::New(
return _CameraLinearExposureScaleDataSource::New(
_sceneIndexPath, _usdCamera, _stageGlobals);
}

Expand Down Expand Up @@ -327,37 +327,37 @@ UsdImagingDataSourceCameraPrim::Invalidate(
locators.insert(
HdCameraSchema::GetShutterCloseLocator());
} else if (usdName == UsdGeomTokens->exposure) {
// "exposure" maps unchanged to "exposure", and is an
// input to the computed value stored at "exposureScale"
// "exposure" maps unchanged to "exposure", and is an input
// to the computed value stored at "linearExposureScale"
locators.insert(
HdCameraSchema::GetExposureLocator());
locators.insert(
HdCameraSchema::GetExposureScaleLocator());
HdCameraSchema::GetLinearExposureScaleLocator());
} else if (usdName == UsdGeomTokens->exposureTime) {
// "exposure:time" maps to "exposureTime", and is an
// input to the computed value stored at "exposureScale"
// "exposure:time" maps to "exposureTime", and is an input
// to the computed value stored at "linearExposureScale"
locators.insert(
HdCameraSchema::GetExposureTimeLocator());
locators.insert(
HdCameraSchema::GetExposureScaleLocator());
HdCameraSchema::GetLinearExposureScaleLocator());
} else if (usdName == UsdGeomTokens->exposureIso) {
// similar to exposureTime
locators.insert(
HdCameraSchema::GetExposureIsoLocator());
locators.insert(
HdCameraSchema::GetExposureScaleLocator());
HdCameraSchema::GetLinearExposureScaleLocator());
} else if (usdName == UsdGeomTokens->exposureFStop) {
// similar to exposureTime
locators.insert(
HdCameraSchema::GetExposureFStopLocator());
locators.insert(
HdCameraSchema::GetExposureScaleLocator());
HdCameraSchema::GetLinearExposureScaleLocator());
} else if (usdName == UsdGeomTokens->exposureResponsivity) {
// similar to exposureTime
locators.insert(
HdCameraSchema::GetExposureResponsivityLocator());
locators.insert(
HdCameraSchema::GetExposureScaleLocator());
HdCameraSchema::GetLinearExposureScaleLocator());
} else {
locators.insert(
HdCameraSchema::GetDefaultLocator().Append(
Expand Down

0 comments on commit 07496b0

Please sign in to comment.