WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 08-06-2015, 08:54 AM
fordprefect fordprefect is offline
Join Date: Oct 2012
Location: Vienna, Austria, Europe
Posts: 39
Question 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?

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), screenAxes, mask=viz.LINK_ORI)

viz.MainView.setPosition(0.5, 1, -3)
Regards, Walter
Attached Thumbnails
Click image for larger version

Name:	vizard-20150806-155830415.png
Views:	533
Size:	211.6 KB
ID:	719  
21 is only half the truth.
Reply With Quote
Old 08-06-2015, 02:33 PM
Jeff Jeff is offline
WorldViz Team Member
Join Date: Aug 2008
Posts: 2,465
Let me check with a developer for suggestions here.
Reply With Quote
Old 08-26-2015, 12:14 AM
fordprefect fordprefect is offline
Join Date: Oct 2012
Location: Vienna, Austria, Europe
Posts: 39
Any news from the developers?
BR Walter
21 is only half the truth.
Reply With Quote
Old 08-27-2015, 02:42 PM
Jeff Jeff is offline
WorldViz Team Member
Join Date: Aug 2008
Posts: 2,465
I'm moving this over to a support ticket and will post example code later.
Reply With Quote
Old 09-01-2015, 07:24 PM
jeremy jeremy is offline
Join Date: Dec 2012
Posts: 2
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:

"""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

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 =, 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 =, 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.
Please let me know if this is helpful, or if I could provide further assistance. Thank you for using Vizard.


Jeremy Sarchet
Reply With Quote

axes, icon, orientation, world

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vizard exits full screen after 30 seconds derek Vizard 3 08-21-2014 12:02 PM
Displaying screen text in 3D (Oculus Rift) pjayaram Vizard 2 05-27-2014 08:06 PM
Screen Size and Scaling javadi Vizard 2 04-02-2013 05:56 PM
Attach a TexQuad to pit.osgb screen Ducky Vizard 1 01-17-2013 02:57 PM
position of html-file on screen active_world Vizard 1 05-16-2008 07:24 PM

All times are GMT -7. The time now is 06:29 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC