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

WIP: Volume rendering & camera changes #612

Merged
merged 27 commits into from Mar 25, 2015

Conversation

Projects
None yet
7 participants
@almarklein
Member

almarklein commented Nov 8, 2014

This PR implements volume rendering. It's basically a port of the technique that I use in Visvis.

  • New Volume visual with two rendering styles (iso and mip).
  • Volume example in examples/scene/volume.py Try it, and use the keys to switch cameras etc.
  • Refactored cameras a bit in general
  • Refactored TurnTableCamera: no more mode and distance. You can just change the fov while getting the same zoom level. Setting fov to 0 means orthographic. Zooming is done by moving camera backward.
  • New FlyCamera to fly around your data.

This is about ready. There are more things to do, but that can be picked up in another PR. (I added todo items for this in volume.py)

I wish to do more with the camera's, but we should probably discuss this first. Will make a new issue for this.

todo:

  • avoid warning when swithching render styles
  • camera's

closes issue #725

volume

Closes #725

@larsoner

This comment has been minimized.

Show comment
Hide comment
@larsoner

larsoner Nov 8, 2014

Member

What is the relationship to the existing WIP volume rendering PR? Does it
supersede it, or is it complementary?

Member

larsoner commented Nov 8, 2014

What is the relationship to the existing WIP volume rendering PR? Does it
supersede it, or is it complementary?

@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein

almarklein Nov 8, 2014

Member

It's another technique. And I believe that @lcampagn had yet another technique in mind. So I guess they can be complimentary. We probably have to make a list of advantages / disadvantages of the different techniques to see whether we need all of them.

Member

almarklein commented Nov 8, 2014

It's another technique. And I believe that @lcampagn had yet another technique in mind. So I guess they can be complimentary. We probably have to make a list of advantages / disadvantages of the different techniques to see whether we need all of them.

@almarklein almarklein referenced this pull request Nov 8, 2014

Merged

Visual tutorial #611

Show outdated Hide outdated vispy/visuals/volume.py Outdated
Show outdated Hide outdated vispy/scene/events.py Outdated
Show outdated Hide outdated vispy/visuals/transforms/chain.py Outdated
Show outdated Hide outdated vispy/visuals/volume.py Outdated
Show outdated Hide outdated examples/basics/scene/volume.py Outdated
Show outdated Hide outdated vispy/visuals/volume.py Outdated
@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein

almarklein Nov 11, 2014

Member

Changed the data to the MRI data that is in our demo-data directory. Will also upload the stent volume soon. So you guys can check the render if you want. Note that this is still WIP though ...

One thing that I want to address is improving our camera models and implement a camera that you can fly around ala flight-sim. The current render technique is set up to allow cameras inside the volume, which would be really awesome if we could make it work correctly...

Member

almarklein commented Nov 11, 2014

Changed the data to the MRI data that is in our demo-data directory. Will also upload the stent volume soon. So you guys can check the render if you want. Note that this is still WIP though ...

One thing that I want to address is improving our camera models and implement a camera that you can fly around ala flight-sim. The current render technique is set up to allow cameras inside the volume, which would be really awesome if we could make it work correctly...

@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein

almarklein Nov 26, 2014

Member

This is finally ready for review. I invite you to try out the new volume example.

  • Be sure to press "1" to select the fly-camera, and then WASD + mouse to fly through the volume.
  • Press "i" and "m" to toggle between isosurface and mip render styles.
  • With the turntable camera, use CTRL+RMB to smoothly change the fov from orthographic to perspective.
Member

almarklein commented Nov 26, 2014

This is finally ready for review. I invite you to try out the new volume example.

  • Be sure to press "1" to select the fly-camera, and then WASD + mouse to fly through the volume.
  • Press "i" and "m" to toggle between isosurface and mip render styles.
  • With the turntable camera, use CTRL+RMB to smoothly change the fov from orthographic to perspective.
@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein
Member

almarklein commented Nov 26, 2014

cc @izaid

@@ -10,6 +10,7 @@
from ..visuals import Visual
# todo: I though the visuals were mixed, but the base Node was *not* a visual?
class Node(Visual):

This comment has been minimized.

@almarklein

almarklein Nov 26, 2014

Member

@lcampagn I though the visuals were mixed, but the base Node was not a visual?

@almarklein

almarklein Nov 26, 2014

Member

@lcampagn I though the visuals were mixed, but the base Node was not a visual?

This comment has been minimized.

@campagnola

campagnola Nov 26, 2014

Member

This was just easier. We can separate Node / NodeVisual later if necessary.

@campagnola

campagnola Nov 26, 2014

Member

This was just easier. We can separate Node / NodeVisual later if necessary.

@campagnola

This comment has been minimized.

Show comment
Hide comment
@campagnola

campagnola Nov 26, 2014

Member

Looks great!

Artifact--looks like the texture is wrapping around?
anticipation1

Member

campagnola commented Nov 26, 2014

Looks great!

Artifact--looks like the texture is wrapping around?
anticipation1

Show outdated Hide outdated examples/basics/plotting/mesh.py Outdated
Show outdated Hide outdated examples/basics/scene/viewbox.py Outdated

@almarklein almarklein referenced this pull request Nov 26, 2014

Closed

Improvements to cameras #647

7 of 7 tasks complete
@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein

almarklein Nov 26, 2014

Member

@lcampagn the Turntable camera has changed, and does no longer have distance and mode properties.

Member

almarklein commented Nov 26, 2014

@lcampagn the Turntable camera has changed, and does no longer have distance and mode properties.

Show outdated Hide outdated vispy/scene/cameras/cameras.py Outdated
Show outdated Hide outdated vispy/scene/cameras/cameras.py Outdated
Show outdated Hide outdated vispy/scene/cameras/cameras.py Outdated
Show outdated Hide outdated vispy/scene/cameras/cameras.py Outdated
Show outdated Hide outdated vispy/scene/cameras/cameras.py Outdated
Show outdated Hide outdated vispy/scene/cameras/cameras.py Outdated
Show outdated Hide outdated vispy/scene/widgets/viewbox.py Outdated
@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein

almarklein Nov 27, 2014

Member

Updated: addressed some comments. Also fixed the artifact: that was related to a bug in gloo causing the texture wrapping in z-direction not to be set. I think the most "controversial" changes are related to the cameras. I propose we discuss what to do with that in #647. I can implement a new kind of turntable camera that is closer to the original version, if you want.

Member

almarklein commented Nov 27, 2014

Updated: addressed some comments. Also fixed the artifact: that was related to a bug in gloo causing the texture wrapping in z-direction not to be set. I think the most "controversial" changes are related to the cameras. I propose we discuss what to do with that in #647. I can implement a new kind of turntable camera that is closer to the original version, if you want.

@izaid

This comment has been minimized.

Show comment
Hide comment
@izaid

izaid Nov 27, 2014

Just chiming in to say I saw this. @almarklein, we talked about this method, right? My recollection is that it is better then what I was implementing.

In any case, I'll close my PR once this merges. It's not done enough.

izaid commented Nov 27, 2014

Just chiming in to say I saw this. @almarklein, we talked about this method, right? My recollection is that it is better then what I was implementing.

In any case, I'll close my PR once this merges. It's not done enough.

@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein

almarklein Nov 27, 2014

Member

@izaid yes, this is the method that we talked about. The benefit is that it does everything in a single draw, no need to draw backfaces and switch programs. And with not too much extra effort this method allows you to put the camera inside the volume.

Nevertheless, there might be advantages to your approach. How far away from a working version were you?

Member

almarklein commented Nov 27, 2014

@izaid yes, this is the method that we talked about. The benefit is that it does everything in a single draw, no need to draw backfaces and switch programs. And with not too much extra effort this method allows you to put the camera inside the volume.

Nevertheless, there might be advantages to your approach. How far away from a working version were you?

almarklein added some commits Jan 28, 2015

Node.parent and Node.children are stored as lists (not set)
I was seeing inconsistent behavior in some visualizatons and its
terribly annoyoing to try and track down a bug when its not
reproducible.
Address reviewer comments:
* aspect_ratio -> scale_ratio
* aspect_fixed -> fixed_ratio
* set_range() can be called before association with a viewbox
* set_range queries scene bounds more efficiently
* Line visual handles bounds better
* And some small details ...
@almarklein

This comment has been minimized.

Show comment
Hide comment
@almarklein

almarklein Mar 10, 2015

Member

@campagnola Thanks for the review. Addressed comments. Travis is green (except that I managed to misspell "size skip").

Member

almarklein commented Mar 10, 2015

@campagnola Thanks for the review. Addressed comments. Travis is green (except that I managed to misspell "size skip").

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 10, 2015

Coverage Status

Coverage decreased (-1.83%) to 77.02% when pulling fde101f on almarklein:volume into 0444b69 on vispy:master.

coveralls commented Mar 10, 2015

Coverage Status

Coverage decreased (-1.83%) to 77.02% when pulling fde101f on almarklein:volume into 0444b69 on vispy:master.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 10, 2015

Coverage Status

Coverage decreased (-1.83%) to 77.02% when pulling 196129c on almarklein:volume into 0444b69 on vispy:master.

coveralls commented Mar 10, 2015

Coverage Status

Coverage decreased (-1.83%) to 77.02% when pulling 196129c on almarklein:volume into 0444b69 on vispy:master.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 10, 2015

Coverage Status

Coverage decreased (-1.83%) to 77.02% when pulling 196129c on almarklein:volume into 0444b69 on vispy:master.

coveralls commented Mar 10, 2015

Coverage Status

Coverage decreased (-1.83%) to 77.02% when pulling 196129c on almarklein:volume into 0444b69 on vispy:master.

@almarklein almarklein changed the title from WIP: Volume rendering to WIP: Volume rendering & camera changes Mar 24, 2015

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 25, 2015

Coverage Status

Coverage decreased (-1.65%) to 77.14% when pulling 45b8335 on almarklein:volume into cce5011 on vispy:master.

coveralls commented Mar 25, 2015

Coverage Status

Coverage decreased (-1.65%) to 77.14% when pulling 45b8335 on almarklein:volume into cce5011 on vispy:master.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 25, 2015

Coverage Status

Coverage decreased (-1.65%) to 77.14% when pulling 45b8335 on almarklein:volume into cce5011 on vispy:master.

coveralls commented Mar 25, 2015

Coverage Status

Coverage decreased (-1.65%) to 77.14% when pulling 45b8335 on almarklein:volume into cce5011 on vispy:master.

almarklein added a commit that referenced this pull request Mar 25, 2015

Merge pull request #612 from almarklein/volume
WIP: Volume rendering & camera changes

@almarklein almarklein merged commit 3b19080 into vispy:master Mar 25, 2015

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor AppVeyor build succeeded
Details

@almarklein almarklein deleted the almarklein:volume branch Mar 25, 2015

@royerloic royerloic referenced this pull request Jun 5, 2018

Open

3D viewer #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment