Frontory

Open code, practice, and notes →

Download source with English comments · for reading

Three.js · 22 Render Targets and Minimap

Series contents · Technology map

Stage: Resource Lifetimes, Accessibility, and Measurement · Editable example · Storage ID: threejs-step-22

Goals and learning outcomes

Prerequisites

Prerequisite concepts: Frustum Culling, Level of Detail. Prepare the result files and observation notes from unit 21.

Key concepts and explanations

Offscreen Output

WebGLRenderTarget renders to a texture instead of the screen. You can use another camera’s result on a surface within the screen.

Restoring State

setRenderTarget(null) returns to the default screen. Missing this step makes subsequent renders keep writing to the target.

Practice setup

First read the execution-scope guidance on the example screen. The following environment is for extending the assignment in a separate project. Implement it yourself in an HTML and ES module project served by a separate local HTTP development server. Pin three and addons to the same installed version and record it.

The linked example is a starting point. It does not implement every task below. Complete work beyond its supported scope in a separate project.

Practice tasks

  1. Prepare day-22.js and index.html in the external exercise project. Render the scene to a render target with a camera looking down from above.
  2. Connect the target texture to a minimap plane, and isolate that plane in the main scene so it is not seen again by the minimap camera.
  3. Save the output under the 256×256 input condition, then run again under the 512×512 condition. Expected: Minimap sharpness and the number of processed pixels both increase. Compare with the actual screen and logs, and record the actual result and reasons for any differences in day-22-notes.md.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
Target size256×256512×512Minimap sharpness and the number of processed pixels both increase.

Predictions in this table are not measured results. Change one condition at a time and record why the actual result differs.

Completion criteria

Self-check

  1. How do you avoid feedback from reading the texture being written?
  2. When should a render target be disposed of?

Official references

Linked example and execution scope

Example source · Runtime environments and limits

This is an editable browser experiment. Measurements vary with the current device and browser.

Source code and records are not overwritten automatically. Resetting an existing example also preserves your notes.

Next learning

Previous: Offscreen Objects and Level of Detail · Next: Resource Ownership Ledger

Open code, practice, and notes →