#1
|
|||
|
|||
Axes Indicator on Screen
Hi @ll,
I would like to indicate the worlds orientation by the 3D axes object, in the lower left corner of the screen. I manage to get the axes and somehow point right, but the blue axis is not there at all; seems that an object parented by viz.SCREEN will be 2D only. Another issue is that when viewed from the opposite direction, there is no light on the axes so they go black. Someone already needed this and can hint what I'm missing, or guide to a working code? Code:
import viz import vizshape dojo = viz.addChild('dojo.osgb') trueAxes = vizshape.addAxes() screenAxes = vizshape.addAxes(scale=[0.09]*3, pos=[0.1, 0.1, 0.5], parent=viz.SCREEN) viz.link(viz.MainView, screenAxes, mask=viz.LINK_ORI) viz.MainView.setPosition(0.5, 1, -3) viz.go()
__________________
21 is only half the truth. |
#2
|
|||
|
|||
Let me check with a developer for suggestions here.
|
#3
|
|||
|
|||
Any news from the developers?
BR Walter
__________________
21 is only half the truth. |
#4
|
|||
|
|||
I'm moving this over to a support ticket and will post example code later.
|
#5
|
|||
|
|||
Axes indicator sample script
Hello Walter,
Thank you for your post. I like the feature idea I've gone and put together a sample script, here is the code: Code:
"""Two examples of ways to provide a visual indicator of world orientation which is always in view. A compass of sorts, effectively setup as a "Heads-up display" or HUD. Two options are provided: The first sets up the HUD as a group node which is linked to the view. The second sets up a VizGUICanvas object, which is a new feature in Vizard 5 providing a flat render node designed for displaying GUI elements or other nodes. (In this example the canvas uses the "WorldOverlay" render mode). For both of these examples, the HUD is a node in the world (as opposed to being in an ortho window, or screen space). While it is possible to set up a HUD in window or screen space, an advantage to having a HUD in world space is that rendering can be simplified as there's no need for special treatment for such aspects as lighting, depth testing, or stereo. """ import viz import vizshape viz.go() dojo = viz.addChild('dojo.osgb') viz.MainView.setPosition(0.5, 1, -3) # Set to 1 or 2 as desired example = 1 if example == 1: # Set up a group node to be the HUD. # Other geometry will be parented to this node. viewGroup = viz.addGroup() # Link the HUD to the main view so it's always in view viewGroupLink = viz.link(viz.MainView, viewGroup) # Shift the HUD a meter in front and down and to the left a bit viewGroupLink.preTrans([-0.3, -0.2, 1]) # Add a small 20x20cm grid to provide a bit of frame of reference grid = vizshape.addGrid(size=(0.2, 0.2), step=0.05, parent=viewGroup) # Add small (10cm long) axes which will serve as the indicator axes = vizshape.addAxes(length=0.1, parent=viewGroup) if example == 2: # Setup a GUI canvas to serve as the HUD # One advantage of the GUI canvas is that, as a separate render # node, it is always drawn on top. So the HUD won't be occluded # when the view gets up close to an object in the scene. canvas = viz.addGUICanvas() # Define the dimensions of the canvas canvasDimensions = [800, 600] # width, height in (virtual) pixels # Canvas field of view will be slightly smaller than the window's canvasFOV = viz.MainWindow.getVerticalFOV() - 15 # Depth of 1m canvasDepth = 1 # distance out in front (meters) # Set up the canvas render parameters canvas.setRenderWorldOverlay(canvasDimensions, canvasFOV, canvasDepth) # Because the canvas-space has units of pixels, added nodes must # be greatly scaled up to appear acceptably-sized canvasUpscale = [100, 100, 100] # Add a grid to provide a bit of frame of reference grid = vizshape.addGrid(size=(2, 2), step=0.5, scale=canvasUpscale, parent=canvas) # Add axes which will serve as the indicator # The axes are parented to the canvas, placing them at the origin in # canvas-space, which is the lower-left corner of the canvas. axes = vizshape.addAxes(scale=canvasUpscale, enable=viz.DEPTH_TEST, parent=canvas) # Setup a link in orientation between the dojo (world coordinates) # and the axes (the indicator of world orientation) link = viz.link(dojo, axes, mask=viz.LINK_ORI) # Because the axes are linked to the main view, any orientation of the # main view needs to be negated in order that the axes align properly # with the world coordinates. Setup a link operator wherein the link # is post-multiplied with the inverse matrix of the main view. link.postMultInverseLinkable(viz.MainView) Best, Jeremy Sarchet |
Tags |
axes, icon, orientation, world |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Vizard exits full screen after 30 seconds | derek | Vizard | 3 | 08-21-2014 01:02 PM |
Displaying screen text in 3D (Oculus Rift) | pjayaram | Vizard | 2 | 05-27-2014 09:06 PM |
Screen Size and Scaling | javadi | Vizard | 2 | 04-02-2013 06:56 PM |
Attach a TexQuad to pit.osgb screen | Ducky | Vizard | 1 | 01-17-2013 03:57 PM |
position of html-file on screen | active_world | Vizard | 1 | 05-16-2008 08:24 PM |