渐变clearColor in threejs

mhe*_*ers 6 javascript three.js

我可以在threejs中获得一个可靠的clearColor,但有没有办法实现渐变clearColor.或者用一些类似的方法在我的天空中实现更深的深度,也许还有灯光?

这是我的相关代码:

renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor( 0x3dc800 );

var light = new THREE.HemisphereLight( 0xffffff, 0xeeeeee, 0.75 );
  light.position.set( 0.5, 1, 0.75 );
  scene.add( light );

scene.fog = new THREE.Fog( 0x4ff904, 0, 750 );
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Tim*_*reu 3

I ran across this codepen:

http://codepen.io/billimarie/pen/mJLeBY

I take no credit, but it answers the question perfectly.

The relevant chunks are:

renderer = new THREE.CanvasRenderer( { alpha: true }); // gradient
Run Code Online (Sandbox Code Playgroud)

withe the css:

body {
            background-color: #1A8FCF;
            margin: 0px;
            overflow: hidden;
            background-image: -webkit-gradient(#1A8FCF,#D1236A,#1A8FCF);
            /* Safari 5.1, iOS 5.0-6.1, Chrome 10-25, Android 4.0-4.3 */
            background-image: -webkit-linear-gradient(#1A8FCF,#D1236A,#1A8FCF);
            /* Firefox 3.6 - 15 */
            background-image: -moz-linear-gradient(#1A8FCF,#D1236A,#1A8FCF);
            /* Opera 11.1 - 12 */
            background-image: -o-linear-gradient(#1A8FCF,#D1236A,#1A8FCF);
            /* Opera 15+, Chrome 25+, IE 10+, Firefox 16+, Safari 6.1+, iOS 7+, Android 4.4+ */
            background-image: linear-gradient(#1A8FCF,#D1236A,#1A8FCF);
        }
Run Code Online (Sandbox Code Playgroud)

**Note, my own colors...