Opened 10 years ago

Last modified 2 years ago

#96 assigned enhancement

Make orthoplanes and box volume display use lighting

Reported by: Tom Goddard Owned by: Tom Goddard
Priority: minor Milestone:
Component: Volume Data Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: chimera

Description (last modified by Eric Pettersen)

Currently orthoplanes does not use lighting. Graham Johnson suggested it would give good depth cues, especially ambient lighting.

Change History (7)

comment:1 by Tom Goddard, 10 years ago

Tried this and hit an error compiling shader because it has multiple texture units (shadows and 2d texture for grayscale rendering) but the texture units are not yet set at the time the shader is validated, so it fails the validation because the same default texture units are used for both textures.

I'm using PyOpenGL to compile, link and validate the shader programs which does not allow me to set the texture units before validation. Will need to use my own compile and link code.

comment:2 by Tom Goddard, 10 years ago

Traceback (most recent call last):
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/cmd_line/gui.py", line 124, in on_enter
thumb = session.main_view.image(width=100, height=100)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/view.py", line 345, in image
self._draw_scene(c, drawings)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/view.py", line 606, in _draw_scene
draw_drawings(r, cpinv, mdraw)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 925, in draw_drawings
_draw_multiple(drawings, r, p, Drawing.OPAQUE_DRAW_PASS)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 937, in _draw_multiple
d.draw(r, place, draw_pass, selected_only)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 536, in draw
self._draw_children(renderer, pp, draw_pass, so)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 567, in _draw_children
d.draw(renderer, place, draw_pass, selected_only)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 536, in draw
self._draw_children(renderer, pp, draw_pass, so)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 567, in _draw_children
d.draw(renderer, place, draw_pass, selected_only)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/map/grayscale.py", line 123, in draw
Drawing.draw(self, renderer, place, draw_pass, selected_only)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 536, in draw
self._draw_children(renderer, pp, draw_pass, so)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 567, in _draw_children
d.draw(renderer, place, draw_pass, selected_only)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 529, in draw
self.draw_self(renderer, place, draw_pass, selected_only)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 554, in draw_self
self._draw_geometry(renderer, selected_only)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 579, in _draw_geometry
ds.activate_shader_and_bindings(renderer, self._shader_options())
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/drawing.py", line 1146, in activate_shader_and_bindings
shader = renderer.shader(sopt)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/opengl.py", line 105, in shader
p = self.opengl_shader(options)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/opengl.py", line 171, in opengl_shader
p = Shader(capabilities, self.max_multishadows())
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/opengl.py", line 1271, in init
self.program_id = self.compile_shader(capabilities, max_shadows)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/chimera/core/graphics/opengl.py", line 1317, in compile_shader
prog_id = shaders.compileProgram(vs, fs)
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyOpenGL-3.1.0-py3.4.egg/OpenGL/GL/shaders.py", line 196, in compileProgram
program.check_validate()
File "/Users/goddard/ucsf/chimera2/Chimera2.app/Contents/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyOpenGL-3.1.0-py3.4.egg/OpenGL/GL/shaders.py", line 108, in check_validate
glGetProgramInfoLog( self ),
RuntimeError: Validation failure (0): b"Validation Failed: Sampler error:\n Samplers of different types use the same texture image unit.\n - or -\n A sampler's texture unit is out of range (greater than max allowed or negative).\n"

comment:3 by Tom Goddard, 10 years ago

The black background of the orthoplane planes may make shadows not useful.

comment:4 by Eric Pettersen, 10 years ago

Component: Volume ViewerVolume Data
Owner: changed from Tom Goddard to Eric Pettersen

comment:5 by Tom Goddard, 10 years ago

Owner: changed from Eric Pettersen to Tom Goddard
Status: newassigned

comment:6 by Eric Pettersen, 2 years ago

Description: modified (diff)

Is this the same as the proposal in the R01, which was also requested by the NIH folks? If so, Phil and possibly others should be added to the cc list.

comment:7 by Tom Goddard, 2 years ago

No. The R01 and the request today from NIAID (Phil Cruz) was for lighting of transparent volumetric rendering. This ticket is about lighting on the opaque planes shown in orthoplanes and box modes. The request in this ticket would be easy since we already cast shadows from opaque objects, but it is intentionally turned off for orthoplanes because I think it detracts from interpreting the grayscale data, although admittedly it gives a slicker 3D appearance. The R01 proposal and NIAID request is to handle transparency in lighting and is much harder. I'm not sure if we have a ticket for that.

Note: See TracTickets for help on using tickets.