@gov.nasa.jpl.honeycomb/mars-sky
v0.0.6
Published
Sky shader for mars in three.js.
Downloads
2
Readme
mars-sky
Shader and three.js object for rendering a physically based version of the Martian sky. Based on the paper 2013 paper Physically Based Rendering of the Martian Atmosphere.
Originally implemented by Ryan Kinnett.
Use
import { MarsSky } from '@gov.nasa.jpl.honeycomb/mars-sky';
const directionalLight, ambientLight, scene;
const sky = new MarsSky();
scene.add(sky);
sky.scale.setScalar(450000);
marsSky.sunPosition.set( 1, 1, 1 ).normalize();
marsSky.getColor( ambientLight.color );
ambientLight.intensity = marsSky.getAmbientIntensity();
directionalLight.intensity = marsSky.getDirectionalIntensity();API
MarsSky
Initializes itself with a sphere and sky shader material.
extends Mesh
sunPosition
sunPosition : nullgetColor
getColor( target : Color ) : ColorSets the target color object to the color of the ambient light given the current sun angle.
getDirectionalIntensity
getDirectionalIntensity( ) : NumberReturns the intensity of the directional light given the current sun position.
getAmbientIntensity
getAmbientIntensity( ) : NumberReturns the intensity of the ambient light given the current sun position.
MarsSkyShader
uniforms
uniforms : Object{
luminance = 1.0 : Number,
turbidity = 0.8 : Number,
rayleigh = 0.005 : Number,
mieCoefficient = 0.005 : Number,
mieDirectionalG = 0.8 : Number,
// The position of the sun in world space. This is relative to the
// skys coordinate frame.
sunPosition = 0, 0, 0 : Vector3
}