TeamRizu / OutFox

The Bug Reporting Repository for OutFox LTS 0.4, Alpha V and Steam Early Access Builds
https://projectoutfox.com
Apache License 2.0
187 stars 3 forks source link

[BUG] (Effect system partially broken) [Feature Request] Addition of Texture Scaling Algorithm #684

Open waiei opened 1 year ago

waiei commented 1 year ago

Please Select the game mode your feature request is about.

All Game Modes

Is your feature request related to a problem?

No response

Describe the solution you'd like

I want to reproduce the blur effect on the backside of glass (effect called Aero Glass or Acrylic in Windows) that is often seen in recent applications

WAIEI CitMin, one of the Themes, uses ActorFrameTexture and scaling to reproduce this effect However, the quality of the magnification is not very good, resulting in a very unnatural glass with a blinking backside In the current version, SetTextureFiltering(false) seems to behave like NearestNeighbor and (true) like Bilinear, I would like to be able to set higher quality bicubic as well

citmin_blur Blur processing in WAIEI CitMin

I suspect that if OutFox could support scaling in Bicubic quality, it could reproduce a quality glass effect It would be better if a blur (Gaussian) filter could be applied directly without having to go to the trouble of scaling

zoom_algorithm

ScreenXXX underlay

return Def.ActorFrame({
    InitCommand = function(self)
        self:Center()
    end,
    LoadActor(THEME:GetPathB('ScreenWithMenuElements','background')),
    Def.Quad({
        InitCommand = function(self)
            self:zoomto(150, 150):spin()
        end,
    }),
})

ScreenXXX decorations

local rander = string.lower(split(',',PREFSMAN:GetPreference('VideoRenderers'))[1]);
if rander == 'd3d' then return Def.ActorFrame({}) end

local scale = 20
local name = 'Texture'
local function BGActor(self)
    return Def.ActorFrameTexture({
        InitCommand = function(self)
            self:SetTextureName(name)
                :SetWidth(SCREEN_WIDTH):SetHeight(SCREEN_HEIGHT)
                :Create()
        end,
        Def.ActorProxy({
            OnCommand = function(self)
                self:SetTarget(SCREENMAN:GetTopScreen():GetChild('Underlay'))
                    :zoom(1.0/scale)
            end,
        }),
    })
end

local function MaskActor(crop)
    local function CropActor(crop)
        return Def.Quad({
            OnCommand = function(self)
                self:horizalign(left):vertalign(top)
                    :xy(
                        crop.Right and (SCREEN_WIDTH - crop.Right) or 0,
                        crop.Bottom and (SCREEN_HEIGHT - crop.Bottom) or 0
                    )
                    :zoomto(
                        crop.Left and crop.Left or crop.Right or SCREEN_WIDTH,
                        crop.Top and crop.Top or crop.Bottom or SCREEN_HEIGHT
                    )
                    :zwrite(true):blend('BlendMode_NoEffect')
            end,
        })
    end
    return Def.ActorFrame({
        Def.Quad({
            OnCommand = function(self)
                self:FullScreen():diffuse(0, 0, 0, 1)
                    :blend('BlendMode_NoEffect'):clearzbuffer(true)
            end,
        }),
        CropActor({Left = SCREEN_CENTER_X}),
        CropActor({Right = 100}),
        CropActor({Top = 50}),
        CropActor({Bottom = 50}),
    })
end

local function SpriteActor()
    return Def.ActorFrame({
        Def.Sprite({
            Texture = name,
            OnCommand = function(self)
                self:SetTextureFiltering(true)
                    :horizalign(left):vertalign(top)
                    :ztest(true):zoom(scale)
            end,
        }),
        Def.Quad({
            OnCommand = function(self)
                self:FullScreen():diffuse(1, 1, 1, 0.375):ztest(true)
            end,
        }),
    })
end

return Def.ActorFrame({
    BGActor(),
    MaskActor(),
    SpriteActor(),
})

Describe alternatives you've considered

It would be nice if we could add a function to set the Filterling Algorithm and be able to configure it

self:SetFilteringAlgorithm('FilteringAlgorithm_Bicubic'):SetTextureFiltering(true)

Or it would be nice if Def.Sprite could support texture blurring!

local texture = self:Load('hoge.png'):blur(20)  -- blur size (px)

Additional context

No response