mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Draw distinction between bilinear filtering and nearest neighbour
This commit is contained in:
parent
b2051767ff
commit
2a9e43b847
8
assets/voxygen/shaders/antialias/bilinear.glsl
Normal file
8
assets/voxygen/shaders/antialias/bilinear.glsl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
vec4 aa_apply(
|
||||||
|
texture2D tex, sampler smplr,
|
||||||
|
texture2D depth_tex, sampler depth_smplr,
|
||||||
|
vec2 fragCoord,
|
||||||
|
vec2 resolution
|
||||||
|
) {
|
||||||
|
return texture(sampler2D(tex, smplr), fragCoord / resolution);
|
||||||
|
}
|
@ -4,5 +4,5 @@ vec4 aa_apply(
|
|||||||
vec2 fragCoord,
|
vec2 fragCoord,
|
||||||
vec2 resolution
|
vec2 resolution
|
||||||
) {
|
) {
|
||||||
return texture(sampler2D(tex, smplr), fragCoord / resolution);
|
return texelFetch(sampler2D(tex, smplr), ivec2(fragCoord * textureSize(sampler2D(tex, smplr), 0).xy / resolution), 0);
|
||||||
}
|
}
|
||||||
|
@ -879,6 +879,7 @@ impl<'a> Widget for Video<'a> {
|
|||||||
// interaction with greedy meshing, and may eventually be removed.
|
// interaction with greedy meshing, and may eventually be removed.
|
||||||
let mode_list = [
|
let mode_list = [
|
||||||
AaMode::None,
|
AaMode::None,
|
||||||
|
AaMode::Bilinear,
|
||||||
AaMode::Fxaa,
|
AaMode::Fxaa,
|
||||||
/* AaMode::MsaaX4,
|
/* AaMode::MsaaX4,
|
||||||
AaMode::MsaaX8,
|
AaMode::MsaaX8,
|
||||||
@ -887,7 +888,8 @@ impl<'a> Widget for Video<'a> {
|
|||||||
AaMode::Hqx,
|
AaMode::Hqx,
|
||||||
];
|
];
|
||||||
let mode_label_list = [
|
let mode_label_list = [
|
||||||
"No anti-aliasing",
|
"None",
|
||||||
|
"Bilinear",
|
||||||
"FXAA",
|
"FXAA",
|
||||||
/* "MSAA x4",
|
/* "MSAA x4",
|
||||||
"MSAA x8",
|
"MSAA x8",
|
||||||
|
@ -108,6 +108,15 @@ pub enum AaMode {
|
|||||||
/// Screen-space technique that uses a combination of FXAA and
|
/// Screen-space technique that uses a combination of FXAA and
|
||||||
/// nearest-neighbour sample retargeting to produce crisp, clean upscaling.
|
/// nearest-neighbour sample retargeting to produce crisp, clean upscaling.
|
||||||
FxUpscale,
|
FxUpscale,
|
||||||
|
/// Bilinear filtering.
|
||||||
|
///
|
||||||
|
/// Linear interpolation of the color buffer in each axis to determine the
|
||||||
|
/// pixel.
|
||||||
|
Bilinear,
|
||||||
|
/// Nearest-neighbour filtering.
|
||||||
|
///
|
||||||
|
/// The colour of each pixel is determined by the colour of the spatially
|
||||||
|
/// closest texel in the color buffer.
|
||||||
#[serde(other)]
|
#[serde(other)]
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
@ -115,7 +124,7 @@ pub enum AaMode {
|
|||||||
impl AaMode {
|
impl AaMode {
|
||||||
pub fn samples(&self) -> u32 {
|
pub fn samples(&self) -> u32 {
|
||||||
match self {
|
match self {
|
||||||
AaMode::None | AaMode::Fxaa | AaMode::Hqx | AaMode::FxUpscale => 1,
|
AaMode::None | AaMode::Bilinear | AaMode::Fxaa | AaMode::Hqx | AaMode::FxUpscale => 1,
|
||||||
AaMode::MsaaX4 => 4,
|
AaMode::MsaaX4 => 4,
|
||||||
AaMode::MsaaX8 => 8,
|
AaMode::MsaaX8 => 8,
|
||||||
AaMode::MsaaX16 => 16,
|
AaMode::MsaaX16 => 16,
|
||||||
|
@ -258,6 +258,7 @@ impl ShaderModules {
|
|||||||
let anti_alias = shaders
|
let anti_alias = shaders
|
||||||
.get(match pipeline_modes.aa {
|
.get(match pipeline_modes.aa {
|
||||||
AaMode::None => "antialias.none",
|
AaMode::None => "antialias.none",
|
||||||
|
AaMode::Bilinear => "antialias.bilinear",
|
||||||
AaMode::Fxaa => "antialias.fxaa",
|
AaMode::Fxaa => "antialias.fxaa",
|
||||||
AaMode::MsaaX4 => "antialias.msaa-x4",
|
AaMode::MsaaX4 => "antialias.msaa-x4",
|
||||||
AaMode::MsaaX8 => "antialias.msaa-x8",
|
AaMode::MsaaX8 => "antialias.msaa-x8",
|
||||||
|
@ -38,6 +38,7 @@ impl assets::Compound for Shaders {
|
|||||||
"include.point_glow",
|
"include.point_glow",
|
||||||
"include.fxaa",
|
"include.fxaa",
|
||||||
"antialias.none",
|
"antialias.none",
|
||||||
|
"antialias.bilinear",
|
||||||
"antialias.fxaa",
|
"antialias.fxaa",
|
||||||
"antialias.msaa-x4",
|
"antialias.msaa-x4",
|
||||||
"antialias.msaa-x8",
|
"antialias.msaa-x8",
|
||||||
|
Loading…
Reference in New Issue
Block a user