Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add storm support for camera exposure controls #3464

Open
wants to merge 34 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
22437dc
Add exposure controls to UsdGeomCamera
anderslanglands May 14, 2024
8ae7ff8
feed calculated exposure scale to HdCamera::GetExposure() via UsdImag…
anderslanglands May 14, 2024
0dea7ef
add additional doc comments explaining the exposure attributes and th…
anderslanglands May 16, 2024
dc65e05
docs clarifications
anderslanglands May 28, 2024
c3ad145
rename f-number to f-stop
anderslanglands Jun 10, 2024
cdbe0c5
add definition of nits
anderslanglands Jun 11, 2024
f9a8c8c
add units for imaging ratio
anderslanglands Jun 11, 2024
29f6b34
fix dimensions and further clarify exposure scale
anderslanglands Jun 16, 2024
aa9e5f1
fix spelling on steradian
anderslanglands Jun 24, 2024
c75aea4
fix formatting to backticks and format fStop reference
anderslanglands Jun 24, 2024
50cea0a
convert exposure scale to logarithmic exposure in adapter.
anderslanglands Jul 26, 2024
1d5c60a
replace f-number with f-stop
anderslanglands Sep 6, 2024
4ab55da
add note pointing to physLight doc and explaning the form of the equa…
anderslanglands Sep 6, 2024
425382e
update generated schema
anderslanglands Sep 6, 2024
3749e6b
add initialization for exposure fields
anderslanglands Sep 6, 2024
21d8899
Pixar schema tweaks: rename 'GetExposureScale' to 'ComputeLinearExpos…
Nov 22, 2024
2f668a6
Add exposure parameters to hydra camera schema
Nov 22, 2024
a33a85a
Add UsdImaging 2.0 support for exposure, update UsdImaging usage of U…
Nov 22, 2024
92cd975
Merge pull request #1 from tcauchois/usdGeomCamera-exposure
pmolodo Dec 9, 2024
b5d9f08
add missing camera exposure documentation in usdGeom/generatedSchema.…
pmolodo Dec 9, 2024
f574fd4
rename 'GetExposureScale' to 'ComputeLinearExposureScale' - python wr…
pmolodo Dec 9, 2024
43b89cd
Merge remote-tracking branch 'origin/dev' into usdGeomCamera-exposure
pmolodo Dec 10, 2024
4a929d4
Exposure: simplify hydra-USD mapping
pmolodo Dec 10, 2024
e916b3e
testUsdGeomCamera.test_ComputeLinearExposureScale fixes
pmolodo Dec 10, 2024
0ae21ac
bugfix for UsdImagingCameraAdapter::Get(exposureScale)
pmolodo Dec 11, 2024
7e94c68
avoid copying TfToken in loop
pmolodo Dec 11, 2024
95e2cad
undo accidental cmake version bump
pmolodo Dec 11, 2024
36becba
fix initial value of HdCamera::_exposureScale (1.0, not 0.0)
pmolodo Dec 18, 2024
846dd7f
rename tokens from exposureScale to linearExposureScale
pmolodo Dec 18, 2024
07496b0
change all instances of "exposureScale" to "linearExposureScale"
pmolodo Dec 18, 2024
52c4842
[hdx] remove some unused tokens / functions from HdxColorChannelTask
pmolodo Dec 10, 2024
fc2aa38
[hdx] taskController: remove unnecessary if/else branches simple bool…
pmolodo Dec 11, 2024
1a69581
[hdx] add HdxExposureScaleTask
pmolodo Dec 10, 2024
684f18d
Merge commit '07496b099fc5a9bf332ac02edfdbdcbb516a2514' into usdGeomC…
pmolodo Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions pxr/imaging/hd/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ HdCamera::HdCamera(SdfPath const &id)
, _shutterOpen(0.0)
, _shutterClose(0.0)
, _exposure(0.0f)
, _exposureTime(1.0f)
, _exposureIso(100.0f)
, _exposureFStop(1.0f)
, _exposureResponsivity(1.0f)
, _linearExposureScale(1.0f)
, _lensDistortionType(HdCameraTokens->standard)
, _lensDistortionK1(0.0f)
, _lensDistortionK2(0.0f)
Expand Down Expand Up @@ -238,6 +243,41 @@ HdCamera::Sync(HdSceneDelegate * sceneDelegate,
_exposure = vExposure.Get<float>();
}

const VtValue vExposureTime =
sceneDelegate->GetCameraParamValue(
id, HdCameraTokens->exposureTime);
if (!vExposureTime.IsEmpty()) {
_exposureTime = vExposureTime.Get<float>();
}

const VtValue vExposureIso =
sceneDelegate->GetCameraParamValue(
id, HdCameraTokens->exposureIso);
if (!vExposureIso.IsEmpty()) {
_exposureIso = vExposureIso.Get<float>();
}

const VtValue vExposureFStop =
sceneDelegate->GetCameraParamValue(
id, HdCameraTokens->exposureFStop);
if (!vExposureFStop.IsEmpty()) {
_exposureFStop = vExposureFStop.Get<float>();
}

const VtValue vExposureResponsivity =
sceneDelegate->GetCameraParamValue(
id, HdCameraTokens->exposureResponsivity);
if (!vExposureResponsivity.IsEmpty()) {
_exposureResponsivity = vExposureResponsivity.Get<float>();
}

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

const VtValue vLensDistortionType =
sceneDelegate->GetCameraParamValue(
id, HdCameraTokens->lensDistortionType);
Expand Down
30 changes: 29 additions & 1 deletion pxr/imaging/hd/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ PXR_NAMESPACE_OPEN_SCOPE
(shutterOpen) \
(shutterClose) \
(exposure) \
(exposureTime) \
(exposureIso) \
(exposureFStop) \
(exposureResponsivity) \
(linearExposureScale) \
\
/* how to match window with different aspect */ \
(windowPolicy) \
Expand Down Expand Up @@ -236,10 +241,26 @@ class HdCamera : public HdSprim
return _shutterClose;
}

/// Get the raw exposure exponent value.
///
/// 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
/// 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 {
return _exposure;
}

/// Get the computed linear exposure scale from the underlying camera.
///
/// 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 GetLinearExposureScale() const {
return _linearExposureScale;
}

TfToken GetLensDistortionType() const {
return _lensDistortionType;
}
Expand Down Expand Up @@ -313,10 +334,17 @@ class HdCamera : public HdSprim
float _splitDiopterWidth2;
float _splitDiopterFocusDistance2;

// shutter/lighting
// shutter
double _shutterOpen;
double _shutterClose;

// exposure
float _exposure;
float _exposureTime;
float _exposureIso;
float _exposureFStop;
float _exposureResponsivity;
float _linearExposureScale;

// lens distortion
TfToken _lensDistortionType;
Expand Down
174 changes: 172 additions & 2 deletions pxr/imaging/hd/cameraSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,41 @@ HdCameraSchema::GetExposure() const
HdCameraSchemaTokens->exposure);
}

HdFloatDataSourceHandle
HdCameraSchema::GetExposureTime() const
{
return _GetTypedDataSource<HdFloatDataSource>(
HdCameraSchemaTokens->exposureTime);
}

HdFloatDataSourceHandle
HdCameraSchema::GetExposureIso() const
{
return _GetTypedDataSource<HdFloatDataSource>(
HdCameraSchemaTokens->exposureIso);
}

HdFloatDataSourceHandle
HdCameraSchema::GetExposureFStop() const
{
return _GetTypedDataSource<HdFloatDataSource>(
HdCameraSchemaTokens->exposureFStop);
}

HdFloatDataSourceHandle
HdCameraSchema::GetExposureResponsivity() const
{
return _GetTypedDataSource<HdFloatDataSource>(
HdCameraSchemaTokens->exposureResponsivity);
}

HdFloatDataSourceHandle
HdCameraSchema::GetLinearExposureScale() const
{
return _GetTypedDataSource<HdFloatDataSource>(
HdCameraSchemaTokens->linearExposureScale);
}

HdBoolDataSourceHandle
HdCameraSchema::GetFocusOn() const
{
Expand Down Expand Up @@ -174,15 +209,20 @@ HdCameraSchema::BuildRetained(
const HdDoubleDataSourceHandle &shutterOpen,
const HdDoubleDataSourceHandle &shutterClose,
const HdFloatDataSourceHandle &exposure,
const HdFloatDataSourceHandle &exposureTime,
const HdFloatDataSourceHandle &exposureIso,
const HdFloatDataSourceHandle &exposureFStop,
const HdFloatDataSourceHandle &exposureResponsivity,
const HdFloatDataSourceHandle &linearExposureScale,
const HdBoolDataSourceHandle &focusOn,
const HdFloatDataSourceHandle &dofAspect,
const HdContainerDataSourceHandle &splitDiopter,
const HdContainerDataSourceHandle &lensDistortion,
const HdContainerDataSourceHandle &namespacedProperties
)
{
TfToken _names[18];
HdDataSourceBaseHandle _values[18];
TfToken _names[23];
HdDataSourceBaseHandle _values[23];

size_t _count = 0;

Expand Down Expand Up @@ -251,6 +291,31 @@ HdCameraSchema::BuildRetained(
_values[_count++] = exposure;
}

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

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

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

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

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

if (focusOn) {
_names[_count] = HdCameraSchemaTokens->focusOn;
_values[_count++] = focusOn;
Expand Down Expand Up @@ -382,6 +447,46 @@ HdCameraSchema::Builder::SetExposure(
return *this;
}

HdCameraSchema::Builder &
HdCameraSchema::Builder::SetExposureTime(
const HdFloatDataSourceHandle &exposureTime)
{
_exposureTime = exposureTime;
return *this;
}

HdCameraSchema::Builder &
HdCameraSchema::Builder::SetExposureIso(
const HdFloatDataSourceHandle &exposureIso)
{
_exposureIso = exposureIso;
return *this;
}

HdCameraSchema::Builder &
HdCameraSchema::Builder::SetExposureFStop(
const HdFloatDataSourceHandle &exposureFStop)
{
_exposureFStop = exposureFStop;
return *this;
}

HdCameraSchema::Builder &
HdCameraSchema::Builder::SetExposureResponsivity(
const HdFloatDataSourceHandle &exposureResponsivity)
{
_exposureResponsivity = exposureResponsivity;
return *this;
}

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

HdCameraSchema::Builder &
HdCameraSchema::Builder::SetFocusOn(
const HdBoolDataSourceHandle &focusOn)
Expand Down Expand Up @@ -439,6 +544,11 @@ HdCameraSchema::Builder::Build()
_shutterOpen,
_shutterClose,
_exposure,
_exposureTime,
_exposureIso,
_exposureFStop,
_exposureResponsivity,
_linearExposureScale,
_focusOn,
_dofAspect,
_splitDiopter,
Expand Down Expand Up @@ -494,6 +604,66 @@ HdCameraSchema::GetShutterCloseLocator()
return locator;
}

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetExposureLocator()
{
static const HdDataSourceLocator locator =
GetDefaultLocator().Append(
HdCameraSchemaTokens->exposure);
return locator;
}

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetExposureTimeLocator()
{
static const HdDataSourceLocator locator =
GetDefaultLocator().Append(
HdCameraSchemaTokens->exposureTime);
return locator;
}

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetExposureIsoLocator()
{
static const HdDataSourceLocator locator =
GetDefaultLocator().Append(
HdCameraSchemaTokens->exposureIso);
return locator;
}

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetExposureFStopLocator()
{
static const HdDataSourceLocator locator =
GetDefaultLocator().Append(
HdCameraSchemaTokens->exposureFStop);
return locator;
}

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetExposureResponsivityLocator()
{
static const HdDataSourceLocator locator =
GetDefaultLocator().Append(
HdCameraSchemaTokens->exposureResponsivity);
return locator;
}

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetLinearExposureScaleLocator()
{
static const HdDataSourceLocator locator =
GetDefaultLocator().Append(
HdCameraSchemaTokens->linearExposureScale);
return locator;
}

/* static */
const HdDataSourceLocator &
HdCameraSchema::GetNamespacedPropertiesLocator()
Expand Down
Loading