926 wip. semitransparent atmosphere

This commit is contained in:
Zemledelec 2025-09-19 10:56:18 +04:00
parent c02247c954
commit 2a4add16da
4 changed files with 8 additions and 4 deletions

View File

@ -55,12 +55,12 @@ export class SimpleSkyBackground extends Control {
public override onactivate() {
super.onactivate();
this.planet!.events.on("draw", this._drawBackground, this);
//this.planet!.events.on("draw", this._drawBackground, this);
}
public override ondeactivate() {
super.ondeactivate();
this.planet!.events.off("draw", this._drawBackground);
//this.planet!.events.off("draw", this._drawBackground);
}
protected _drawBackground() {

View File

@ -253,6 +253,8 @@ export class Atmosphere extends Control {
gl.disable(gl.DEPTH_TEST);
r.enableBlendOneSrcAlpha();
sh.activate();
gl.bindBuffer(gl.ARRAY_BUFFER, r.screenFramePositionBuffer!);
gl.vertexAttribPointer(p.attributes.corners, 2, gl.FLOAT, false, 0, 0);
@ -277,6 +279,8 @@ export class Atmosphere extends Control {
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
gl.enable(gl.DEPTH_TEST);
r.enableBlendDefault();
}
}

View File

@ -180,7 +180,7 @@ void mainImage(out vec4 fragColor)
light += sunLum * SUN_INTENSITY * transmittanceFromCameraToSpace;
}
fragColor = vec4(pow(light * 8.0, vec3(1.0 / 2.2)), clamp(opacity, 0.0, 1.0));
fragColor = vec4(pow(light * 8.0, vec3(1.0 / 2.2)), length(light) * clamp(opacity, 0.0, 1.0));
}
void main(void)

View File

@ -1571,7 +1571,7 @@ export class Planet extends RenderNode {
}
// Here is set blending for transparent overlays
renderer.enableBlendDefault();
//renderer.enableBlendDefault();
gl.enable(gl.POLYGON_OFFSET_FILL);
for (let j = 1, len = sl.length; j < len; j++) {