Protected_Protected Optional_Protected_ReadonlylightingThe lighting presets, for a menu. Change a url, or add a preset, before its first use.
ReadonlylightsHolds the preset lights, in the scene root (not in the model root), so they are not selectable or exported. Visible only during a render with a lighting preset on.
ReadonlymaterialThe material views, for a menu
Static Optional ReadonlyOldStatic ReadonlyPluginTrue when a material view or a lighting preset is on
False: the scene renders as it is, the overrides stay set and come back when it is true again
Current lighting preset key (applied), null when off
False (default): the 'lights' presets also turn off the environment map, so the image shows only the preset lights. True: the scene environment stays on with the preset lights. A change applies at once to the 'lights' preset that is on (no effect on the 'env' presets, which replace the environment).
Key of the lighting preset whose environment map is loading, null when none
Current material view, null when off
UV set shown by the 'uv' view: 0 for uv, 1-3 for uv1-uv3. Default 0.
Protected_Protected_Optionalprefix: stringTurn off the material view and the lighting preset
Disposes the override materials
Optionalmeta: SerializationMetaTypeTurns the overrides off, and disposes the line materials and the loaded environment maps that the scene does not use
OptionalsetLight the scene with a preset from lightingPresets: a 'lights' preset replaces the scene lights (and the environment, unless lightsKeepEnvironment) with its lights, an 'env' preset replaces them with its environment map (loaded on the first use, then cached). Null restores the scene lighting. Turns off a material view.
While an environment map loads, loading is the key and the view does not change. When it does not load, the view stays as it was. Resolves when the preset is applied, when the map does not load, or when another call replaced it.
Draw every mesh with one debug material, or null for the scene materials. Turns off a lighting preset.
Optionalmeta: SerializationMetaType
ViewOverridesPlugin shows the scene with one debug material for every mesh, or with other lights or another environment map, without changing the scene. For an editor's view menu: check the normals, the UVs or the material assignment, or see a model in other lighting.
Material views (setMaterial): unlit (base color and maps, no lights), linear depth (fitted to the models), view-space normals, world-space normals, material ID (one color per material) and UV (U red, V green, for the UV set uvChannel; magenta where a mesh has no such set).
Fat lines (LineSegments2, Line2, MeshLine with a LineMaterial) keep their line shader, so their width, dashes and world units do not change: the unlit view draws them with their own material (a fat line is unlit), the depth view with the depth ramp of the meshes (the same range), the material ID view in the colour of their material, the normal views in a neutral grey (the colour of a zero normal: a line has no surface normal) and the UV view in magenta (a line has no UV set). A line material with
allowOverridefalse keeps its own material in every view, as other materials.Widgets (helpers, gizmos and their icons: an object with
isWidgetorassetType'widget', and its children) keep their own materials in every view: the views show the scene, and a widget drawn with a debug material shows as a rectangle (an icon quad) or in the colour of the view (its lines).Lighting presets (setLighting, lightingPresets): 'lights-' replace the scene lights (and by default the environment, see lightsKeepEnvironment) with preset lights; 'env-' replace them with another environment map, loaded once and cached. The 'env' presets are 1k HDR files on samples.threepipe.org: studios, interiors and outdoor scenes from Poly Haven (CC0), the gem environment of webgi (
gem_2) and one spot light in the dark (spot1Luxof the three.js examples).A material view and a lighting preset are exclusive: choosing one turns the other off (the debug materials are unlit, so lights do not change them).
Everything is applied only while the viewer renders (
preRendertopostRender): the override material of the main render pass, the hidden scene lights, the override environment, the line materials of the fat lines (forcedOverrideMaterialof the line object, orallowOverridefalse on the line material in the unlit view) and the materials of the widgets (allowOverridefalse). Outside a render the scene and the render pass are as the user left them, so an export, the scene UI and the light toggles see the real scene. Turning an override off, disabling the plugin or removing it shows the scene as before. The state is not saved with the viewer config.Example