BrokenSource / DepthFlow

🌊 Image to → 2.5D Parallax Effect Video. A Free and Open Source ImmersityAI alternative
https://brokensrc.dev
GNU Affero General Public License v3.0
323 stars 20 forks source link

Deal with settings for simple movement ? #24

Closed ti2 closed 3 months ago

ti2 commented 3 months ago

Hi, for last day, i have been looking for the perfect settings to create a simple horizontal camera movement. Here is what I tried, without success: depthflow-latest.exe input -i image.jpg -d depth.png main -t 4 -s 2 -ofx 10 -o video.mp4

Thanks in advance for any help, and thanks for this amazing script. best regards, Peter

Tremeschin commented 3 months ago

Hey! It's currently not possible to change the animation on binary releases (I also gotta update them)

For that I'd suggest running from source and manually edit this function to something like:

def update(self):
    self.state.offset_x = math.sin(2*self.cycle)
    return

I will code a preset system next, as I found a nice pattern to integrate with the CLI, should be there within a week

Tremeschin commented 3 months ago

Well, technically, you can find that file on the executable you're using on %applocaldata%\pyapp\*\site-packages\DepthFlow\DepthFlow.py and change the same function's animation code :)

(either Windows+R and run %applocaldata% or on a windows explorer's file path CTRL+L)

Tremeschin commented 3 months ago

In case you want a more "linear" horizontal movement instead of that smooth one with sin(x),

def update(self):
    self.state.offset_x = 1 - 1.2*math.acos(math.sin(2*self.cycle))*(2/math.pi)
    return

Feel free to also add some lines configuring other options like making the background stationary

def update(self):
    self.state.offset_x = 1 - 1.2*math.acos(math.sin(2*self.cycle))*(2/math.pi)
    self.state.focus = 0 # There's a big class on the start of the file saying what parameters do
    return

If running from newest versions from source, you can run depthflow config to see and set those options to a fixed value

There's also a depth of field and vignette effects that can be enabled, there's examples on depthflow command help

Tremeschin commented 3 months ago

Example with the last message's .update and the following command (won't work on .exe until the v0.4.0`:

https://github.com/BrokenSource/DepthFlow/assets/29046864/4524b765-bf56-4c5f-a538-4b83b2251d16

ti2 commented 3 months ago

Thank you so much! After a bit of tweaking, your solution work like a charm.