Panda3D
Loading...
Searching...
No Matches
Functions | Variables
direct.showbase.MirrorDemo Namespace Reference

Functions

 setupMirror (name, width, height, rootCamera=None, bufferSize=256, clearColor=None)
 
 showFrustum (np)
 

Variables

 base = ShowBase()
 
 myMirror = setupMirror("mirror", 10, 10, bufferSize=1024, clearColor=(0, 0, 1, 1))
 
 panda = loader.loadModel("panda")
 

Detailed Description

This file demonstrates one way to create a mirror effect in Panda.
Call :func:`setupMirror()` to create a mirror in the world that reflects
everything in front of it.

The approach taken here is to create an offscreen buffer with its own
camera that renders its view into a texture, which is then applied to
the mirror geometry.  The mirror's camera is repositioned each frame
with a task to keep it always on the opposite side of the mirror from
the main camera.

This demonstrates the basic interface for offscreen
render-to-a-texture in Panda.  Similar approaches can be used for
related effects, such as a remote spy camera presenting its view onto
a closed-circuit television screen.

In this example the mirror itself is always perfectly flat--it's just
a single polygon, after all--but small distortions of the mirror
surface are possible, like a funhouse mirror.  However, the reflection
itself is always basically planar; for more accurate convex
reflections, you will need to use a sphere map or a cube map.

Function Documentation

◆ setupMirror()

setupMirror ( name,
width,
height,
rootCamera = None,
bufferSize = 256,
clearColor = None )

◆ showFrustum()

showFrustum ( np)

Variable Documentation

◆ base

base = ShowBase()

◆ myMirror

myMirror = setupMirror("mirror", 10, 10, bufferSize=1024, clearColor=(0, 0, 1, 1))

◆ panda

panda = loader.loadModel("panda")