Xaymar / obs-StreamFX

StreamFX is a plugin for OBS® Studio which adds many new effects, filters, sources, transitions and encoders! Be it 3D Transform, Blur, complex Masking, or even custom shaders, you'll find it all here.
https://s.xaymar.com/streamfx-dc
GNU General Public License v2.0
3.89k stars 2.78k forks source link

4 point perspective quad perspective #715

Closed dinther closed 2 years ago

dinther commented 2 years ago

Explain the Feature/Enhancement

Hello, I am into projection mapping. OBS is so close to be the perfect platform! However, the 3D Transform filter is too hard to use to accurately map a rectangle to a real world perspective.

A UI where the 4 corner points can be adjusted would be absolutely spectacular. With that it will become trivial to map rectangular media onto 3D geometry.

I had a look myself to see if there is a shader that can do it. And yes, possible but I know nothing about writing shaders but this shader get's close https://www.shadertoy.com/view/MscSRr. It would then be a matter of 8 variables 4 x,y coordinates and boom I am in heaven.

Here a javascript implementation I dabbled with https://codepen.io/dinther/full/ExvjNzo

Or examples in pixijs both projective and bilinear.

https://pixijs.io/examples/#/plugin-projection/quad-homo.js https://pixijs.io/examples/#/plugin-projection/quad-bi.js

I know there's a whole lot of other parameters like pincushion, bulge , linear correction etc. But That isn't too much of an issue.

Please pretty please, can someone implement this or make a shader that takes as input the four x,y corners?

With such enhancement OBS instantly becomes THE projection mapping tool of choice.

Either way, thanks for the great work on StreamFX it is a lot of fun to work with.

https://user-images.githubusercontent.com/1192916/143268780-ed396e79-7fc0-4075-9b01-5e6a9a9664ef.mp4

What makes this feature/enhancement useful for StreamFX and its users?

With even a basic 4 point perspective adjustment OBS Studio would instantly become the ideal platform to do projection mapping.

Checklist

Any additional Information we need to know?

You're amazing. :-)

skeletonbow commented 2 years ago

Duplicate of #565 (already implemented)

Xaymar commented 2 years ago

This is a duplicate of #565, which has already been implemented with everything that is actually possible from within libobs.

dakhubgit commented 2 years ago

This is a duplicate of #565, which has already been implemented with everything that is actually possible from within libobs.

That would it likely that the following missing functionalities should be evaluated by someone who is intimite with the possibilities of libobs and then goals should be entered into the central OBS repository to make it feasible to implement them in the long run:

a) allowing for actually dragging the corner points in the target image like currently possible with rescale/crop functionality. A less wonderful (but still reasonable) alternative would be to have the settings dialog for streamfx display a preview window for doing this.

b) a transition that will smoothly transition from one corner pin arrangement to another (particularly to fullscreen) which would make it possible to smoothly switch from a screen-in-frame to a fullscreen arrangement. For demoing gameplay, this would allow switching back and forth between viewing the game screen content only to viewing the screen in gaming context. In connection with volume-based transitioning, this could show a player when they are actively commenting (and then ducking gameplay volume) and move back to full-screen coverage when they are quiet again.

Again, this is likely somewhat feasible within the plugin itself but then it would likely not have access to the usual events that can trigger transitions.

Outside of libobs is likely an option to snap to the closest edges/corners. Since that makes mainly sense after all corners have been roughly placed, a separate button for doing the fixing action would be warranted. Really involved would likely be roughly tracking the corners in case the camera or zoom position are changed.

But the main things that require interfacing/integration more than they require image processing algorithms would be the ability to drag individual corners on-screen and to be able to transition geometrically between full-screen and 3D mapping.

skeletonbow commented 2 years ago

That would it likely that the following missing functionalities should be evaluated by someone who is intimite with the possibilities of libobs and then goals should be entered into the central OBS repository to make it feasible to implement them in the long run:

a) allowing for actually dragging the corner points in the target image like currently possible with rescale/crop functionality. A less wonderful (but still reasonable) alternative would be to have the settings dialog for streamfx display a preview window for doing this.

That would be a very useful user interface option to have. You'll need to submit the idea to the OBS Project in order for it to be considered by them as a possible future enhancement. OBS Ideas Submission

b) a transition that will smoothly transition from one corner pin arrangement to another (particularly to fullscreen) which would make it possible to smoothly switch from a screen-in-frame to a fullscreen arrangement. For demoing gameplay, this would allow switching back and forth between viewing the game screen content only to viewing the screen in gaming context. In connection with volume-based transitioning, this could show a player when they are actively commenting (and then ducking gameplay volume) and move back to full-screen coverage when they are quiet again.

This is something already possible quite a number of ways, the most notable being Exeldro's move-transition plugin available in the OBS Resources forum, which allows all kinds of OBS property animation both of internal properties and plugin properties, and is able to do the motion transitions described above.

As for volume related things you'd have to probably hire a developer to program a custom plugin for that, there's no plugin available I'm aware of that can do something of that nature currently other than for audio visualization (Spectralizer, and OBS Shaderfilter Plus), but neither of those can control something else in OBS.

But the main things that require interfacing/integration more than they require image processing algorithms would be the ability to drag individual corners on-screen and to be able to transition geometrically between full-screen and 3D mapping.

Definitely submit that to the OBS development team as a feature idea/suggestion that would be useful for plugin developers. If they agree, then it's theoretically possible to see such a feature in the future.

dakhubgit commented 2 years ago

Audio volume related scene switching can be done by the advanced scene switcher, nothing new here.

dakhubgit commented 2 years ago

move-transition appears to only work with rectangles, not with the quadrilaterals from corner pinning.

skeletonbow commented 2 years ago

move-transition appears to only work with rectangles, not with the quadrilaterals from corner pinning.

The move-transition plugin can indeed do what I said it could do, but that is way off topic for StreamFX github issue report, so I'm going to refrain from further comment about that here.

I would recommend using the StreamFX Discord server if you'd like to continue the discussion of StreamFX related things, explore possibilities, etc. as github for StreamFX isn't intended for general discussion or technical support. And if you'd like to discuss move-transition or other non-StreamFX plugins, the proper place is the #plugins-and-tools channel on the official OBS Discord server.

dakhubgit commented 2 years ago

Thanks, you are right. Here is another suggestion for the StreamFX plugin in that context, however: after pinning the corners, allow the mode to switch from "corner pinning" to "rotate, pitch, yaw, and probably some more variables?" and calculate parameters such that the transform itself stays the same. The point with that is that the move-transition plugin will then be able create a quite nicer animation in terms of perspective parameters than in terms of corner movement, while setting up the 3D transformation has all the convenience of corner pinning.

skeletonbow commented 2 years ago

Thanks, you are right. Here is another suggestion for the StreamFX plugin in that context, however: after pinning the corners,

Just FYI, you can submit feature requests for StreamFX by clicking on the green "NEW ISSUE" button at the top of the page and selecting "Suggest a new feature or enhancement", putting a single suggestion per issue submitted and the developer of StreamFX will review them over time for consideration.

This is someone else's report and it is closed so anything you suggest here wont ever be considered and may not even be seen. Need to suggest features, report bugs, seek support etc. in the proper place in order for it to be seen by the right people and/or have an impact. I'm seeing them because I previously commented, so I'm trying to redirect you to the proper place so you can potentially be heard. Adding random comments onto the bottom of someone else's issue though is like talking into a pillow, nobody is going to hear (except me because I commented above so I'm CCd on the report).

Since this is someone else's issue report however and it is officially closed, further discussion is off topic here and I will be respecting the rules of the issue report system and will no longer comment further, so you're on your own now I'm afraid. :)