mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Remove bumpmapping and make requested changes
This commit is contained in:
parent
795f669c97
commit
364ca57819
13 changed files with 57 additions and 129 deletions
|
@ -662,11 +662,6 @@ enable_volumetric_depth_attenuation (Volumetric Depth Attenuation) bool false
|
|||
# Makes the color of light fog more saturated.
|
||||
enable_tinted_fog (Tinted fog) bool false
|
||||
|
||||
# Apply bump maps to nodes based on their textures. It is recommended to use a tilted sun orbit to go with this (Sky Body Orbit Tilt).
|
||||
#
|
||||
# Requires: enable_dynamic_shadows
|
||||
enable_bumpmaps (Bump maps) bool false
|
||||
|
||||
# Simulate translucency when looking at foliage in the sunlight.
|
||||
# It is recommended to use this with the leaves style set to fancy.
|
||||
#
|
||||
|
@ -678,11 +673,6 @@ enable_translucent_foliage (Translucent foliage) bool false
|
|||
# Requires: enable_dynamic_shadows
|
||||
enable_node_specular (Node specular) bool false
|
||||
|
||||
# When enabled, liquid reflections are simulated.
|
||||
#
|
||||
# Requires: enable_waving_water, enable_dynamic_shadows
|
||||
enable_water_reflections (Liquid reflections) bool false
|
||||
|
||||
[*Audio]
|
||||
|
||||
# Volume of all sounds.
|
||||
|
|
|
@ -63,7 +63,7 @@ varying highp vec3 eyeVec;
|
|||
varying float nightRatio;
|
||||
|
||||
#ifdef ENABLE_DYNAMIC_SHADOWS
|
||||
#if ((defined(MATERIAL_WAVING_LIQUID) && defined(ENABLE_WATER_REFLECTIONS)) || defined(ENABLE_BUMPMAPS))
|
||||
#if (defined(MATERIAL_WAVING_LIQUID) && defined(ENABLE_WATER_REFLECTIONS))
|
||||
vec4 perm(vec4 x)
|
||||
{
|
||||
return mod(((x * 34.0) + 1.0) * x, 289.0);
|
||||
|
@ -420,23 +420,6 @@ float getShadow(sampler2D shadowsampler, vec2 smTexCoord, float realDistance)
|
|||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(ENABLE_BUMPMAPS) && !defined(MATERIAL_LIQUID))
|
||||
//This is mostly a placeholder and probably should use proper textures eventually...
|
||||
vec3 getBumpMap(vec2 uv) {
|
||||
vec2 dr = vec2(0.25) * texelSize0;
|
||||
// Sample the texture to then compute the gradient
|
||||
float fx0y0 = texture2D(baseTexture, uv).r;
|
||||
float fx1y0 = texture2D(baseTexture, uv + vec2(dr.x, 0.0)).r;
|
||||
float fx0y1 = texture2D(baseTexture, uv + vec2(0.0, dr.y)).r;
|
||||
// We get the gradient using partial derivatives
|
||||
vec2 gradient = 0.1 * vec2((fx1y0 - fx0y0) / dr.x, (fx0y1 - fx0y0) / dr.y) + 0.05 * gnoise(vec3(2.0 * uv / texelSize0, 0.0)).xy;
|
||||
vec3 tangent_space = normalize(vec3(gradient, 1.0));
|
||||
// Convert tangent space information to real space
|
||||
return -vTangent * tangent_space.x + vBinormal * tangent_space.y + vNormal * tangent_space.z;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
|
@ -466,17 +449,7 @@ void main(void)
|
|||
|
||||
vec3 viewVec = normalize(worldPosition + cameraOffset - cameraPosition);
|
||||
|
||||
#if ((defined(ENABLE_DYNAMIC_SHADOWS) && defined(ENABLE_BUMPMAPS)) && !defined(MATERIAL_LIQUID))
|
||||
vec3 bump_normal = getBumpMap(uv);
|
||||
// When applied to all blocks, these bump maps produce irritating Moiré effects.
|
||||
// So we hide the bump maps when close up.
|
||||
float moire_factor = abs(dot(vNormal, viewVec));
|
||||
moire_factor = mtsmoothstep(0.4 * moire_factor, 0.2 * moire_factor, length(eyeVec) * fov / windowSize.x);
|
||||
fNormal = normalize(mix(fNormal, bump_normal, moire_factor));
|
||||
float adj_cosLight = max(1e-5, dot(fNormal, -v_LightDirection));
|
||||
#else
|
||||
float adj_cosLight = cosLight;
|
||||
#endif
|
||||
|
||||
if (f_shadow_strength > 0.0) {
|
||||
float shadow_int = 0.0;
|
||||
|
@ -556,7 +529,7 @@ void main(void)
|
|||
wavePos.x /= WATER_WAVE_LENGTH * 3.0;
|
||||
wavePos.z /= WATER_WAVE_LENGTH * 2.0;
|
||||
|
||||
// This is an analogous method to the bumpmap, except we get the gradient information directly from gnoise.
|
||||
// We get the gradient information of the waves using gnoise.
|
||||
vec2 gradient = wave_noise(wavePos, off);
|
||||
fNormal = normalize(normalize(fNormal) + vec3(gradient.x, 0., gradient.y) * WATER_WAVE_HEIGHT * abs(fNormal.y) * 0.25);
|
||||
reflect_ray = -normalize(v_LightDirection - fNormal * dot(v_LightDirection, fNormal) * 2.0);
|
||||
|
@ -572,12 +545,15 @@ void main(void)
|
|||
// Sky reflection
|
||||
col.rgb += reflection_color * pow(fresnel_factor, 2.0) * 0.5 * brightness_factor;
|
||||
|
||||
vec3 water_reflect_color =
|
||||
6.0 * sunTint * dayLight * fresnel_factor * f_adj_shadow_strength * max(1.0 - shadow_uncorrected, 0.0) *
|
||||
mtsmoothstep(0.85, 0.9, pow(clamp(dot(reflect_ray, viewVec), 0.0, 1.0), 32.0));
|
||||
|
||||
// We clip the reflection color if it gets too bright
|
||||
vec3 water_reflect_color = 6.0 * sunTint * dayLight * fresnel_factor * mtsmoothstep(0.85, 0.9, pow(clamp(dot(reflect_ray, viewVec), 0.0, 1.0), 32.0)) * max(1.0 - shadow_uncorrected, 0.0);
|
||||
water_reflect_color /= max(0.4 * length(water_reflect_color), 1.0);
|
||||
water_reflect_color *= min(2.0 / max(water_reflect_color.r, max(water_reflect_color.g, water_reflect_color.b)), 1.0);
|
||||
|
||||
// Sun reflection
|
||||
col.rgb += water_reflect_color * f_adj_shadow_strength * brightness_factor;
|
||||
col.rgb += water_reflect_color * brightness_factor;
|
||||
#endif
|
||||
|
||||
#if (defined(ENABLE_NODE_SPECULAR) && !defined(MATERIAL_WAVING_LIQUID))
|
||||
|
|
|
@ -150,9 +150,7 @@ void main(void)
|
|||
#endif
|
||||
{
|
||||
|
||||
#ifdef ENABLE_VIGNETTE
|
||||
color.rgb *= (vignette_bright - vignette_dark) * (1.0 - pow(length(uv - vec2(0.5)) * 1.4, vignette_power)) + vignette_dark;
|
||||
#endif
|
||||
|
||||
#if ENABLE_TONE_MAPPING
|
||||
color = applyToneMapping(color);
|
||||
|
|
|
@ -8828,9 +8828,9 @@ child will follow movement and rotation of that bone.
|
|||
* Setting all components to zero effectively disables tinted sunlight.
|
||||
* `vignette`: is a table that controls the vignette post-processing effect.
|
||||
* This has no effect on clients who have the "Vignette" effects disabled.
|
||||
* `dark`: brightness of the vignette's darkest part (default: `0.3`)
|
||||
* `bright`: brightness of the vignette's brightest part (default: `1.1`)
|
||||
* `power`: the higher this is set, the more the vignette "retreats" to the edges of the screen (default: `1.1`)
|
||||
* `dark`: brightness of the vignette's darkest part (default: `1.0`)
|
||||
* `bright`: brightness of the vignette's brightest part (default: `1.0`)
|
||||
* `power`: the higher this is set, the more the vignette "retreats" to the edges of the screen (default: `1.0`)
|
||||
* `cdl`: is a table that controls the ASL CDL color grading effect.
|
||||
* This has no effect on clients who have the "Color grading" effect disabled.
|
||||
* The output color follows the equation: `out = pow(in*slope+offset, power)`
|
||||
|
|
|
@ -215,10 +215,10 @@ void Clouds::updateMesh()
|
|||
for (video::S3DVertex& vertex : v) {
|
||||
vertex.Normal.set(0, 1, 0);
|
||||
}
|
||||
v[0].Pos.set(-rx, ry, -rz);
|
||||
v[0].Pos.set(-rx, ry,-rz);
|
||||
v[1].Pos.set(-rx, ry, rz);
|
||||
v[2].Pos.set(rx, ry, rz);
|
||||
v[3].Pos.set(rx, ry, -rz);
|
||||
v[2].Pos.set( rx, ry, rz);
|
||||
v[3].Pos.set( rx, ry,-rz);
|
||||
break;
|
||||
case 1: // back
|
||||
if (INAREA(xi, zi - 1, m_cloud_radius_i)) {
|
||||
|
@ -239,10 +239,10 @@ void Clouds::updateMesh()
|
|||
vertex.Normal.set(0, 0, -1);
|
||||
}
|
||||
}
|
||||
v[0].Pos.set(-rx, ry, -rz);
|
||||
v[1].Pos.set(rx, ry, -rz);
|
||||
v[2].Pos.set(rx, 0, -rz);
|
||||
v[3].Pos.set(-rx, 0, -rz);
|
||||
v[0].Pos.set(-rx, ry,-rz);
|
||||
v[1].Pos.set( rx, ry,-rz);
|
||||
v[2].Pos.set( rx, 0,-rz);
|
||||
v[3].Pos.set(-rx, 0,-rz);
|
||||
break;
|
||||
case 2: //right
|
||||
if (INAREA(xi + 1, zi, m_cloud_radius_i)) {
|
||||
|
@ -263,10 +263,10 @@ void Clouds::updateMesh()
|
|||
vertex.Normal.set(1, 0, 0);
|
||||
}
|
||||
}
|
||||
v[0].Pos.set(rx, ry, -rz);
|
||||
v[0].Pos.set(rx, ry,-rz);
|
||||
v[1].Pos.set(rx, ry, rz);
|
||||
v[2].Pos.set(rx, 0, rz);
|
||||
v[3].Pos.set(rx, 0, -rz);
|
||||
v[3].Pos.set(rx, 0,-rz);
|
||||
break;
|
||||
case 3: // front
|
||||
if (INAREA(xi, zi + 1, m_cloud_radius_i)) {
|
||||
|
@ -287,10 +287,10 @@ void Clouds::updateMesh()
|
|||
vertex.Normal.set(0, 0, -1);
|
||||
}
|
||||
}
|
||||
v[0].Pos.set(rx, ry, rz);
|
||||
v[0].Pos.set( rx, ry, rz);
|
||||
v[1].Pos.set(-rx, ry, rz);
|
||||
v[2].Pos.set(-rx, 0, rz);
|
||||
v[3].Pos.set(rx, 0, rz);
|
||||
v[3].Pos.set( rx, 0, rz);
|
||||
break;
|
||||
case 4: // left
|
||||
if (INAREA(xi - 1, zi, m_cloud_radius_i)) {
|
||||
|
@ -312,8 +312,8 @@ void Clouds::updateMesh()
|
|||
}
|
||||
}
|
||||
v[0].Pos.set(-rx, ry, rz);
|
||||
v[1].Pos.set(-rx, ry, -rz);
|
||||
v[2].Pos.set(-rx, 0, -rz);
|
||||
v[1].Pos.set(-rx, ry,-rz);
|
||||
v[2].Pos.set(-rx, 0,-rz);
|
||||
v[3].Pos.set(-rx, 0, rz);
|
||||
break;
|
||||
case 5: // bottom
|
||||
|
@ -321,10 +321,10 @@ void Clouds::updateMesh()
|
|||
vertex.Color = c_bottom;
|
||||
vertex.Normal.set(0, -1, 0);
|
||||
}
|
||||
v[0].Pos.set(rx, 0, rz);
|
||||
v[0].Pos.set( rx, 0, rz);
|
||||
v[1].Pos.set(-rx, 0, rz);
|
||||
v[2].Pos.set(-rx, 0, -rz);
|
||||
v[3].Pos.set(rx, 0, -rz);
|
||||
v[2].Pos.set(-rx, 0,-rz);
|
||||
v[3].Pos.set( rx, 0,-rz);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
MeshMakeData
|
||||
*/
|
||||
|
||||
MeshMakeData::MeshMakeData(const NodeDefManager *ndef, u16 side_length, bool use_tangent_vertices):
|
||||
MeshMakeData::MeshMakeData(const NodeDefManager *ndef, u16 side_length):
|
||||
side_length(side_length),
|
||||
nodedef(ndef),
|
||||
m_use_tangent_vertices(use_tangent_vertices)
|
||||
nodedef(ndef)
|
||||
{}
|
||||
|
||||
void MeshMakeData::fillBlockDataBegin(const v3s16 &blockpos)
|
||||
|
@ -602,8 +601,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
|||
for (auto &m : m_mesh)
|
||||
m = make_irr<scene::SMesh>();
|
||||
|
||||
m_use_tangent_vertices = data->m_use_tangent_vertices;
|
||||
|
||||
auto mesh_grid = client->getMeshGrid();
|
||||
v3s16 bp = data->m_blockpos;
|
||||
// Only generate minimap mapblocks at even coordinates.
|
||||
|
@ -712,22 +709,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
|||
p.layer.applyMaterialOptionsWithShaders(material);
|
||||
}
|
||||
|
||||
if (m_use_tangent_vertices && !p.layer.isTransparent()) {
|
||||
scene::SMeshBufferTangents* buf = new scene::SMeshBufferTangents();
|
||||
buf->Material = material;
|
||||
std::vector<video::S3DVertexTangents> vertices;
|
||||
vertices.reserve(p.vertices.size());
|
||||
for (video::S3DVertex &v : p.vertices)
|
||||
vertices.emplace_back(v.Pos, v.Normal, v.Color, v.TCoords);
|
||||
buf->append(&vertices[0], vertices.size(),
|
||||
&p.indices[0], p.indices.size());
|
||||
buf->recalculateBoundingBox();
|
||||
scene::IMeshManipulator* meshmanip =
|
||||
client->getSceneManager()->getMeshManipulator();
|
||||
meshmanip->recalculateTangents(buf);
|
||||
mesh->addMeshBuffer(buf);
|
||||
buf->drop();
|
||||
} else {
|
||||
scene::SMeshBuffer *buf = new scene::SMeshBuffer();
|
||||
buf->Material = material;
|
||||
if (p.layer.isTransparent()) {
|
||||
|
@ -750,7 +731,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
|||
mesh->addMeshBuffer(buf);
|
||||
buf->drop();
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh) {
|
||||
// Use VBO for mesh (this just would set this for every buffer)
|
||||
|
|
|
@ -36,9 +36,7 @@ struct MeshMakeData
|
|||
|
||||
const NodeDefManager *nodedef;
|
||||
|
||||
bool m_use_tangent_vertices;
|
||||
|
||||
MeshMakeData(const NodeDefManager *ndef, u16 side_length, bool use_tangent_vertices = false);
|
||||
MeshMakeData(const NodeDefManager *ndef, u16 side_length);
|
||||
|
||||
/*
|
||||
Copy block data manually (to allow optimizations by the caller)
|
||||
|
@ -236,8 +234,6 @@ private:
|
|||
f32 m_bounding_radius;
|
||||
v3f m_bounding_sphere_center;
|
||||
|
||||
bool m_use_tangent_vertices;
|
||||
|
||||
// Must animate() be called before rendering?
|
||||
bool m_has_animation;
|
||||
int m_animation_force_timer;
|
||||
|
|
|
@ -39,8 +39,6 @@ QueuedMeshUpdate::~QueuedMeshUpdate()
|
|||
MeshUpdateQueue::MeshUpdateQueue(Client *client):
|
||||
m_client(client)
|
||||
{
|
||||
m_cache_use_tangent_vertices = g_settings->getBool("enable_bumpmaps");
|
||||
|
||||
m_cache_smooth_lighting = g_settings->getBool("smooth_lighting");
|
||||
}
|
||||
|
||||
|
@ -179,8 +177,7 @@ void MeshUpdateQueue::fillDataFromMapBlocks(QueuedMeshUpdate *q)
|
|||
{
|
||||
auto mesh_grid = m_client->getMeshGrid();
|
||||
|
||||
MeshMakeData *data = new MeshMakeData(m_client->ndef(), MAP_BLOCKSIZE * mesh_grid.cell_size, m_cache_use_tangent_vertices);
|
||||
|
||||
MeshMakeData *data = new MeshMakeData(m_client->ndef(), MAP_BLOCKSIZE * mesh_grid.cell_size);
|
||||
q->data = data;
|
||||
|
||||
data->fillBlockDataBegin(q->p);
|
||||
|
|
|
@ -70,7 +70,6 @@ private:
|
|||
std::mutex m_mutex;
|
||||
|
||||
// TODO: Add callback to update these when g_settings changes
|
||||
bool m_cache_use_tangent_vertices;
|
||||
bool m_cache_smooth_lighting;
|
||||
|
||||
void fillDataFromMapBlocks(QueuedMeshUpdate *q);
|
||||
|
|
|
@ -680,9 +680,6 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||
if (g_settings->getBool("shadow_poisson_filter"))
|
||||
shaders_header << "#define POISSON_FILTER 1\n";
|
||||
|
||||
if (g_settings->getBool("enable_bumpmaps"))
|
||||
shaders_header << "#define ENABLE_BUMPMAPS 1\n";
|
||||
|
||||
if (g_settings->getBool("enable_water_reflections"))
|
||||
shaders_header << "#define ENABLE_WATER_REFLECTIONS 1\n";
|
||||
|
||||
|
@ -716,9 +713,6 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||
if (g_settings->getBool("enable_color_grading"))
|
||||
shaders_header << "#define ENABLE_COLOR_GRADING 1\n";
|
||||
|
||||
if (g_settings->getBool("enable_vignette"))
|
||||
shaders_header << "#define ENABLE_VIGNETTE 1\n";
|
||||
|
||||
if (g_settings->get("antialiasing") == "ssaa") {
|
||||
shaders_header << "#define ENABLE_SSAA 1\n";
|
||||
u16 ssaa_scale = MYMAX(2, g_settings->getU16("fsaa"));
|
||||
|
|
|
@ -326,7 +326,6 @@ void set_default_settings()
|
|||
settings->setDefault("exposure_compensation", "0.0");
|
||||
settings->setDefault("enable_auto_exposure", "false");
|
||||
settings->setDefault("enable_color_grading", "false");
|
||||
settings->setDefault("enable_vignette", "false");
|
||||
settings->setDefault("secondstage_gamma", "1.6");
|
||||
settings->setDefault("debanding", "true");
|
||||
settings->setDefault("antialiasing", "none");
|
||||
|
@ -334,7 +333,6 @@ void set_default_settings()
|
|||
settings->setDefault("enable_bloom_debug", "false");
|
||||
settings->setDefault("enable_volumetric_lighting", "false");
|
||||
settings->setDefault("enable_volumetric_depth_attenuation", "false");
|
||||
settings->setDefault("enable_bumpmaps", "false");
|
||||
settings->setDefault("enable_water_reflections", "false");
|
||||
settings->setDefault("enable_translucent_foliage", "false");
|
||||
settings->setDefault("enable_node_specular", "false");
|
||||
|
|
|
@ -40,11 +40,11 @@ struct AutoExposure
|
|||
*/
|
||||
struct Vignette {
|
||||
/// @brief The darkest part of the vignette will be darkened/brightened by this factor.
|
||||
float dark = 0.3f;
|
||||
float dark = 1.0f;
|
||||
/// @brief The brightest part of the vignette will be darkened/brightened by this factor.
|
||||
float bright = 1.1f;
|
||||
float bright = 1.0f;
|
||||
/// @brief Describes the blending between dark and bright. Higher values mean darkening is more intense at the screen edges.
|
||||
float power = 1.1f;
|
||||
float power = 1.0f;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
// These calls explicitly use the templated version of operator<<,
|
||||
// so that they won't use the overloads created by ADD_NULL_CHECK.
|
||||
if (arg == nullptr)
|
||||
return this->operator<< <const char*> ("(null)");
|
||||
return this->operator<< <const char*> ((const char*)"(null)");
|
||||
else
|
||||
return this->operator<< <T>(std::forward<T>(arg));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue