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

Reworked proximity renderer #518

Merged
merged 3 commits into from
Aug 16, 2018
Merged

Reworked proximity renderer #518

merged 3 commits into from
Aug 16, 2018

Conversation

favreau
Copy link
Member

@favreau favreau commented Aug 15, 2018

The idea is to be able to show or hide the geometry without impacting the rendering of the touches. New rendering parameters are:

  • Surface shading: Activates or deactivates the rendering of the surfaces
  • Alpha correction: Used to blend colors as the ray goes through intersections

auto& testSuite = boost::unit_test::framework::master_test_suite();

const char* app = testSuite.argv[0];
const char* argv[] = {app, "--renderer",
Copy link
Contributor

Choose a reason for hiding this comment

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

The args are formatted weird. Why not:

const char* argv[] = {app, "demo",
                      "--renderer", "proximity",
                      "--samples-per-pixel", "16",
                      "--synchronous-mode", "true"};

Copy link
Member Author

Choose a reason for hiding this comment

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

Ask clang-format ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

If you move "demo" as the first argument then the other arguments and values might line up better

Copy link

Choose a reason for hiding this comment

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

you can also // clang-format off it's too messy ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

The format applied here is what we agreed on when we decided to use clang-format. I would not see the point of making an exception here. And I don't see any issue with the new formatting, it's clear and not messy at all. Am I missing something?

@tribal-tec
Copy link
Contributor

What's different/new/fixed in 'Reworked'? Hard to see from the code.

@favreau
Copy link
Member Author

favreau commented Aug 16, 2018

@tribal-tec. Just added a description to the PR. Let me know if it's still unclear.

@tribal-tec
Copy link
Contributor

Thx, much better. Please put that to the commit message also when you rebase/merge.

@favreau favreau force-pushed the master branch 2 times, most recently from f20cdb4 to c0950af Compare August 16, 2018 09:33
@@ -222,6 +222,31 @@ BOOST_AUTO_TEST_CASE(render_circuit_with_particle_renderer)
brayns.getEngine().getFrameBuffer()));
}

BOOST_AUTO_TEST_CASE(render_circuit_with_proximity_renderer)
Copy link
Contributor

Choose a reason for hiding this comment

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

This test doesn't use a circuit here. We should move all the tests that do not need BBPTestDaa to a separate file.

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 agree, but will do a separate PR for that.

camera.setPosition(camPos - (rotCenter - camPos));

brayns.render();
BOOST_CHECK(compareTestImage("testdataallmini50proximity.png",
Copy link
Contributor

Choose a reason for hiding this comment

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

testproximity.png only?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. testDemoProximity.png

if (self->detectionDistance > 0.f &&
ray.t < self->detectionDistance * 1000.f)
bool continueWithSurfaceShading = true;
if (self->detectionDistance)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not write detectionDistance > 0.f, it looks a bit weird to treat a float as a bool.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hum... it's not a boolean, it really is a test on the value. We do the same for shadow intensity, and ambient occlusion strength for example. I don't think we need to introduce a new boolean variable there. Ok with you?

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, forget my comment.

postIntersect(self->super.super.model, dg, ao_ray,
DG_MATERIALID);

varying bool test = true;
bool test = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to doDetectionTest

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

postIntersect(self->super.super.model, dg, ao_ray,
DG_MATERIALID);

varying bool test = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is clearer to write like this:

if (self->detectionOnDifferentMaterial && material == dg.material)
test = false;

or make one expression like:

bool doDetectionTest = !(self->detectionOnDifferenetMaterial && material == dg.material);

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

color = self->nearColor * opacity / ao_ray.t;
const float a = ao_ray.t / self->detectionDistance;
const vec4f touchColor =
make_vec4f(a > 0.2f ? self->nearColor : self->farColor,
Copy link
Contributor

Choose a reason for hiding this comment

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

0.2f is a magic number so it should be a constant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. created a nearFarThreshold constant.

@favreau favreau force-pushed the master branch 2 times, most recently from 5e3ed75 to f72e912 Compare August 16, 2018 13:48
camera.setTarget(rotCenter);
camera.setPosition(camPos - (rotCenter - camPos));

brayns.render();
Copy link
Contributor

Choose a reason for hiding this comment

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

After my previous PR, you have to call commitAndRender() here now to fix the test error in CI.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the tip.

Copy link
Member Author

Choose a reason for hiding this comment

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

hum... fails in debug.
Test is aborted Leaving test module "braynsAddModelFromBlob"; testing time: 2179609us LeakSanitizer: bad pointer 0x000000000056

…he geometry without impacting the rendering of the touches. New rendering parameters are:

- Surface shading: Activates or deactivates the rendering of the surfaces
- Alpha correction: Used to blend colors as the ray goes through intersections
@favreau
Copy link
Member Author

favreau commented Aug 16, 2018

Retest this please

@favreau favreau merged commit 40468e2 into BlueBrain:master Aug 16, 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.

None yet

5 participants