sun: halve disc size and add brightness gain
This commit is contained in:
1 parent
b5c0030192
commit
8f31ff8839
2 files changed
+9
-3
No files matched your search
@@ -649,7 +649,10 @@ window.CONFIG = {
|
|||||||
// drawn larger so it reads as a disc; the surface brightness and the
|
// drawn larger so it reads as a disc; the surface brightness and the
|
||||||
// scene lighting are NOT scaled with it.
|
// scene lighting are NOT scaled with it.
|
||||||
sun: {
|
sun: {
|
||||||
angularRadius: 0.0558 // 12x the physical 0.00465 rad
|
angularRadius: 0.0279, // 6x the physical 0.00465 rad
|
||||||
|
brightness: 1.8 // sun disc/halo gain
|
||||||
|
// angularRadius: 0.0558, brightness: 1.0
|
||||||
|
// angularRadius: 0.0140, brightness: 2.4
|
||||||
},
|
},
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|||||||
Vendored
+5
-2
@@ -142,6 +142,7 @@ var FRAG_SRC = [
|
|||||||
'uniform float uMoonFlipU;',
|
'uniform float uMoonFlipU;',
|
||||||
'uniform float uMoonFlipV;',
|
'uniform float uMoonFlipV;',
|
||||||
'uniform float uSunR;', // sun disc angular radius (radians)
|
'uniform float uSunR;', // sun disc angular radius (radians)
|
||||||
|
'uniform float uSunDiscGain;', // sun disc/halo brightness gain
|
||||||
// 3D hash and value noise
|
// 3D hash and value noise
|
||||||
'float hash3(vec3 p) {',
|
'float hash3(vec3 p) {',
|
||||||
'p = fract(p * vec3(0.1031, 0.1030, 0.0973));',
|
'p = fract(p * vec3(0.1031, 0.1030, 0.0973));',
|
||||||
@@ -588,7 +589,7 @@ var FRAG_SRC = [
|
|||||||
'float discS = 1.0 - smoothstep(uSunR * 0.86, uSunR, angS);',
|
'float discS = 1.0 - smoothstep(uSunR * 0.86, uSunR, angS);',
|
||||||
'float haloS = exp(-angN * 55.0) * 0.30 + exp(-angN * 14.0) * 0.12;',
|
'float haloS = exp(-angN * 55.0) * 0.30 + exp(-angN * 14.0) * 0.12;',
|
||||||
'vec3 sunCol = mix(uLight, vec3(1.0, 0.92, 0.72), 0.35);',
|
'vec3 sunCol = mix(uLight, vec3(1.0, 0.92, 0.72), 0.35);',
|
||||||
'col += sunCol * (discS * 1.15 + haloS) * (1.0 - nightFactor * 0.85);',
|
'col += sunCol * (discS * 1.15 + haloS) * uSunDiscGain * (1.0 - nightFactor * 0.85);',
|
||||||
'}',
|
'}',
|
||||||
// ---- Moon disc: lunar map + geometric terminator --------------
|
// ---- Moon disc: lunar map + geometric terminator --------------
|
||||||
// The near side always faces the observer, so the map is sampled
|
// The near side always faces the observer, so the map is sampled
|
||||||
@@ -1312,7 +1313,7 @@ function init(canvas) {
|
|||||||
uMoonTex: uMoonTex, uMoonTexOn: uMoonTexOn, uMoonR: uMoonR,
|
uMoonTex: uMoonTex, uMoonTexOn: uMoonTexOn, uMoonR: uMoonR,
|
||||||
uMoonFrac: uMoonFrac, uMoonEarth: uMoonEarth, uMoonLimb: uMoonLimb,
|
uMoonFrac: uMoonFrac, uMoonEarth: uMoonEarth, uMoonLimb: uMoonLimb,
|
||||||
uMoonBright: uMoonBright, uMoonHalo: uMoonHalo,
|
uMoonBright: uMoonBright, uMoonHalo: uMoonHalo,
|
||||||
uMoonFlipU: uMoonFlipU, uMoonFlipV: uMoonFlipV, uSunR: uSunR,
|
uMoonFlipU: uMoonFlipU, uMoonFlipV: uMoonFlipV, uSunR: uSunR, uSunDiscGain: gl.getUniformLocation(prog, 'uSunDiscGain'),
|
||||||
// terrain program
|
// terrain program
|
||||||
terrain: {
|
terrain: {
|
||||||
prog: terrainProg,
|
prog: terrainProg,
|
||||||
@@ -2786,6 +2787,7 @@ var MOON_FLIP_V = MOON_CFG.flipV ? 1 : 0;
|
|||||||
var SUN_CFG = (window.CONFIG && window.CONFIG.sun) || {};
|
var SUN_CFG = (window.CONFIG && window.CONFIG.sun) || {};
|
||||||
var SUN_ANG_R = (typeof SUN_CFG.angularRadius === 'number')
|
var SUN_ANG_R = (typeof SUN_CFG.angularRadius === 'number')
|
||||||
? Math.max(0.00465, SUN_CFG.angularRadius) : 0.00465 * 12;
|
? Math.max(0.00465, SUN_CFG.angularRadius) : 0.00465 * 12;
|
||||||
|
var SUN_DISC_GAIN = (typeof SUN_CFG.brightness === 'number') ? Math.max(0, SUN_CFG.brightness) : 1.0;
|
||||||
var MOON_TEX_SRC = (typeof window.__moonTex === 'string' && window.__moonTex)
|
var MOON_TEX_SRC = (typeof window.__moonTex === 'string' && window.__moonTex)
|
||||||
? window.__moonTex
|
? window.__moonTex
|
||||||
: ((typeof MOON_CFG.texture === 'string' && MOON_CFG.texture) ? MOON_CFG.texture : 'vendor/moon.jpg');
|
: ((typeof MOON_CFG.texture === 'string' && MOON_CFG.texture) ? MOON_CFG.texture : 'vendor/moon.jpg');
|
||||||
@@ -7174,6 +7176,7 @@ window.clouds3dRender = function(target) {
|
|||||||
gl.uniform1f(s.uMoonFlipU, MOON_FLIP_U);
|
gl.uniform1f(s.uMoonFlipU, MOON_FLIP_U);
|
||||||
gl.uniform1f(s.uMoonFlipV, MOON_FLIP_V);
|
gl.uniform1f(s.uMoonFlipV, MOON_FLIP_V);
|
||||||
gl.uniform1f(s.uSunR, SUN_ANG_R);
|
gl.uniform1f(s.uSunR, SUN_ANG_R);
|
||||||
|
gl.uniform1f(s.uSunDiscGain, SUN_DISC_GAIN);
|
||||||
// texture path: RA alpha must land at world angle alpha + PI/2 - LST,
|
// texture path: RA alpha must land at world angle alpha + PI/2 - LST,
|
||||||
// which with u = fract(0.5 + (H + uStarLon)/2PI) means uStarLon = LST - 3PI/2
|
// which with u = fract(0.5 + (H + uStarLon)/2PI) means uStarLon = LST - 3PI/2
|
||||||
var _sidTex = starSidereal();
|
var _sidTex = starSidereal();
|
||||||
|
|||||||
Reference in new issue
Block a user