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

Added stereo-mode rendering parameter #350

Merged
merged 4 commits into from
Mar 13, 2018
Merged

Conversation

favreau
Copy link
Member

@favreau favreau commented Mar 12, 2018

No description provided.

@favreau favreau force-pushed the master branch 2 times, most recently from a39504a to ec024b4 Compare March 12, 2018 17:50
{
_stereoMode = StereoMode::none;
const std::string& stereoMode = vm[PARAM_STEREO_MODE].as<std::string>();
for (size_t i = 0; i < sizeof(STEREO_MODES) / sizeof(STEREO_MODES[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STEREO_MODES.size()

@@ -216,6 +216,18 @@ class RenderingParameters : public AbstractParameters
*/
void setSamplesPerRay(const size_t spr) { _updateValue(_spr, spr); }
size_t getSamplesPerRay() const { return _spr; }
/**
* @brief Defines the number of samples per ray for ray-casting rendering
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C&P error

@@ -204,7 +206,9 @@ Vector2ui OSPRayEngine::getSupportedFrameSize(const Vector2ui& size)
return Engine::getSupportedFrameSize(size);

Vector2f result = size;
if (getCamera().getType() == CameraType::stereo)
const auto& rp = _parametersManager.getRenderingParameters();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camera still has stereo mode, why use rendering parameters here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, the stereo mode is now at an "application" level rather than camera because of the impacts on the deflect streaming.

@@ -225,7 +226,9 @@ void DeflectPlugin::_handleDeflectEvents(Engine& engine,
case deflect::Event::EVT_VIEW_SIZE_CHANGED:
{
Vector2ui newSize(event.dx, event.dy);
if (engine.getCamera().getType() == CameraType::stereo)
const auto isStereo =
_renderingParams.getStereoMode() == StereoMode::side_by_side;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camera.getStereoMode() looks still more right to me, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dito

: _type(cameraType)
Camera::Camera(const CameraType cameraType, const StereoMode stereoMode)
: _type{cameraType}
, _stereoMode{stereoMode}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all combinations make sense for example stereo modes are nonsensical with orthographic projections. Throw for incorrect combinations?

@@ -176,15 +176,15 @@ class Camera : public BaseObject
Side)
@param stereoMode The new stereo mode
*/
void setStereoMode(CameraStereoMode stereoMode)
void setStereoMode(StereoMode stereoMode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks inconsistent that you can change the stereo mode after creating the camera, but you can't change the camera type. Do you really need to change the stereo mode on this camera object? Couldn't you create a new one when the user changes the stereo mode?

@@ -231,7 +231,7 @@ class Camera : public BaseObject
float _focalLength{0.f};
float _fieldOfView{45.f};

CameraStereoMode _stereoMode{CameraStereoMode::none};
StereoMode _stereoMode{StereoMode::none};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're making changes, you should add another parameter to the stereo parameters in perspective cameras, which is the zero-parallax distance. The eye-separation is not enough to setup a correct stereo pair.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure but this will go in a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was suggesting it because it was a good opportunity to address it, even if out of scope.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, thanks for that. It's only that zero-parallax distance will need modifications in the ispc code, and it's probably going to require a bit of work. No time now :(

Cyrille Pierre Henri Favreau added 2 commits March 13, 2018 12:04
@@ -52,7 +50,7 @@ Camera& Camera::operator=(const Camera& rhs)
setAperture(getAperture());
setFocalLength(getFocalLength());
setFieldOfView(getFieldOfView());
setStereoMode(getStereoMode());
setStereoMode(rhs._stereoMode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert that again

@return the stereo mode of the Camera
*/
CameraStereoMode getStereoMode() const { return _stereoMode; }
StereoMode getStereoMode() const { return _stereoMode; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here; to keep the comment

@@ -216,6 +212,9 @@ class Camera : public BaseObject
@return the camera clip planes
*/
const ClipPlanes& getClipPlanes() const { return _clipPlanes; }
protected:
StereoMode _stereoMode{StereoMode::none};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -56,7 +56,7 @@ void OSPRayCamera::commit()
ospSet1f(_camera, "aspect", getAspectRatio());
ospSet1f(_camera, "apertureRadius", getAperture());
ospSet1f(_camera, "focusDistance", getFocalLength());
ospSet1i(_camera, "stereoMode", static_cast<uint>(getStereoMode()));
ospSet1i(_camera, "stereoMode", static_cast<uint>(_stereoMode));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@favreau favreau merged commit e367d52 into BlueBrain:master Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants