sky-lights fix, graphics.skybox-resolution

This commit is contained in:
MihailRis 2023-12-03 23:36:54 +03:00
parent 2f9244c17c
commit 4de2d77150
5 changed files with 10 additions and 4 deletions

View File

@ -35,7 +35,7 @@ void main(){
a_color = vec4(pow(light, vec3(u_gamma)),1.0f);
a_texCoord = v_texCoord;
vec3 skyLightColor = texture(u_cubemap, vec3(-0.4f, -0.4f, -0.4f)).rgb;
vec3 skyLightColor = texture(u_cubemap, vec3(-0.4f, 0.05f, -0.4f)).rgb;
skyLightColor.g *= 0.9;
skyLightColor.b *= 0.8;
skyLightColor = min(vec3(1.0), skyLightColor*SKY_LIGHT_MUL);

View File

@ -244,10 +244,12 @@ uniform vec3 u_lightDir;
uniform int u_quality;
uniform float u_mie;
#include <commons>
void main() {
vec3 camera_position = vec3(0.0f, PLANET_RADIUS+1.0f, 0.0f);
vec3 camera_vector = normalize(u_xaxis * v_coord.x +
u_yaxis * -v_coord.y -
vec3 camera_vector = normalize(u_xaxis * v_coord.x*1.005 +
u_yaxis * -v_coord.y*1.005 -
u_zaxis);
// hide darkness at horizon
camera_vector.y = max(0.01, camera_vector.y)*(1.0-u_mie*0.08) + 0.08*u_mie;

View File

@ -31,6 +31,7 @@ toml::Wrapper create_wrapper(EngineSettings& settings) {
graphics.add("fog-curve", &settings.graphics.fogCurve);
graphics.add("backlight", &settings.graphics.backlight);
graphics.add("frustum-culling", &settings.graphics.frustumCulling);
graphics.add("skybox-resolution", &settings.graphics.skyboxResolution);
toml::Section& debug = wrapper.add("debug");
debug.add("generator-test-mode", &settings.debug.generatorTestMode);

View File

@ -45,13 +45,15 @@ WorldRenderer::WorldRenderer(Engine* engine,
lineBatch(new LineBatch()),
renderer( new ChunksRenderer(level, cache, engine->getSettings())) {
auto& settings = engine->getSettings();
level->events->listen(EVT_CHUNK_HIDDEN,
[this](lvl_event_type type, Chunk* chunk) {
renderer->unload(chunk);
}
);
auto assets = engine->getAssets();
skybox = new Skybox(64, assets->getShader("skybox_gen"));
skybox = new Skybox(settings.graphics.skyboxResolution,
assets->getShader("skybox_gen"));
}
WorldRenderer::~WorldRenderer() {

View File

@ -45,6 +45,7 @@ struct GraphicsSettings {
bool backlight = true;
/* Enable chunks frustum culling */
bool frustumCulling = true;
int skyboxResolution = 64 + 32;
};
struct DebugSettings {