-
Notifications
You must be signed in to change notification settings - Fork 47
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
Conversation
a39504a
to
ec024b4
Compare
{ | ||
_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]); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dito
brayns/common/camera/Camera.cpp
Outdated
: _type(cameraType) | ||
Camera::Camera(const CameraType cameraType, const StereoMode stereoMode) | ||
: _type{cameraType} | ||
, _stereoMode{stereoMode} |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :(
brayns/common/camera/Camera.cpp
Outdated
@@ -52,7 +50,7 @@ Camera& Camera::operator=(const Camera& rhs) | |||
setAperture(getAperture()); | |||
setFocalLength(getFocalLength()); | |||
setFieldOfView(getFieldOfView()); | |||
setStereoMode(getStereoMode()); | |||
setStereoMode(rhs._stereoMode); |
There was a problem hiding this comment.
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; } |
There was a problem hiding this comment.
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
brayns/common/camera/Camera.h
Outdated
@@ -216,6 +212,9 @@ class Camera : public BaseObject | |||
@return the camera clip planes | |||
*/ | |||
const ClipPlanes& getClipPlanes() const { return _clipPlanes; } | |||
protected: | |||
StereoMode _stereoMode{StereoMode::none}; |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
No description provided.