Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <base href="https://docs.lume.io/guide/custom-rendering/example.html" />
<script src="../../importmap.js"></script>

<lume-scene webgl id="scene">
	<lume-camera-rig horizontal-angle="-30" vertical-angle="30"></lume-camera-rig>
	<lume-box size="100 100 100" mount-point="0.5 0.5 0.5"></lume-box>
	<lume-point-light position="200 400 500" color="deeppink" intensity="0.6"></lume-point-light>
	<lume-point-light position="-200 -400 -500" color="royalblue" intensity="0.6"></lume-point-light>
</lume-scene>

<style>
	html,
	body {
		margin: 0;
		height: 100%;
	}
	lume-element3d {
		padding: 5px;
	}
</style>

<script type="module">
	import {Motor} from 'lume'
	import {EffectComposer} from 'three/addons/postprocessing/EffectComposer.js';
	import {RenderPass} from 'three/addons/postprocessing/RenderPass.js';
	import {ShaderPass} from 'three/addons/postprocessing/ShaderPass.js';
	import {UnrealBloomPass} from 'three/addons/postprocessing/UnrealBloomPass.js';
	import {OutputPass} from 'three/addons/postprocessing/OutputPass.js';
	import {GlitchPass} from 'three/addons/postprocessing/GlitchPass.js';

	const composer = new EffectComposer(scene.glRenderer)

	function setDimensions() {
		composer.setPixelRatio(window.devicePixelRatio)
		const resize = () => composer.setSize(scene.clientWidth, scene.clientHeight)
		const observer = new ResizeObserver(resize)
		observer.observe(scene)
	}

	// If you do things manually with Three.js, you need to make sure to set the
	// proper rendering dimensions. Comment this out and it will still work, but
	// the demo may be lower resolution and look pixelated.
	setDimensions()

	const renderPass = new RenderPass(scene.three, scene.threeCamera)
	composer.addPass(renderPass)

	const glitchPass = new GlitchPass()
	composer.addPass(glitchPass)

	const outputPass = new OutputPass()
	composer.addPass(outputPass)

	scene.drawScene = () => {
		// Make sure to always use the currently-active camera.
		renderPass.camera = scene.threeCamera

		composer.render()
	}

	// If you need the scene to be continuously rendering for a certain
	// post-processing effects (for example, the GlitchPass is animated over
	// time), then make a loop that calls scene.needsUpdate() repeatedly. Here
	// we do that with Lume's Motor:
	Motor.addRenderTask(() => scene.needsUpdate())

	// Alternatively, make an rAF loop:
	// requestAnimationFrame(function loop() {
	// 	scene.needsUpdate()
	// 	requestAnimationFrame(loop)
	// })
</script>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console