On this page |
Overview ¶
To access a viewport, you must first get a reference to a Scene Viewer pane tab. See the following methods:
Use hou.ui.paneTabOfType(hou.paneTabType.SceneViewer)
to get a reference to a Scene Viewer pane tab in the current pane layout. If the current layout has no Scene Viewer pane tab, this returns None
.
To be more precise about which viewer you grab in a possible multi-viewer layout, see also hou.ui.curDesktop to get a hou.Desktop object representing the current pane layout, and hou.Desktop.sceneViewers to get a list of scene viewer pane tabs in the current layout.
Once you have a reference to a hou.SceneViewer pane object, you can use it to access the viewer pane’s viewport or viewports. See the following methods:
Returns a list of the viewports in the viewer pane.
Gets a single viewport by name, for example "Top"
.
hou.SceneViewer.selectedViewport
Gets the currently “selected” viewport. The user can select a viewport by pressing Space + N in the viewport. The view menus in the upper right corner are drawn brighter in the selected viewport.
You can then get a GeometryViewportSettings
object for the viewport by calling hou.GeometryViewport.settings.
Tip
Some of the more commonly-used methods, such as setting the view to look through a camera, are duplicated on the hou.GeometryViewport object for convenience.
Methods ¶
Camera ¶
setCamera(camera_node)
Makes the viewport look through the given camera node.
camera()
→ ObjNode or None
Return the camera or light node that the viewport is looking through. Return None if the viewport is not looking through a camera or light node.
saveViewToCamera(camera_node)
Saves the viewport’s current view into the given camera node. It does this by setting the camera’s transform parameters to match the viewport’s view transform matrix.
Markers ¶
displaySet(display_set)
→ hou.GeometryViewportDisplaySet
Returns the hou.GeometryViewportDisplaySet object associated with display_set
, which must be a type of hou.displaySetType. A display set describes a certain category of displayed geometry (for example, “templated geometry”, or “current (selected) geometry”). The associated GeometryViewportDisplaySet
object lets you customize how that category of geometry is drawn in the viewport, for example wireframe/shaded, showing point numbers, and so on.
setUVMapTexture(uv)
Set the file path of the texture map used to visualize UVs when geometry has a UV attribute but no material assigned.
uvMapTexture()
→ str
Return the file path of the texture map used to visualize UVs when geometry has a UV attribute but no material assigned.
setUVMapScale(scale)
Set the UV scaling factor for the UV Map when visualizing UVs. It defaults to 1.
uvMapScale()
→ float
Returns the UV scaling factor for the UV Map when visualizing UVs.
Guides ¶
enableGuide(guide, on)
Show or hide a guide. The guide argument must be a type of hou.viewportGuide.
guideEnabled(guide)
→ bool
Test if a guide is visible. The guide argument must be a type of hou.viewportGuide.
normalScale()
→ float
Query the scale applied to the length of normal decorations.
setNormalScale(normal_scale)
Set a scale factor for the display of normals to increase or decrease their length.
vectorScale()
→ float
Query the scale applied to the length of vector decorations.
setVectorScale(scale)
Set the scale applied to vector decorations, to make them longer or shorter.
pointMarkerSize()
→ float
Queries the size of point marker decorations, in pixels.
setPointMarkerSize(point_size)
Set the size of point marker decorations, in pixels.
originGnomonSize()
→ float
Queries the world size of the gnomon axes that appear at the world origin.
setOriginGnomonSize(size)
Sets the world size of the gnomon axes that appear at the world origin.
floatingGnomonSize()
→ float
Queries the size of the gnomon axes that appear in the corner of the 3D viewport.
setFloatingGnomonSize(size)
Sets the world size of the gnomon axes that appear in the corner of the 3D viewport.
geometryInfo()
→ hou.viewportGeometryInfo
Queries the current geometry information display setting:
-
hou.viewportGeometryInfo.Off
: No information displayed. -
hou.viewportGeometryInfo.SelectedOnly
: only display information if something is selected. -
hou.viewportGeometryInfo.Always
: Always display information.
geometryInfo(hou.viewportGeometryInfo)
Queries the current geometry information display setting:
-
hou.viewportGeometryInfo.Off
: No information displayed. -
hou.viewportGeometryInfo.SelectedOnly
: only display information if something is selected. -
hou.viewportGeometryInfo.Always
: Always display information.
handleHighlight()
→ hou.viewportHandleHighlight
Queries the size of the handle highlight when the mouse is over a handle part:
-
hou.viewportHandleHighlight.Off
: Handles do not show highlights. -
hou.viewportHandleHighlight.Small
: Handles have a subtle highlight. -
hou.viewportHandleHighlight.Normal
: Handles use their default highlight, which is twice the width of the small highlight.
handleHighlight(hou.viewportHandleHighlight)
Sets the size of the handle highlight when the mouse is over a handle part:
-
hou.viewportHandleHighlight.Off
: Handles do not show highlights. -
hou.viewportHandleHighlight.Small
: Handles have a subtle highlight. -
hou.viewportHandleHighlight.Normal
: Handles use their default highlight, which is twice the width of the small highlight.
closureSelection()
→ hou.viewportClosureSelection
Queries the current closure selection display. A Closure selection is shown on a primitive when any part of that primitive is selected.
-
hou.viewportClosureSelection.Hide
: Do not show closure selections. -
hou.viewportClosureSelection.HullPrimitives
: Only show closure selections on primitives that have hulls which are disconnected from the tessellated surface or curve (such as a NURBS surface). -
hou.viewportClosureSelection.Show
: Show closure selections on all primitive types.
closureSelection(hou.viewportClosureSelection)
Change the closure selection display setting. A Closure selection is shown on a primitive when any part of that primitive is selected.
-
hou.viewportClosureSelection.Hide
: Do not show closure selections. -
hou.viewportClosureSelection.HullPrimitives
: Only show closure selections on primitives that have hulls which are disconnected from the tessellated surface or curve (such as a NURBS surface). -
hou.viewportClosureSelection.Show
: Show closure selections on all primitive types.
guideFontSize()
→ hou.viewportGuideFont
Query the current size of the font used for text decorations.
-
hou.viewportGuideFont.Tiny
: Smallest font size available. -
hou.viewportGuideFont.Small
: Slightly more compact font than medium. -
hou.viewportGuideFont.Medium
: Default font size. -
hou.viewportGuideFont.Large
: Large font size suitable for high DPI displays.
guideFontSize(hou.viewportGuideFont)
Query the current size of the font used for text decorations.
-
hou.viewportGuideFont.Tiny
: Smallest font size available. -
hou.viewportGuideFont.Small
: Slightly more compact font than medium. -
hou.viewportGuideFont.Medium
: Default font size. -
hou.viewportGuideFont.Large
: Large font size suitable for high DPI displays.
offsetVertexMarkers()
→ bool
When enabled, vertex markers and normals are inset into the polygon so they can be selected independently when part of a seamless mesh. When disabled, the markers and normals are placed at the actual vertex, potentially overlapping.
setOffsetVertexMarkers(enable)
When enabled, vertex markers and normals are inset into the polygon so they can be selected independently when part of a seamless mesh. When disabled, the markers and normals are placed at the actual vertex, potentially overlapping.
Geometry ¶
levelOfDetail(value)
Sets the level of detail used for tessellating geometry, such as NURBS surfaces and curves, subdivision curves, primitive sphere, tubes, and circles. 1 is the normal setting, 0 is very coarse, 2+ is finer
levelOfDetail()
→ double
Query the current level of detail used for tessellating geometry.
volumeQuality(viewportVolumeQuality)
Set the volume display quality.
-
hou.viewportVolumeQuality.VeryLow
: Very fast, low quality preview -
hou.viewportVolumeQuality.Low
: Fewer slices than Normal for speed -
hou.viewportVolumeQuality.Normal
: Good quality vs. speed setting. -
hou.viewportVolumeQuality.High
: Large number of slices with jittering
volumeQuality()
→ hou.viewportVolumeQuality
Query the volume display quality.
-
hou.viewportVolumeQuality.VeryLow
: Very fast, low quality preview -
hou.viewportVolumeQuality.Low
: Fewer slices than Normal for speed -
hou.viewportVolumeQuality.Normal
: Good quality vs. speed setting. -
hou.viewportVolumeQuality.High
: Large number of slices with jittering
volumeAmbientShadows(shadows)
Set the default intensity of self-shadowing for fog volumes from ambient
light sources. This default is overridden by the volvis_ambientshadows
detail attribute. Note that the default headlight is treated as an ambient
source by fog volumes.
volumeAmbientShadows()
→ double
Query the default intensity of self-shadowing for fog volumes from ambient light sources.
volumeBSplines(use_bsplines)
Controls how the viewport reads volume values. Low resolution volumes may appear blocky when use of b-spline interpolation is disabled. The argument has to be one of the following options.
-
hou.viewportVolumeBSplines.Off
: the viewport will never use higher-order volume interpolation. This is the fastest to draw, but low resolution volumes may appear blocky in the viewport. -
hou.viewportVolumeBSplines.NonInteractive
: the viewport will use the higher-order interpolation when not interacting with the viewport. This mode falls back to linear interpolation while interacting with the viewport to speed up draws. -
hou.viewportVolumeBSplines.On
: the viewport will always use higher-order volume interpolation. This is the slowest, highest quality option.
Note
The equivalent setting in the viewport display options can be found in the Geometry tab and is labelled Volume Filtering.
volumeBSplines()
→ hou.viewportVolumeBSplines
Query if higher order interpolation is used by the viewport to draw fog volumes.
-
hou.viewportVolumeBSplines.Off
: the viewport will never use higher-order volume interpolation. This is the fastest to draw, but low resolution volumes may appear blocky in the viewport. -
hou.viewportVolumeBSplines.NonInteractive
: the viewport will use the higher-order interpolation when not interacting with the viewport. This mode falls back to linear interpolation while interacting with the viewport to speed up draws. -
hou.viewportVolumeBSplines.On
: the viewport will always use higher-order volume interpolation. This is the slowest, highest quality option.
Note
The equivalent setting in the viewport display options can be found in the Geometry tab and is labelled Volume Filtering.
volumeWireAsPoints(as_points)
Draw volumes as a point field when in wireframe modes if enabled, wireframe bounding box only otherwise.
volumeWireAsPoints()
→ bool
Query if volumes are currently drawn as a point field in wireframe.
polygonConvexQuality(quality)
Set the polygon convexer quality to high quality (true
) or fast (false
).
High quality redoes the convexing if the topology or point positions change.
Fast only redoes the convexing if topology changes.
polygonConvexQuality()
→ bool
Query the polygon convexing quality, true
for high quality and false
for fast convexing.
subdivsionLimit(limit_in_millions)
Limit the subdivision levels so that no more than `limit_in_millions' polygons are produced by the subdivision. Lower values may be needed for weak graphics hardware.
subdivsionLimit()
→ int
Returns the current subdivision polygon limit, in millions of polygons.
wireWidth(width)
Set the width of lines drawn for wireframe and wire-over-shaded modes. Lines in wireframe modes is limited to the line width range of the graphics hardware. Polygon outlines in wire-over-shaded mode can be any width, though very thick lines begin to show artifacts near vertices.
wireWidth()
→ double
Query the width of lines drawn for wireframe and wire-over-shaded modes.
wireBlend(blend)
Set the blend factor between wires and the surface in wire-over-shaded modes. Values close to 0 produce very faint lines, values closer to 1 produce solid lines. This has no effect in pure wireframe modes.
wireBlend()
→ double
Query the blend factor between wires and the surface in wire-over-shaded modes. Values close to 0 produce very faint lines, values closer to 1 produce solid lines.
interiorWireAlpha(alpha)
Set the dimness of the interior wires in a tet mesh. Outer wires are drawn normally, inner wires are dimmed. This only affects tet meshes in wireframe mode.
interiorWireAlpha()
→ double
Query the dimness of the interior wires in a tet mesh. Outer wires are drawn normally, inner wires are dimmed. This only affects tet meshes in wireframe mode.
shadeOpenCurves(shade)
Globally enable or disable shaded open curves. The object parameter
Shade Open Curves in Viewport must also be enabled in order for this
to affect curves in the object. When on, curves are drawn as ribbons with
their thickness driven by the width
attribute. Otherwise they are drawn
as lines.
shadeOpenCurves()
→ bool
Query if shaded open curves are enabled or not.
selectWireframeAsSolid(as_solid)
Enable or disable selection of wireframe polygons by their face. When on, a wireframe polygon can be selected by clicking on its face even though the face not actually drawn. When off, the polygon can only be selected by clicking on or near its edges in wireframe mode.
selectWireframeAsSolid()
→ bool
Query if selection of wireframe polygons is done by face (true
) or
edge (false
).
setWireOverPackedGeo(wire_over_packed)
Show polygon outlines on meshes in packed geometry when drawing a wire-over-shaded mode. Disabling this hides the outlines on packed geometry, making meshes appear as a single shape, which packed geometry technically is.
wireOverPackedGeo()
→ bool
Query if polygon outlines are visible on packed geometry when a wire-over-shaded mode is active.
particleDisplayType(viewportParticleDisplay)
Set the default particle display.
-
hou.viewportParticleDisplay.Points
: Constant sized point marker, with the diameter specified byparticlePointSize
. This marker is unaffected bypscale
. -
hou.viewportParticleDisplay.Pixels
: Single pixel drawn for a particle. -
hou.viewportParticleDisplay.Lines
: Streak trail plus marker. -
hou.viewportParticleDisplay.Discs
: World-space circle, affected bypscale
ordiscSize
.
particleDisplayType()
→ hou.viewportParticleDisplay
Query the default particle display.
-
hou.viewportParticleDisplay.Points
: Constant sized point marker, with the diameter specified byparticlePointSize
. This marker is unaffected bypscale
. -
hou.viewportParticleDisplay.Pixels
: Single pixel drawn for a particle. -
hou.viewportParticleDisplay.Lines
: Streak trail plus marker. -
hou.viewportParticleDisplay.Discs
: World-space circle, affected bypscale
ordiscSize
.
allowParticleSprites(sprites)
Draw particles as sprites when sprite attributes are detected on the
particle (sprite*
or shop_materialpath
).
allowParticleSprites()
→ bool
Query if particles are drawn as sprites when sprite attributes are
detected on the particle (sprite*
or shop_materialpath
).
particlePointSize(size)
Set the point diameter for particles drawn as Points
or Lines
. This
is in screen pixels, not world space units.
particlePointSize()
→ double
Query the point diameter for particles drawn as Points
or Lines
.
particleDiscSize(size)
Set the disc diameter for particles drawn as Discs
or Sprites
if
the pscale
attribute does not exist. This is specified in world-space
units.
particleDiscSize()
→ double
Query the disc diameter for particles drawn as Discs
or Sprites
if
the pscale
attribute does not exist. This is specified in world-space
units.
orientDiscToNormal(n_orient)
Set if discs and sprites are oriented to the normal (true
) or not.
The normal will be orthogonal to the disc (they will face in that
direction).
orientDiscToNormal()
→ bool
Queries if discs and sprites are oriented to the normal (true
) or not.
The normal will be orthogonal to the disc (they will face in that
direction).
spriteTextureLimit(max_res)
Set the maximum texture resolution for sprites. This is primarily a performance vs. quality trade-off option. Larger sprites look better but may cause slowdowns for large particle systems.
spriteTextureLimit()
→ tuple of int
Query the maximum texture resolution for sprites. This is primarily a performance vs. quality trade-off option. Larger sprites look better but may cause slowdowns for large particle systems.
pointInstancing(enable)
Enable or disable point instancing globally. Point instancing is done with the Instance Object. When enabled, geometry will be instanced on the points of the instance object. When disabled, the instanced objects' geometry will appear instead.
pointInstancing()
→ bool
Query if point instancing is globally enabled.
pointInstancingPercent(show_instances)
Set the percentage of instances shown in the viewport for point instancing
(0-100%). Culled instances will be replaced by stand-in geometry,
specified by instanceStandInGeometry
.
pointInstancingPercent()
→ double
Query the percentage of instances shown in the viewport for point instancing.
pointInstancingLimit(millions_of_instances)
Set a limit on the number of polygons that instancing geometry can generate, in millions of polygons. Any instancing that produces more polygons than this limit will have a certain percentage of instances culled to remain below the limit. Culled instances are replaced by the stand-in geometry. Setting this limit too high can cause the graphics driver to reset.
pointInstancingLimit()
→ int
Query the current polygon limit for instancing.
instanceStandInGeometry(viewportStandInGeometry)
Set the stand-in geometry for culled instances. This applies to both instances culled by the instancing percent and the instancing polygon limit.
-
hou.viewportStandInGeometry.DisplayOff
: Show nothing for culled instances. -
hou.viewportStandInGeometry.LocationMarker
: Show a location marker at the local space origin of each instanced. -
hou.viewportStandInGeometry.BoundingBox
: Show the culled instances' bounding boxes.
instanceStandInGeometry()
→ hou.viewportStandInGeometry
Query the current stand-in geometry for culled instances.
-
hou.viewportStandInGeometry.DisplayOff
: Show nothing for culled instances. -
hou.viewportStandInGeometry.LocationMarker
: Show a location marker at the local space origin of each instanced. -
hou.viewportStandInGeometry.BoundingBox
: Show the culled instances' bounding boxes.
autoGenerateVertexNormals(vertex)
Enable the generation of vertex normals on geometry without normals, instead of point normals. This is recommended for geometry with hard edges, such as boxes. If disabled, generate point normals instead (somewhat faster).
autoGenerateVertexNormals()
→ bool
Query if vertex normals are produced when geometry is missing normals. If false, point numbers are produced.
vertexNormalCuspAngle(angle)
Set the cusp angle for vertex normal generation. Any shared edge between polygons will be considered a hard edge if the polygon faces differ by more than this angle, otherwise the normals will be smooth over the edge.
vertexNormalCuspAngle()
→ double
Query the cusp angle for vertex normal generation. Any shared edge between polygons will be considered a hard edge if the polygon faces differ by more than this angle, otherwise the normals will be smooth over the edge.
vertexNormalLimit(millions_of_polys)
Set the polygon limit for generating vertex normals, in millions of polygons. Vertex normals are more expensive to compute than point normals, especially for large models. Any model with more polygons than the limit will have point normals generated instead of vertex normals.
To work around this, either raise the limit or use a Normal SOP to generate vertex normals on the geometry.
vertexNormalLimit()
→ int
Query the polygon limit for generating vertex normals, in millions of polygons.
Scene ¶
setSceneAntialias(aalevel)
Sets the viewports full-scene antialiasing level to one of 1, 2, 4, 8, 16, 32, 64, or 128. This represents the number of samples rendered to produce a higher quality image. Higher numbers produce better antialiasing, but this can affect the viewport’s rendering performance. Some graphics hardware only support a subset of these modes (eg. up to 8 or 32).
sceneAntialias()
Returns the number of samples used to antialias the viewport. Possible values are 1 (no antialiasing), 2, 4 (default for most hardware), 8, 16, 32, 64, or 128.
setHdrRendering(hdr)
Enable High Dynamic Range (HDR) rendering, which uses a 16b FP rendering surface. When off, regular 8b rendering is used.
hdrRendering()
→ bool
Queries if High Dynamic Range (HDR) rendering is enabled.
setXrayDrawing(global_enable)
Globally enable or disable X-ray drawing. Object must have their X-ray flag set in order to render as X-ray. X-ray causes the object to be visible when occluded.
xrayDrawing()
→ bool
Query if X-ray drawing is enabled globally.
setXrayQuality(quality)
Enable high-quality X-ray rendering, which draws X-rayed objects as dimmed shaded surfaces when occluded, with up to 8 levels of overlap between X-rayed objects. This looks better but takes longer to render. Regular X-ray rendering displays X-ray objects as wireframe when occluded.
xrayQuality()
→ bool
Queries if high quality X-ray rendering is active.
setXrayStrength(strength)
Sets the strength of the occluded x-ray objects. Lower values make occluded X-ray objects dimmer.
xrayStrength()
→ double
Query the strength of occluded x-ray objects.
setObjectOrigins(globel_enable)
Globally allow object origins to be displayed. Object origins are enabled by setting the Origin flag on objects.
objectOrigins()
→ bool
Query if object origin display is globally enabled.
setOnionSkinning(global_enable)
Globally allow onion skinning to be displayed. Onion skinning is enabled on a per-object basis in the Misc tab of objects. This shows animation as a series of ghosted poses at other frames around the current frame.
onionSkinning()
→ bool
Query if onion skinning is globally enabled.
setOnionSkinFramesBeforeCount(num_frames)
Set the number of onion skins before the current frame. Their spacing depends on the onion skin frame increment.
onionSkinFramesBeforeCount()
→ int
Queries the number of onion skins before the current frame.
setOnionSkinFramesBeforeTint(tint)
Tint all onion skins that appear before the current frame with this color.
onionSkinFramesBeforeTint()
→ tuple of double
Query the tint color of skins that appear before the current frame.
setOnionSkinFramesAfterCount(num_frames)
Set the number of onion skins after the current frame. Their spacing depends on the onion skin frame increment.
onionSkinFramesAfterCount()
→ int
Queries the number of onion skins after the current frame.
setOnionSkinFramesAfterTint(tint)
Tint all onion skins that appear after the current frame with this color.
onionSkinFramesAfterTint()
→ tuple of double
Query the tint color of skins that appear after the current frame.
setOnionSkinFrameIncrement(frame_increment)
Set the frame increment between onion skins. Using 1 will draw every frame around the current frame ($F-2 $F-1 $F $F+1 $F+2
, while 5 would step by 5 ($F-10 $F-5 $F $F+5 $F+10
).
onionSkinFrameIncrement()
→ int
Query the frame increment between onion skins.
setOnionSkinOpacity(opacity)
Set the opacity of the onion skins to make them more or less prominent.
onionSkinOpacity()
→ double
Query the current onion skin opacity.
setSceneGamma(gamma)
Set the gamma correction for the scene. This value should match the calibrated gamma of the display device.
sceneGamma()
→ double
Query the scene gamma correction.
setUseSceneLUT(enable)
Enable Lookup Table (LUT) color correction. A valid LUT file must also be present.
useSceneLUT()
→ bool
Query if Lookup Table color correction is enabled. This will return True
even no LUT file exists.
setSceneLUT(lut_file)
Specify a Lookup Table (LUT) file to use for color correction.
sceneLUT()
→ str
Query the current Lookup Table (LUT) file.
setBackgroundImageGammaLUT(apply_to_bg)
Apply gamma and Lookup Table (LUT) color correction to the background image.
backgroundImageGammaLUT()
→ bool
Query if color correction is applied to the background image.
setDepthOfField(enable)
Enable depth of field effect (also requires the viewport look through a camera with a non-zero fstop).
getDepthOfField()
→ bool
Query if the Depth of Field setting is enabled.
setDepthOfFieldBokeh(viewportDOFBokeh)
Set the bokeh effect.
-
hou.viewportDOFBokeh.NoBokeh
:No additional bokeh effect.
-
hou.viewportDOFBokeh.Circular
:Circular bokeh (can also be oval if the aspect is adjusted).
-
hou.viewportDOFBokeh.Texture
:Use a texture, either from a image file or COP (using the
op:
syntax).
getDepthOfFieldBokeh()
→ hou.EnumValue
Query the current bokeh effect state.
setDepthOfFieldBokehTexture(file_or_node)
Set the path to an image file or COP node to use as the bokeh shape. COP references use the op:
syntax.
getDepthOfFieldBokehTexture()
→ str
Return the file or COP path of the bokeh shape.
setDepthOfFieldBokehBoost(boost)
Boost the brightness of the image to produce more more and brighter bokeh shapes.
getDepthOfFieldBokehBoost()
→ float
Query the current bokeh boost.
setDepthOfFieldBokehAspect(aspect)
Set the aspect ratio (width/height) of the bokeh shape.
getDepthOfFieldBokehAspect()
→ float
Query the current bokeh aspect ratio.
Viewport ¶
showsName(show)
Display the viewport name and menu in the upper right corner.
showName()
→ bool
Query if the viewport name menu is displayed.
showsCameraName(show)
Display the camera name and menu in the upper right corner.
showCameraName()
→ bool
Query if the camera name menu is displayed.
showsStateStatus(show)
Display any status messages of the current tool.
showBadges()
→ bool
Query if viewport status badges are displayed. Badges are icons which present additional state information.
showsBadges(show)
Display viewport status badges as icons beside the camera menu, which presents additional state information.
showStateStatus()
→ bool
Query if the tool status messages are displayed.
useAspectRatio(enable)
Enforce a specific aspect ratio for the viewport, which will add bars if the viewport aspect ratio does not match.
usingAspectRatio()
→ bool
Query if a specific aspect ratio is being enforced.
setAspectRatio(aspect)
Set the viewport aspect ratio (width/height).
viewportType()
→ hou.geometryViewportType enum value
Query the viewport type (UV, 3D, top, left, etc).
aspectRatio()
→ float
Query the viewport aspect ratio display option. Use viewAspectRatio()
to query the current viewport aspect ratio.
viewAspectRatio(masked)
→ float
Query the actual viewport aspect ratio. If masked
is True
, return the aspect ratio of the area inside the camera mask, otherwise return the full viewport aspect ratio.
setViewMaskOpacity(opacity)
Set the opacity of the bars used to mask areas out the viewport outside the aspect ratio.
viewMaskOpacity()
→ float
Query the opacity of the bars used to mask areas out the viewport outside the aspect ratio.
setStereoMode(viewportStereoMode)
Set the stereo display mode when viewing through a stereo camera.
-
hou.viewportStereoMode.Anaglyph
:Anaglyph display of left/right as red/cyan.
-
hou.viewportStereoMode.HorizontalInterlace
:Interlace left and right on alternating scanlines. Only useful for 3D monitors which support this.
-
hou.viewportStereoMode.HorizontalInterlaceReverse
:Interlace left and right on alternating scanlines, swapping which scanlines are used for left and right.
-
hou.viewportStereoMode.QuadBufferGL
:Use OpenGL quad buffer stereo, generally only available on professional cards.
stereoMode()
→ hou.viewportStereoMode
Query the current stereo display mode.
setHomeAutoAdjustsClip(viewportHomeClipMode)
Set which camera clip planes are adjusted when performing a homing operation.
-
hou.viewportHomeClipMode.Neither
:Neither clip plane is adjusted.
-
hou.viewportHomeClipMode.FarOnly
:Only the far clip plane is adjusted.
-
hou.viewportHomeClipMode.NearOnly
:Only the near clip plane is adjusted.
-
hou.viewportHomeClipMode.NearAndFar
:Both clip planes are adjusted.
homeAutoAdjustClip()
→ hou.viewportHomeClipMode
Queries which camera clip planes are adjusted when performing a homing operation.
setClipPlanes(clip)
Set the near and far camera clip planes from a 2-tuple.
clipPlanes()
→ tuple of float
Query the near and far camera clip planes, returning them in a 2-tuple.
setMinHomeSize(min_size)
Set the smallest area that viewport can home to, in world units.
minHomeSize()
→ float
Query the smallest area that viewport can home to, in world units.
setUVDisplayAttribute(uv)
Set the UV viewport to display attribute uv
.
uvDisplayAttribute()
→ str
Return the attribute currently displayed in the UV viewport.
setUVAutoAttribute(detect)
Enable (True) or disable the auto-detection of the displayed UV attribute’s class. UV attributes can be either point or vertex. When enabled, the display will switch to the attribute class of the displayed UV attribute.
uvAutoAttribute()
→ bool
Return True if the UV viewport is auto-detecting the class of the displayed UV attribute.
setUVVertexType(is_vertex_uv)
Set the class of the displayed UV attribute to Point or Vertex. If this does not match the displayed UV attribute’s class then nothing will be displayed.
uvVertexType()
→ bool
Return the class of the UV attribute, Point or Vertex. This returns
the viewport setting, and not the detected class of the current UV
attribute. If uvAutoAttribute
is enabled, the class will be the same as
the currently displayed attribute, but if it is disabled it may be
different.
Effects ¶
setLighting(viewportLighting)
Set the global lighting mode for all viewports.
-
hou.viewportLighting.Off
:No lighting, constant shaded.
-
hou.viewportLighting.Headlight
:Basic lighting from a single directional light defined in the display options.
-
hou.viewportLighting.Normal
:Good quality lighting from up to 10 basic lights (area lights modeled as point lights, limited environment lights).
-
hou.viewportLighting.HighQuality
:High quality lighting from an unlimited number of lights including area, geometry, environment and ambient occlusion.
-
hou.viewportLighting.HighQualityWithShadows
:High quality lighting with shadows.
lighting()
→ hou.viewportLighting
Query the current global lighting mode.
showDiffuse(enable)
Enable diffuse contribution of lighting. When disabled, diffuse will not contribute to the final lit color. This can be used to debug lighting.
showingDiffuse()
→ bool
Query if diffuse lighting is enabled.
showSpecular(enable)
Enable specular highlights. When disabled, specular will not contribute to the final lit color. This will also disable most reflections. This can be used to debug lighting.
showingSpecular()
→ bool
Query if specular lighting is enabled.
showAmbient(enable)
Enable ambient lighting. When disabled, all ambient lights will not contribute to the final lit color. This can be used to debug lighting.
showingAmbient()
→ bool
Query if ambient lighting is enabled.
showEmission(enable)
Enable emissive lighting. Emission lighting comes from materials on geometry, not lights, so modifying the lights in the scene has no effect on it. This can be used to debug lighting.
showingEmission()
→ bool
Query if emission lighting is enabled.
setLightSampling(num_samples)
Set the number of lighting samples to perform when doing high quality lighting for area and environment lights.
lightSampling()
→ int
Query the number of lighting samples.
setMaxLightSamples(samples)
Set the maximum number of light samples to use, across all lights. If there are more lights than samples, at least 1 sample will be used for each light. Setting this to zero removes the limit and each light will use up to the number of samples defined by the Light Sampling display option. Not all lights use multiple samples.
maxLightSamples()
→ int
Return the maximum light samples, or zero if there is no limit.
setLightLimit(limit)
Set the maximum number of lights to contribute to lighting in HQ Lighting. The brightest lights are taken first. Setting this to zero disables the limit.
getLightLimit()
→ int
Return the maximum number of lights to use in HQ Lighting, or zero if there is no light limit.
setHeadlightIntensity(intensity)
Set the intensity of the headlight used in Headlight lighting mode.
headlightIntensity()
→ double
Query the intensity of the headlight.
setHeadlightDirection(dir)
Set the direction of the headlight used in Headlight lighting mode. This is expressed as a direction vector in camera space (the camera looks down -Z).
headlightDirection()
→ tuple of double
Query the vector direction of the headlight.
setHeadlightSpecular(enable)
Enable specular reflections when in Headlight lighting mode. Turning this off results in purely diffuse lighting.
headlightSpecular()
→ bool
Query if specular reflections are generated by the headlight.
setHeadlightOcclusion(enable)
Enables ambient occlusion when in headlight mode. This has no effect if a lighting mode other than headlight is active.
headlightOcclusion()
→ bool
Query if ambient occlusion is active for headlight mode.
showMaterials(enable)
Enable materials on geometry from SHOPs or VOPs. When disabled, these material assignments are ignored and only the attributes on the geometry will affect shading.
showingMaterials()
→ bool
Query if materials are shown.
showGeometryColor(enable)
Enable contribution of the geometry Cd
attribute to the material. When disabled, this is ignored. Cd
multiplies both the material diffuse and ambient colors.
showingGeometryColor()
→ bool
Query if geometry Cd
contributes to the material.
useTransparency(enable)
Enable transparency rendering. When transparency is enabled, another pass handles areas of the geometry that have Alpha
less than one (either due to an Alpha
attribute or material opacity). When disabled, alpha is ignored and rendered as opaque.
usingTransparency()
→ bool
Query if transparency rendering is enabled.
setTransparencyQuality(viewportTransparency)
Set the quality of the transparency pass performed by the viewport.
-
hou.viewportTransparency.Cutout
:Fast test to render the transparent pixel as opaque (>0) or to discard it (0). This can be used for texture cards such as leaves. This doesn’t require an additional pass for transparency.
-
hou.viewportTransparency.Low
:Render transparent pixels in a separate pass. Only the front-most transparent pixel is rendered.
-
hou.viewportTransparency.Medium
:Render transparent pixels in an Order-Independent buffer of 8 samples, which is then sorted and composited together to do multi-layer transparency for up to 8 layers of overlapping transparency.
-
hou.viewportTransparency.High
:Render transparent pixels in an Order-Independent buffer of 16 samples, which is then sorted and composited together to do multi-layer transparency for up to 16 layers of overlapping transparency.
transparencyQuality()
→ hou.viewportTransparency
Query the transparency quality.
useDisplacement(enable)
Enable displacement mapping for materials that have a displacement map. When disabled, the displacement map is ignored. This can have a significant hit for lower-end GPUs.
usingDisplacement()
→ bool
Query if displacement mapping is allowed.
setDisplacementLevel(level)
Set the level of detail for displacement mapping. Displacement mapping adaptively subdivides the geometry to provide finer detail. Higher values result in denser subdivision, while lower values produce lighter meshes. The default is 1.0.
displacementLevel()
→ double
Query the level of detail used for displacement mapping.
setDefaultMaterialDiffuse(tint)
Set the diffuse color of the default material (used when no material assignment is present or Show Materials is disabled).
defaultMaterialDiffuse()
→ hou.Color
Query the default material’s diffuse color.
setDefaultMaterialSpecular(tint)
Set the specular color of the default material (used when no material assignment is present or Show Materials is disabled).
defaultMaterialSpecular()
→ hou.Color
Query the default material’s specular color.
defaultMaterialAmbient(tint)
Set the ambient color of the default material (used when no material assignment is present or Show Materials is disabled).
setDefaultMaterialAmbient()
→ hou.Color
Query the default material’s ambient color.
defaultMaterialEmission(tint)
Set the emission color of the default material (used when no material assignment is present or Show Materials is disabled).
setDefaultMaterialEmission()
→ hou.Color
Query the default material’s emission color.
setAmbientOcclusion(enable)
Enable an ambient occlusion pass in high quality lighting modes. This generates local occlusion shadows.
setDefaultMaterialMatCapFile(filepath)
Set the file path to a Material Capture (MatCap) texture for the MatCap default material. A MatCap texture encodes lighting and shading information, much like a lat-long environment map.
getDefaultMaterialMatCapFile()
→ str
Return the file path of the current MatCap texture.
setDefaultMaterialMatCapIntensity(i)
Set the intensity of the MatCap texture, which can be used to boost or dim the values in a MatCap texture file. This is a direct multiplier on the texture values.
getDefaultMaterialMatCapIntensity()
→ float
Return the MatCap texture intensity multiplier.
setDefaultMaterialType(viewportDefaultMaterial)
Set the default material type used when the geometry has to material assignment.
-
hou.viewportDefaultMaterial.Simple
:An untextured material with variable roughness and color settings for diffuse, specular, emission, and ambient values.
-
hou.viewportDefaultMaterial.MatCap
:A material that uses a MatCap texture (Material Capture) to define the lighting and shading of the surface rather than the lights in the scene.
getDefaultMaterialType()
→ hou.EnumValue
Return the default material type, either Simple
or MatCap
ambientOcclusion()
→ bool
Query if ambient occlusion is enabled. This can return true even if not in a high quality mode as this queries the raw display option value, not a reflection of whether the pass is active. If querying it the pass is active, the lighting mode should also be checked.
setAmbientOcclusionLevel(level)
Set the level of occlusion to generate, from 1-4. Higher levels produce a larger area of effect, while lower values produce fine detail.
ambientOcclusionLevel()
→ int
Return the current occlusion level for ambient occlusion.
setShadowQuality(viewportShadowQuality)
Set the quality of shadow sampling in High Quality Lighting with Shadows lighting mode.
-
hou.viewportShadowQuality.Point
:Area lights are treated as point lights when generating and sampling shadow maps. This is the fastest option.
-
hou.viewportShadowQuality.PointAA
:Do some antialiasing of shadow edges. Treat area lights as point lights when generating and sampling shadow maps.
-
hou.viewportShadowQuality.Area
:Area lights generate multiple shadow maps which are sampled to generate an approximation of a blurred shadow from an area source.
-
hou.viewportShadowQuality.AreaAA
:Area lights generate multiple maps and antialias the shadow lookups.
shadowQuality()
→ hou.viewportShadowQuality
Query the current shadow quality.
setShadowSensitivity(offset)
Set the shadow bias to avoid self-shadowing. A 2-tuple is expected, with the first value setting the variable offset (depending on how parallel the surface is to the view direction) and the second a constant offset. Generally these don’t need to be changed from their default, but larger values reduce self shadowing but increase the risk of missing shadows for very close geometry.
shadowSensitivity()
→ tuple of int
Query the variable and constant shadow offsets, returned in a 2-tuple.
setShadowMapSize(size)
Set the maximum shadow map size, in pixels. Larger maps will produce sharper shadows but increase memory usage. Shadow maps are always square.
shadowMapSize()
→ int
Query the maximum size of the shadow maps used by High Quality Lighting with Shadows lighting mode.
setShadowMapSizeFromLight(enable)
Set whether to use the shadow map size specified by the Shadow Map size parameter in the light object (clamped to the maximum size specified in the display options) or always use the maximum size.
shadowMapSizeFromLight()
→ bool
Query if the shadow map size is defined by the light object.
setShadowMapMem(mem_in_mb)
Set the amount of VRAM to use for all shadowmaps, in MiB.
getShadowMapMem()
→ int
Query the amount of VRAM used for shadowmaps, in MiB.
setShadowMapTime(time_in_sec)
Set the time limit for generating shadowmaps in one redraw (in seconds). If more shadowmaps are left to generate, cause another redraw (and so on until all are complete).
getShadowMapTime()
→ int
Return the time limit for generating shadowmaps within one redraw, in seconds.
useReflections(enable)
Enable reflection mapping. Objects with reflective materials generate reflection maps of the scene around them, which can be quite expensive.
usingReflections()
→ bool
Query if reflection mapping is enabled.
setHdrReflections(hdr_reflect)
Enable High Dynamic Range (HDR) color buffers for the generated scene cubemap, which allows for higher contrast and bright spots in reflections.
hdrReflections()
→ bool
Query if High Dynamic Range (HDR) color buffers are use for the scene cubemap.
setReflectMapSize(size)
Set the size of the cubemap used to store the surrounding scene as an environment map. Larger cubemaps produce sharper reflections but increase memory use.
reflectMapSize()
→ int
Query the size of reflection cubemaps.
setMinReflectAmount(min_reflect)
Set the minimum level of reflection required for a reflection cubemap to be generated for an object. This is based on the largest reflective value from all the materials assigned to the object. The larger this value, the more reflective an object must be to generate a reflection maps. A value of zero is not recommended, as all objects will generate a reflection map.
minReflectAmount()
→ double
Query the minimum reflection level required for a cubemap to be generated for an object.
setFastInteractiveSampling(fast)
When enabled, drops the number of samples used in HQ Lighting to improve performance when interacting with the viewer, which includes tumbling, moving handles, or playing the timeline. This may result in slightly different lighting while interacting with the viewer.
fastInteractiveSampling()
→ bool
Query if Fast Interactive Sampling is enabled on the viewer. This drops the number of samples used in HQ Lighting to improve performance when interacting with the viewer.
Fog ¶
setUniformFog(enable)
Draw an simple atmospheric fog effect in the viewport, based on distance and not affected by lighting.
getUniformFog()
→ bool
Query if uniform fog is active.
setUniformFogColor(color)
Tints the generated fog so it can be made to look more like smog, haze, or dust.
getUniformFogColor()
→ tuple of float
Query the uniform fog color.
setUniformFogDensity(density)
Factor that controls how dense the fog is. Must be a positive value.
getUniformFogDensity()
→ float
Query the uniform fog density.
setUniformFogOpacity(opacity)
An additional factor on the final fog result to make it heavier (>1.0) or lighter (<1.0). Must be zero or greater.
getUniformFogOpacity()
→ float
Query the fog opacity.
setUniformFogDepthRange(range)
For uniform fog, this is the depths where the fog begins and ends, in unit distance from the camera. All depths beyond the end are clamped to the end depth. Any depth before the fog start do not have fog applied. The fog start should be smaller than fog end, and both should be positive.
getUniformFogDepthRange()
→ tuple of float
Query the uniform depth range (near,far).
setUniformFogHeightMode(viewportFogHeightMode)
-
hou.viewportFogHeightMode.Off
:Height has no effect on the fog.
-
hou.viewportFogHeightMode.Above
:Fog only appears above the fog height.
-
hou.viewportFogHeightMode.Below
:Fog only appears below the fog height.
getUniformFogHeightMode()
→ hou.EnumValue
Query the uniform fog height mode.
setUniformFogHeight(h)
Set the height where fog starts, in world units.
getUniformFogHeight()
→ float
Query the uniform fog height.
setUniformFogHeightFalloff(h)
Set the height of the fog transition area between no and uniform full fog, in world units.
getUniformFogHeightFalloff()
→ float
Query the uniform fog falloff.
setUniformFogDepthClip(depth)
Anything beyond the depth clip value not have uniform fog applied. This is useful for preventing fog on skyboxes or other image-based background elements.
getUniformFogDepthClip()
→ float
Query the depth clip value.
setUniformFogUseSun(enable)
Enable or disable simple lighting of uniform fog based on a distant light in the scene.
getUniformFogUseSun()
→ bool
Query if the sun light is enabled for uniform fog.
setUniformFogSunBloom(bloom)
Set the size of the light bloom around the sun (scattering).
getUniformFogSunBloom()
→ float
Query the sun bloom.
setUniformFogSunIntensity(intensity)
For uniform fog with the Sun enabled, this provides an additional intensity adjustment on the distant light’s color.
getUniformFogSunIntensity()
→ float
Query the sun light intensity modifier.
setVolumeFog(enable)
Draw an simple atmospheric fog effect in the viewport, based on distance and not affected by lighting.
getVolumeFog()
→ bool
Query if volume fog is active.
setVolumeFogColor(color)
Tints the generated fog so it can be made to look more like smog, haze, or dust.
getVolumeFogColor()
→ tuple of float
Query the volume fog color.
setVolumeFogDensity(density)
Factor that controls how dense the fog is. Must be a positive value.
getVolumeFogDensity()
→ float
Query the volume fog density.
setVolumeFogOpacity(opacity)
An additional factor on the final fog result to make it heavier (>1.0) or lighter (<1.0). Must be zero or greater.
getVolumeFogOpacity()
→ float
Query the fog opacity.
setVolumeFogDepthRange(range)
For volume fog, this is the depths where the fog begins and ends, in unit distance from the camera. All depths beyond the end are clamped to the end depth. Any depth before the fog start do not have fog applied. The fog start should be smaller than fog end, and both should be positive.
getVolumeFogDepthRange()
→ tuple of float
Query the volume depth range (near,far).
setVolumeFogHeightMode(viewportFogHeightMode)
-
hou.viewportFogHeightMode.Off
:Height has no effect on the fog.
-
hou.viewportFogHeightMode.Above
:Fog only appears above the fog height.
-
hou.viewportFogHeightMode.Below
:Fog only appears below the fog height.
getVolumeFogHeightMode()
→ hou.EnumValue
Query the volume fog height mode.
setVolumeFogHeight(h)
Set the height where fog starts, in world units.
getVolumeFogHeight()
→ float
Query the volume fog height.
setVolumeFogHeightFalloff(h)
Set the height of the fog transition area between no and volume full fog, in world units.
getVolumeFogHeightFalloff()
→ float
Query the volume fog falloff.
setVolumeFogQuality(viewportFogQuality)
The quality determines the size of the volume used for fog lighting.
-
hou.viewportFogQuality.Low
:Small volume for fast drawing.
-
hou.viewportFogQuality.Medium
:Larger volume balanced for quality and speed.
-
hou.viewportFogQuality.High
:Very large volume for quality.
getVolumeFogQuality()
→ hou.EnumValue
Query the volume fog quality.
setVolumeFogLightIntensity(h)
Set the default light intensity modifier for any lights without the gl_fogintensity
property on them. Zero will cause only lights with that property to contribute to the lighting.
getVolumeFogLightIntensity()
→ float
Query the volume light intensity modifier.
setVolumeFogLightScattering(scatter)
getVolumeFogLightScattering()
→ tuple of float
Query the volume light scattering (2-tuple).
setBloom(enable)
Enable or disable the drawing of the bloom post-process effect which creates light bloom around very bright pixels.
getBloom()
→ bool
Query if bloom is enabled.
setBloomScale(scale)
Scale the radius of blooms. The size is initially based on the brightness of the pixel, and this multiplies that value.
getBloomScale()
→ float
Query the bloom scale.
setBloomIntensity(i)
Brighten or darken the blooms. The intensity is initially based on the brightness of the pixel, and this multiplies that value.
getBloomIntensity()
→ float
Query the bloom intensity.
setBloomThreshold(i)
Any pixels in the scene which are brighter than this threshold will have bloom applied to them (white being 1.0). Increasing this value reduces the amount of bloom generated.
getBloomThreshold()
→ float
Query the bloom threshold.
setFogNode(node)
Specify a node path which contains the fog parameters above. Any parameter that is found will override its corresponding display option. See Fog Properties. Passing None
will clear the fog node and use the display option settings instead.
getFogNode()
→ hou.OpNode
Query the fog node override.
Grid ¶
Grid ¶
setDisplayOrthoGrid(enable)
Display the grid in fixed orthographic views (Top, Left, Front, Bottom, Right, Back).
displayOrthoGrid()
→ bool
Query if the grid is displayed in fixed orthographic views.
setOrthoGridOffset(offset)
Set the offset of the grid in fixed orthographic views, as a 3-tuple in world space.
orthoGridOffset()
→ tuple of float
Query the offset of the grid in fixed orthographic views.
setOrthoGridSpacing(offset)
Set the spacing of the grid lines in fixed orthographic views as a 2-tuple.
orthoGridSpacing()
→ tuple of float
Query the spacing of the grid lines in fixed orthographic views as a 2-tuple.
setOrthoGridRuler(offset)
Set the spacing of the grid numbers in fixed orthographic views as a 2-tuple.
orthoGridRuler()
→ tuple of int
Query the spacing of the grid numbers in fixed orthographic views as a 2-tuple.
setOrthoRuler(viewportGridRuler)
Where to display the grid numbers on the fixed orthographic view grid.
-
hou.viewportGridRuler.Hide
:Do not display.
-
hou.viewportGridRuler.MainAxis
:Display along the main axes at grid line intersections.
-
hou.viewportGridRuler.GridPoints
:Display on grid line intersections.
orthoRuler()
→ hou.viewportGridRuler
Query where the grid numbers are displayed on the fixed orthographic view grid.
-
hou.viewportGridRuler.Hide
:Not displayed.
-
hou.viewportGridRuler.MainAxis
:Displayed along the main axes at grid line intersections.
-
hou.viewportGridRuler.GridPoints
:Displayed on grid line intersections.
setUVReferenceGrid(enable)
Display the grid in UV viewports.
uvReferenceGrid()
→ bool
Query if the grid in UV viewports is displayed.
setUVDisplayGridOverImage(enable)
Display dots in a grid pattern over the background image.
uvReferenceGridOverImage()
→ bool
Query if the dot grid is displayed.
setUVGridPixelSpacing(offset)
Set the spacing of the UV dot grid displayed over the background image.
uvGridPixelSpacing()
→ tuple of float
Query the spacing of the UV dot grid displayed over background images.
setUVGridPixelOffset(offset)
Set the spacing, in pixels, of the dot grid.
uvGridPixelOffset()
→ tuple of float
Query the spacing of the dot grid in pixels.
setClampUVGridToBackground(enable)
Restrict the grid to the background image’s area.
clampUVGridToBackground()
→ bool
Query if the grid is restricted to the background image’s area.
setDisplayUVTileBoundaries(enable)
Display the boundaries of UV tiles at integral U and V numbers.
displayUVTileBoundaries()
→ bool
Query if the boundaries of UV tiles are displayed.
Background ¶
setColorScheme(viewportColorScheme)
Set the color scheme for the viewport.
-
hou.viewportColorScheme.Dark
:Black background.
-
hou.viewportColorScheme.Grey
:Light grey background.
-
hou.viewportColorScheme.Light
:Light blue gradient background.
-
hou.viewportColorScheme.DarkGrey
:Dark grey background.
colorScheme()
→ hou.viewportColorScheme
Query the current viewport color scheme.
-
hou.viewportColorScheme.Dark
:Black background.
-
hou.viewportColorScheme.Grey
:Light grey background.
-
hou.viewportColorScheme.Light
:Light blue gradient background.
-
hou.viewportColorScheme.DarkGrey
:Dark grey background.
colorFromName(colorName)
→ hou.Color
Query a specific color from the current viewport color scheme. The valid
color names can be found in the color scheme configuration files in
3DSceneColors
.
alphaFromName(colorName)
→ double
Query a specific alpha from the current viewport color scheme. The valid
alpha names can be found in the color scheme configuration files in
3DSceneColors
.
backgroundImage(viewportBGImageView, layer)
→ hou.GeometryViewportBGImage
Access the background image parameters for the target view type. layer
is currently not used but reserved for future use.
-
hou.viewportBGImageView.Perspective
:The 3D view not attached to a camera (“No cam”).
-
hou.viewportBGImageView.Camera
:The 3D view looking through a camera.
-
hou.viewportBGImageView.Top
:The orthographic top view.
-
hou.viewportBGImageView.Front
:The orthographic front view.
-
hou.viewportBGImageView.Right
:The orthographic right view.
-
hou.viewportBGImageView.Bottom
:The orthographic bottom view.
-
hou.viewportBGImageView.Back
:The orthographic back view.
-
hou.viewportBGImageView.Left
:The orthographic left view.
-
hou.viewportBGImageView.UV
:The UV texture viewport.
setDisplayBackgroundImage(enable)
Globally enable background image display.
displayBackgroundImage()
→ bool
Query if background image display is globally enabled.
setDisplayEnvironmentBackgroundImage(enable)
Allow environment lights to show their environment maps as 360 degree background images.
displayEnvironmentBackgroundImage()
→ bool
Query if environment lights' environment maps are shown as 360 degree background images.
setFilterBackgroundImage(enable)
Enable texture filtering of background images. When off, individual pixels are shown as blocks at high zoom levels rather than blended.
filterBackgroundImage()
→ bool
Query if texture filtering of background images is enabled.
setApplyZoomToBackgroundImage(enable)
Allow the camera zoom to affect the background image.
applyZoomToBackgroundImage()
→ bool
Query if the camera zoom is affecting the background image.
setBackgroundImageQuality(quality)
Set the quality of the background image, from 0-100. Values less than 100 will scale down the resolution of the background image.
backgroundImageQuality()
→ int
Query the quality of background image display, from 0-100.
Texture ¶
setDisplayTextures(enable)
Enable material texturing.
displayTextures()
→ bool
Query if material texturing is enabled.
setDisplayTextureLayers(enable)
Enable multiple texture layers when texturing. This causes an extra render of the geometry per texture layer.
displayTextureLayers()
→ bool
Query if multiple texture layers are rendered.
setDisplayProjectedTextures(enable)
Enable projected textures from spotlights with a valid texture.
displayProjectedTextures()
→ bool
Query if projected textures from spotlights are rendered.
setTextureMipmapping(enable)
Enable mipmapping for textures, improving display quality but increasing texture memory use by 50%.
textureMipmapping()
→ bool
Query if texture mipmapping is enabled.
setTextureAnisotropicFilter(num_samples)
Set the number of samples for anisotropic texture filtering. More samples produces better results for textures on polygons on an angle to the view direction.
textureAnisotropicFilter()
→ int
Query the number of samples used for anisotropic texture filtering.
setTextureCacheSize(size_in_mb)
Set the size of the texture cache, in megabytes. The viewport will use as much texture memory as it needs, even if it exceeds this level, but textures will be culled once they are no longer used to remain within this limit.
textureCacheSize()
→ int
Query the texture cache size, in megabytes.
setTextureMaxMemory(size_in_mb)
Set the maximum size of a single texture, in megabytes. This prevents extremely large textures from starving the graphics hardware’s bandwidth (mostly by 3D textures).
textureMaxMemory()
→ int
Return the maximum size of a single texture, in megabytes.
setTextureAutoReduce(enable)
Enable auto-reduction of viewport textures. This attempts to scale down textures to fit within the texture cache.
textureAutoReduce()
→ bool
Query if auto-reduction of viewport textures is enabled.
setTextureAutoReduce2D(enable)
Allow auto-reduction of regular 2D textures.
textureAutoReduce2D()
→ bool
Query if auto-reduction of regular 2D textures is allowed.
setTextureAutoReduce3D(enable)
Allow auto-reduction of 3D textures (volumes).
textureAutoReduce3D()
→ bool
Query if auto-reduction of 3D textures is allowed.
setTextureResLimit2D(enable)
Limit the resolution of all 2D textures, so that the width and height cannot exceed the limit. Even if disabled, OpenGL has its own texture limits which will be applied (usually 8k or 16k).
textureResLimit2D()
→ bool
Query if 2D textures have their resolutions limited.
setTextureMaxRes2D(res)
Set the maximum resolution of a 2D texture. res
is an integer 2-tuple of (width, height). OpenGL has its own limit, and setting this limit higher than that will have no effect. The image will be scaled to fit the limit if it exceeds it.
textureMaxRes2D()
→ 2-tuple of int
Return the maximum resolution for a 2D texture.
setTextureBitDepthLimit2D(viewportTextureDepth)
Set the maximum bit depth for a 2D texture. Textures with a bit depth higher than this will be downconverted to this bit depth. Textures with an equal or lower bit depth will not be converted.
-
hou.viewportTextureDepth.Compressed8
:Compressed, 8b SDR texture format. Smallest memory use.
-
hou.viewportTextureDepth.Fixed8
:8b SDR texture format. Good balance between memory and quality.
-
hou.viewportTextureDepth.HDR16
:16b HDR texture format. Excellent dynamic range, but more memory use and slower texturing performance.
-
hou.viewportTextureDepth.FullHDR
:32b HDR texture format. Extreme dynamic range, but very high memory use and slow texturing performance. Use with care.
textureBitDepthLimit2D()
→ hou.viewportTextureDepth
Query the maximum bit depth for a 2D texture.
-
hou.viewportTextureDepth.Compressed8
:Compressed, 8b SDR texture format. Smallest memory use.
-
hou.viewportTextureDepth.Fixed8
:8b SDR texture format. Good balance between memory and quality.
-
hou.viewportTextureDepth.HDR16
:16b HDR texture format. Excellent dynamic range, but more memory use and slower texturing performance.
-
hou.viewportTextureDepth.FullHDR
:32b HDR texture format. Extreme dynamic range, but very high memory use and slow texturing performance. Use with care.
setTextureScale2D(scale)
Uniformly downscale all 2D textures by this fraction (default 1.0, no scale).
textureScale2D()
→ float
Query the uniform scale applied to 2D textures.
setTextureResLimit3D(enable)
Limit the resolution of all 3D textures (volumes), so that the width, height, and depth cannot exceed the limit. Even if disabled, OpenGL has its own texture limits which will be applied (usually 2k or 8k).
textureResLimit3D()
→ bool
Query if 3D textures have their resolutions limited.
setTexture2DSettingsFor3D(enable)
When enabled, use all the 2D texture settings for 3D textures.
texture2DSettingsFor3D()
→ bool
Query if the 2D settings are used for 3D textures.
setTextureMaxRes3D(res)
Set the maximum resolution of a 3D texture (volume). res
is an integer 3-tuple of (width, height, depth). OpenGL has its own limit, and setting this limit higher than that will have no effect. The image will be scaled to fit the limit if it exceeds it.
textureMaxRes3D()
→ 3-tuple of int
Query the maximum resolution of a 3D texture (volume).
setTextureBitDepthLimit3D(viewportTextureDepth)
Set the maximum bit depth for a 3D texture (volume). Textures with a bit depth higher than this will be downconverted to this bit depth. Textures with an equal or lower bit depth will not be converted. 3D textures do not support compressed formats.
-
hou.viewportTextureDepth.Fixed8
:8b SDR texture format. Good balance between memory and quality.
-
hou.viewportTextureDepth.HDR16
:16b HDR texture format. Excellent dynamic range, but more memory use and slower texturing performance.
-
hou.viewportTextureDepth.FullHDR
:32b HDR texture format. Extreme dynamic range, but very high memory use and slow texturing performance. Use with care.
textureBitDepthLimit3D()
→ hou.viewportTextureDepth
Query the maximum bit depth of a 3D texture (volume).
-
hou.viewportTextureDepth.Fixed8
:8b SDR texture format. Good balance between memory and quality.
-
hou.viewportTextureDepth.HDR16
:16b HDR texture format. Excellent dynamic range, but more memory use and slower texturing performance.
-
hou.viewportTextureDepth.FullHDR
:32b HDR texture format. Extreme dynamic range, but very high memory use and slow texturing performance. Use with extreme care.
setTextureScale3D(scale)
Uniformly downscale all 3D textures (volumes) by this fraction (default 1.0, no scale).
textureScale3D()
→ float
Query the uniform scale applied to 3D textures (volumes).
Optimize ¶
useMaterialStylesheets(enable)
Enable evaluation of material stylesheets for viewport material assignment.
usingMaterialStylesheets()
→ bool
Query if material stylesheet assignment is active.
usePerPrimStylesheets(enable)
Enable evaluation of per-primitive stylesheets.
usingPerPrimStylesheets()
→ bool
Query if per-primitive stylesheets are evaluated.
usePackedStylesheets(enable)
Enable assignment of material stylesheets to geometry within packed primitives.
usingPackedStylesheets()
→ bool
Query if material stylesheet assignments are applied to geometry within packed primitives.
useMaterialOverrides(enable)
Allow material overrides from material stylesheets and the material_override
attribute.
usingMaterialOverrides()
→ bool
Query if material overrides are being applied to material assignments.
setSingleObjectMaterialLimit(num_materials)
Set the maximum number of material variations for a single object.
singleObjectMaterialLimit()
→ int
Query the maximum number of material variations for a single object.
setMaterialUpdate(viewportMaterialUpdate)
Set the material assignment update frequency.
-
hou.viewportMaterialUpdate.Always
:Update assignments whenever needed.
-
hou.viewportMaterialUpdate.OffForPlayback
:Update assignments whenever needed, but not during playback.
-
hou.viewportMaterialUpdate.Manual
:Only update assignments when Update Materials is pressed.
materialUpdate()
→ hou.viewportMaterialUpdate
Query the material assignment update frequency.
-
hou.viewportMaterialUpdate.Always
:Update assignments whenever needed.
-
hou.viewportMaterialUpdate.OffForPlayback
:Update assignments whenever needed, but not during playback.
-
hou.viewportMaterialUpdate.Manual
:Only update assignments when Update Materials is pressed.
setInteractiveMaterialUpdate(enable)
Update materials when they are changed to reflect their new state. When disabled, Update Materials must be pressed manually for changes to be reflected in the viewport.
interactiveMaterialUpdate()
→ bool
Query if materials are updated when they change.
updateMaterials()
Manually update all materials and material assignments.
setVisibleObjects(uv)
Set the mask for all visible objects in the viewport. Wildcards can be used.
visibleObjects()
→ str
Query the current visible object mask.
setRemoveBackfaces(enable)
Cull polygons facing backwards instead of rasterizing them.
removeBackfaces()
→ bool
Query if backwards facing polygons are culled.
setHullsOnly(enable)
Draw only hulls for complex curves and surfaces like NURBS and Beziers.
hullsOnly()
→ bool
Query if only hulls are drawn for complex curves and surfaces.
setDistanceBasedPackedCulling(enable)
Enable culling of packed primitives when the polygon count of the visible objects in the frustum exceeds a certain amount, starting with the most distant.
distanceBasedPackedCulling()
→ bool
Query if packed primitive culling is enabled.
setScenePolygonLimit(millions_of_polygons)
Set the maximum number of polygons in the view frustum, in millions, before the viewport begins culling packed primitives.
scenePolygonLimit()
→ int
Query the maximum allowed number of polygons in the view frustum, in millions of polygons.
setPackedBoundingBoxMode(viewportPackedBoxMode)
Define how culled packed primitives are displayed.
-
hou.viewportPackedBoxMode.NoDisplay
:Culled packed primitives are not displayed at all.
-
hou.viewportPackedBoxMode.Wireframe
:A wireframe bounding box replaces the packed primitive.
-
hou.viewportPackedBoxMode.Shaded
:A shaded bounding box replaces the packed primitive.
-
hou.viewportPackedBoxMode.CurrentShadingMode
:A bounding box replaces the packed primitive, drawn wireframe in wireframe shading modes and shaded otherwise.
packedBoundingBoxMode()
→ hou.viewportPackedBoxMode
Query how culled packed primitives are displayed.
-
hou.viewportPackedBoxMode.NoDisplay
:Culled packed primitives are not displayed at all.
-
hou.viewportPackedBoxMode.Wireframe
:A wireframe bounding box replaces the packed primitive.
-
hou.viewportPackedBoxMode.Shaded
:A shaded bounding box replaces the packed primitive.
-
hou.viewportPackedBoxMode.CurrentShadingMode
:A bounding box replaces the packed primitive, drawn wireframe in wireframe shading modes and shaded otherwise.
setOptimizeGeometry(enable)
Optimize packed geometry when loaded to make it faster for display (triangulating and splitting meshes).
optimizeGeometry()
→ bool
Query if packed geometry is optimized.
setAgentLODReduction(enable)
Enable the use of multiple levels of detail for crowd agents, each LOD level being half the polygon count of the previous level.
agentLODReduction()
→ bool
Query if multiple levels of detail (LOD) are generated for crowd agents.
setAgentLODReductionBias(reduce_bias)
Set the LOD balance from Performance (0) to Quality (10), which biases which LOD levels are chosen.
agentLODReductionBias()
→ int
Query the LOD bias for agents.
setAgentShapePointCutoff(num_points)
Set the minimum number of points in an agent LOD level. If an LOD level would go below this number, it is not generated.
agentShapePointCutoff()
→ int
Query the minimum number of points in an agent LOD level.
setMaxLODLevels(num_levels)
Set the maximum number of levels to generate for an agent. This will be the original model plus this number.
maxLODLevels()
→ int
Query the maximum number of levels generated for an agent.
setBaseLODLevel(base_level)
Set the level to use as the full level of detail model, generally 0 (the original agent model). For very heavy poly count agents, this can be set to higher values to reduce the polygon count of the highest level of detail model.
baseLODLevel()
→ int
Query the base level of detail.
setSingleBoneDeform(viewportAgentBoneDeform)
Set the complexity of bone-based deformation on agents.
-
hou.viewportAgentBoneDeform.Always
:Only use 1 bone to deform on all agent instances (the one with the most influence).
-
hou.viewportAgentBoneDeform.ReducedLOD
:Use up to 4 bones to deform the highest LOD agent instances, and 1 bone on all the reduced LOD instances.
-
hou.viewportAgentBoneDeform.Disabled
:Use up to 4 bones to deform on all agent instances.
singleBoneDeform()
→ hou.viewportAgentBoneDeform
Query the complexity of bone-based deformation on agents.
-
hou.viewportAgentBoneDeform.Always
:Only use 1 bone to deform on all agent instances (the one with the most influence).
-
hou.viewportAgentBoneDeform.ReducedLOD
:Use up to 4 bones to deform the highest LOD agent instances, and 1 bone on all the reduced LOD instances.
-
hou.viewportAgentBoneDeform.Disabled
:Use up to 4 bones to deform on all agent instances.
setAgentWireframe(viewportAgentWireframe)
Set the appearance of agents in wireframe mode.
-
hou.viewportAgentWireframe.Bone
:Agents are rendered as bone-based skeletons.
-
hou.viewportAgentWireframe.Line
:Agents are rendered as line-based skeletons.
agentWireframe()
→ hou.viewportAgentWireframe
Query the appearance of agents in wireframe mode.
-
hou.viewportAgentWireframe.Bone
:Agents are rendered as bone-based skeletons.
-
hou.viewportAgentWireframe.Line
:Agents are rendered as line-based skeletons.
setAgentBlendShapes(enable)
Enable the display of blend shapes for crowd agents.
agentBlendShapes()
→ bool
Query if blend shape display is enabled for crowd agents.