Commit Graph

289 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks b6d45ce73c gfx/blur/gaussian-linear: Refactor Linear Gaussian Blur
While Gaussian Blur is not a Blur type that really benefits much from linear sampling, it can be used for a slight quality and gpu usage reduction. However for Area and Directional Blur there is a better alternative: Dual Filtering Blur. And as with all other currently implement Linear versions of Blur, only Area and Directional Blur are supported.

This type of Gaussian Blur also has the loading hitch that exists in normal Gaussian Blur.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks fedc8e075c gfx/blur/gaussian: Refactor Gaussian Blur
Gaussian Blur is another Blur that now supports the new system, increasing the maxium Blur size to 128 and adding support for Rotational and Zoom blur. Various optimizations were done to the actual shader code which further reduced the GPU usage.

Currently the Gaussian curve is recalculated when the blur is first created, which can lead to a short hitch due to it having to search for the correct kernels. This is currently unavoidable and expected behavior until a better solution is found.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks 68a8fb9224 gfx/blur/box-linear: Refactor Linear Box Blur
Box Blur is a prime candidate for Linear optimizations, and as such reducing the total necessary samples by about half. However due to the reduction in samples, only Area and Directional Blur are supported.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks 8c5dc3c630 gfx/blur/box: Refactor Box Blur
Box Blur is the first to be on the new system and has received all the new features and optimizations available. The maximum Blur size has been increased to 128, Rotational and Zoom Blur are supported and a small optimization has been done to the shader.

Related: #45, #6
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks 395e284a37 gfx/blur/base: Newly refactored blur code base
This is the new code base for blur effects, which is much more effective at being re-usable than the old code base. It allows for much better extendable behavior and uses an interface and factory pattern, instead of hardcoding supported features.
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks 3f92e1cc89 utility: Move helper macros
As not everything in the plugin needs to use these, they have no place in the plugin header, and thus are now in utility.hpp
2019-04-02 03:50:01 +02:00
Michael Fabian 'Xaymar' Dirks 18b8cc2b5c obs-source-tracker: Use the output flags instead of flags
This fixes being able to filter by the source type (audio, video).
2019-03-01 20:38:49 +01:00
Michael Fabian 'Xaymar' Dirks f902f8f0f5 filter-blur: Actually call load in the load signal 2019-03-01 20:38:06 +01:00
Michael Fabian 'Xaymar' Dirks ba00fbb97e project: Fix even more warnings 2019-03-01 12:00:30 +01:00
Michael Fabian 'Xaymar' Dirks da6feda981 source-mirror: Remove double mutex lock 2019-03-01 11:37:24 +01:00
Michael Fabian 'Xaymar' Dirks c0f951d855 project: Fix various warnings 2019-03-01 11:33:19 +01:00
Michael Fabian 'Xaymar' Dirks 133978bbca util-math: Remove alignment from vec2a 2019-03-01 11:14:06 +01:00
Michael Fabian 'Xaymar' Dirks fa502734ce filter-blur: Allow direct rendering
Small performance optimization as this removes the extra texture render that would be done by libobs which we don't actually need as we already have a texture to render to for it.
2019-03-01 10:59:11 +01:00
Michael Fabian 'Xaymar' Dirks 1c072d67cb filter-transform: Validate source size each tick
Rendering happens with cached Geometry that is only updated when necessary, such as when the user changes settings. This optimization was necessary to reduce CPU and GPU usage as we can simply re-use the same geomtry instead of recalculating it.

However, the actual source size was never checked. That meant that when a source changed size through any means, the filter would not update the geomtry accordingly, and the result was a squished or stretched image.

With this, the source size is now checked each tick.

Fixes #48
2019-02-15 13:52:44 +01:00
Michael Fabian 'Xaymar' Dirks 3bf1333c84 project: Restructure of the file system
The number of files in the source directory was a little bit much and just made file naming more complex than it had to be. Therefore all files were moved into subdirectories where it matters.

Filters now reside in source/filters/, Sources in source/sources/, OBS Wrappers in obs/, OBS GS Wrappers in obs/gs/, Transitions will reside in source/transitions, Graphics Helpers will be in gfx/.
2019-02-11 04:03:57 +01:00
Michael Fabian 'Xaymar' Dirks 3e4930e6e0 filter-transform: Fix incorrect names for properties and options
MipGenerator.Strength was renamed to MipGenerator.Intensity, which better fits the actual intention of the property. Additionally all the mipmap generator options are now correctly named.
2019-02-11 04:03:56 +01:00
Michael Fabian 'Xaymar' Dirks 9f28144b0b filter-blur: Properly set Image(s) filter for path property 2019-02-01 19:58:05 +01:00
Michael Fabian 'Xaymar' Dirks 43136b00c4 filter-blur: Precalculate correct filter width for Gaussian
Gaussian blur used to have a hard edge which was caused by the filter width being wider than the actual sampling range, which is what is determined by the size option. In order to fix this, we have to figure out the proper filter width for a sampling range, so that we avoid any and all hard edges.

Additionally removes the old texture method entirely.

Fixes #44
2019-02-01 08:35:58 +01:00
Michael Fabian 'Xaymar' Dirks 10f7047042 util-math: Add templated gaussian function 2019-02-01 08:35:58 +01:00
Michael Fabian 'Xaymar' Dirks 3ee815b152 filter-sdf-effects: Extend shadow range to -16...16 2019-01-31 04:53:39 +01:00
Michael Fabian 'Xaymar' Dirks cfc828f0f8 source-mirror: Fix crash with audio sources and late video sources
Source Mirror would incorrectly crash if an Audio only source was selected, as it expected a video frame to be present of any size. This fixes the problem by first testing if there is any video information to render and then just catching any exception that happens during rendering.
2019-01-31 02:57:18 +01:00
Michael Fabian 'Xaymar' Dirks f5424d1aad gs-effect: Replace OBS cached file loading with custom one
The normal OBS behavior is to cache files that are loaded from disk, however this is not the behavior we want at all, as it can miss file updates as it never checks the disk for an updated file.

So instead of relying on OBS, this implements the file reading and effect creation without the cache. If a cache is necessary, it would not be the job of this class.
2019-01-31 02:30:18 +01:00
Michael Fabian 'Xaymar' Dirks 75009c617a filter-sdf-effects: Support for scaling SDF Texture Size
This allows increasing or decreasing the accuracy of the Signed Distance Field at runtime without requiring the initial source to be resized. Use case for this would be small text where the higher quality would only be noticable on the shadow and not the text itself.
2019-01-30 03:12:12 +01:00
Michael Fabian 'Xaymar' Dirks 493ef5da23 filter-sdf-effects: Move factory definitions before instance 2019-01-30 02:39:42 +01:00
Michael Fabian 'Xaymar' Dirks 7cf3e17b9b filter-sdf-effects: Fix black border and add inverse gradient shadow
Sources were rendering with a black border around them if they had a soft fade, which is due to how the shadow calculated the image sample. With the new shader code this is now fixed and the source looks like it should be. Additionally this removes the bug where enabling any shadow would cause only the texels to draw that were above the threshold.

Additionally this adds support for inverse gradients (min > max) and negative gradients for outer shadows instead of only positive gradients. This technically allows for cleaner shadows.
2019-01-30 02:38:34 +01:00
Michael Fabian 'Xaymar' Dirks 3ebbc84ee2 filter-sdf-effects: Rename Shadow (SDF) Filter (Part 2)
This finalizes the rename started in the previous commit by changing the class name and also updating the locale strings
2019-01-29 07:35:14 +01:00
Michael Fabian 'Xaymar' Dirks a7161b51e0 filter-sdf-effects: Rename Shadow (SDF) Filter (Part 1)
The nature of this Signed Distance Field based Filter is not to only draw shadows, but to also draw an outline or even glow around a source. Therefore the name "Inner/Outer Shadow (SDF)" does not fit well with the intent of the actual Filter.
2019-01-29 04:35:12 +01:00
Michael Fabian 'Xaymar' Dirks a56cbf89a9 filter-blur: Refactoring 2019-01-28 01:08:13 +01:00
Michael Fabian 'Xaymar' Dirks 4eb3197720 gfx-source-texture: Don't create two references to the same source 2019-01-28 00:47:36 +01:00
Michael Fabian 'Xaymar' Dirks c529e45cfd filter-blur: Refactoring, one-time rendering, fix mask logic
Unfortunately load is never called on filters.
2019-01-28 00:00:45 +01:00
Michael Fabian 'Xaymar' Dirks 97bf38633b gfx-source-texture: Release child source if add_active_child fails 2019-01-27 23:33:38 +01:00
Michael Fabian 'Xaymar' Dirks 10c0081f32 project: Refactoring Part 2 2019-01-27 23:33:12 +01:00
Michael Fabian 'Xaymar' Dirks 39b0600aa3 filter-blur: Update in load and create 2019-01-27 23:30:37 +01:00
Michael Fabian 'Xaymar' Dirks 8a64e360c4 filter-blur: Switch to obs-source-tracker
Completely eliminates the need for obs_emum_sources and obs_enum_scenes, thus improving backwards compatibility.
2019-01-27 23:19:09 +01:00
Michael Fabian 'Xaymar' Dirks fa4a81bb54 gfx-source-texture: Delete copy and move constructors and operators 2019-01-27 22:50:35 +01:00
Michael Fabian 'Xaymar' Dirks a15f1934b3 filter-custom-shader: Do not build for release
This feature is postponed until 0.6.0 for stability and UI/UX issues.
2019-01-27 22:44:45 +01:00
Michael Fabian 'Xaymar' Dirks 551cbb83b1 obs-source-tracker: Source Tracking Compatibility Layer
Allows for enumerating any kind of source, as long as it has a name and is not private. As obs_enum_scenes is a 23.x and above function, this class should be used instead to remain backwards compatible.
2019-01-27 22:43:49 +01:00
Michael Fabian 'Xaymar' Dirks d56c0d6f25 project: Refactoring Part 1 2019-01-25 17:55:36 +01:00
Cat Stevens b91700e74f filter-blur: delete pointer in destroy() (#42) 2019-01-25 17:40:59 +01:00
Michael Fabian 'Xaymar' Dirks 3ac7e46628 filter-shadow-sdf: Remove shadow_sdf namespace, rename shadow_sdf_instance to shadow_sdf 2019-01-25 00:55:40 +01:00
Michael Fabian 'Xaymar' Dirks 7708dd0792 filter-shadow-sdf: Refactoring, fix and optimize rendering
Fixes the m_source_texture = nullptr bug, which happened due to m_tick and m_last_tick both being 0, as no video_tick is called when the source is first created. Instead a boolean flag is now used that is reset to false on each video_tick.
2019-01-25 00:54:34 +01:00
Michael Fabian 'Xaymar' Dirks d29f5ce477 filter-transform: Transform to transform, ...Addon to ..._factory 2019-01-25 00:38:20 +01:00
Michael Fabian 'Xaymar' Dirks 2aa4595bd3 filter-displacement: Rename Displacement to displacement, ...Addon to ..._factory 2019-01-25 00:38:01 +01:00
Michael Fabian 'Xaymar' Dirks 7a61006d2b source-mirror: Rename Mirror to mirror, ...Addon to ..._factory 2019-01-25 00:36:54 +01:00
Michael Fabian 'Xaymar' Dirks a37d9bbb59 filter-shadow-sdf: Actually delete instances in destroy()
This fixes a memory leak discovered by @catb0t.

Related #33
2019-01-25 00:31:50 +01:00
Michael Fabian 'Xaymar' Dirks ddfb08f39e filter-displacement: Update file logic and rendering
This replaces the use of gs_texture_t* with gs::texture, further improving stability. Additionally some of the useless checks were replaced or reduced.
2019-01-25 00:28:06 +01:00
Michael Fabian 'Xaymar' Dirks 0bdf8e3bba filter-displacement: Use gs::effect instead of gs_effect_t*
The managed gs::effect class handles all acquire and release calls for us. Also slightly simplifies the video_render logic.
2019-01-25 00:28:06 +01:00
Michael Fabian 'Xaymar' Dirks fedb6e3259 filter-displacement: Further refactoring 2019-01-25 00:28:06 +01:00
Michael Fabian 'Xaymar' Dirks c1995c03a9 filter-displacement: Refactor to match new class structure 2019-01-25 00:28:05 +01:00
Cat Stevens c749f5dd62 obs-audio-capture.hpp: missing memory include 2019-01-24 23:30:42 +01:00