Open Source Platform
for interconnected virtual worlds

Content Scripting Python RTT Camera

From RexWiki

The following example function shows how to enable render-to-texture camera when prim is touched:

def EventTouch(self,vAvatar):
    vAvatar.rexRttCameraWorld(command, cameraName, textureID, pos, lookAt, textureWidth, textureHeight)
Rendering world to texture

Where:

  • command: 0 to remove existing rtt camera (by name), 1 to add new rtt camera.
  • cameraName: Unique identifier for the camera.
  • textureID: UUID of the texture that gets rendered to.
  • pos: Position of the camera in the world.
  • lookAt: Point in the world the camera will look at
  • textureWidth: Width of the texture.
  • textureHeight: Height of the texture.
Example Python script

Texture

The RTT camera will render a view of the world into the texture specified by textureID. The specified texture width and height should preferably be power of two (64, 128, 256...) for performance reasons. Texture sizes higher than 512 may impose hard performance penalties. Texture sizes may be limited client side for performance reasons.

Camera

The position of the camera can be explicitly specified, or it may be the position of the primitive with 'pos = self.llGetPos()'. You can set the camera name to primitive UUID to have the camera move around with the primitive. In this case you should set the look at vector to primitive position + Vector3(0, -1, 0).