bezo97 / IFSRenderer

3D IFS fractal renderer and editor
https://ifsrenderer.z97.io/
GNU General Public License v3.0
52 stars 7 forks source link

Import animation channels #37

Open bezo97 opened 1 month ago

bezo97 commented 1 month ago

This would enable the integration of IFSRenderer into existing animation pipelines. The goal would be importing a CSV file containing various animation channels, primarily for camera parameters.

The request comes from @vitos1k in this forum discussion.

vitos1k commented 4 weeks ago

Do you need some help with it? Or maybe can guide me where in the code to look for?

bezo97 commented 4 weeks ago

@vitos1k Don't worry I'm on it, been busy the last few days. Hoping to have a working version by end of week.

bezo97 commented 3 weeks ago

I have solution that can be tested on the dev branch. I added an Import button to the bottom of the channel list: image

The way I implemented it is that the column names are the channel paths, so any channel can be imported, not just the camera object. @vitos1k this means you'll need to adjust your script a bit, or modify the csv before importing it. Here's a test file example3.csv that shows the correct way (with values based off of your example).

Let me know if this works for you.

vitos1k commented 3 weeks ago

It works, as in it imports data and animation is playing. BUT! It seems that some rotations are inverted??.

  1. Camera is looking the oposite (180degree) way from exported camera. So i rotated TilitY offset 180 degrees and now it matches.
  2. Then it looked like Cameras are pointing the same direction at the begining of the animation, but now it rotates Clockwise in IFSRenderer, while it rotates CounterClockwise in my animation. I made a video comparison from the output from IFSRenderer and Blender(keep in mind that IFSRenderers camera is rotated 180 degrees via TiltY parameter) See video

https://github.com/bezo97/IFSRenderer/assets/1842518/f45eac1d-b13f-4ad9-bb7f-95e99a214e46

  1. I thought that all the angles would be inverted, but from the looks of it only rotation around vertical axis is inverted. Because i've flipped video from IFSRenderer in horizontal axis and they matched spot on with blenders render

https://github.com/bezo97/IFSRenderer/assets/1842518/7e1f9d89-853e-49b7-9405-1f3bba8ccb64

Also a question how one can find out Full chanel name? for example if i want to synchronize Affine Translate animation with animation of a slider in blender? Is there any tooltip ?

bezo97 commented 3 weeks ago

The problem with the camera orientation is probably caused by the different coordinates systems used in Blender and IFSRenderer. This is what Blender uses. And this is how it works in IFSRenderer:

X axis: Left / Right
Y axis: Top / Bottom
Z axis: Front / Back

In other words, Blender uses right-handed coordinate system, and IFSRenderer uses left-handed coordinate system. This is something your conversion script could handle, not the import feature of IFSR. Found a thread that should help you add this conversion to the script. Ideally you won't need to add any tilting to work correctly. Also, I know there's an option in Blender to select the correct axis when exporting objects, maybe you can find a way to reuse the functionality: image

As for the channel paths, you are right they aren't shown anywhere. But instead of tooltips I'll try to figure out a way to be able to copy-paste them. In the meantime you can also peek at the saved fractal file to see them.

bezo97 commented 3 weeks ago

I made the channel paths visible in these two places: the context menu of the sliders, and the channel editor panel. They are read-only textboxes. image

vitos1k commented 3 weeks ago

Thanks alot! I'll try it tomorrow when will be near my machine. And i'll modify my script to take into account left-handedness. Will report back here

vitos1k commented 3 weeks ago

Yep works as expected! i've updated my scrip for blender here https://github.com/vitos1k/pipelinetools/blob/master/io_export_anim.py

Also as a request is it possible add function to export animation in csv file? For example Create interesting pattern in IFSRenderer, create few keypoints for camera animation, export it to blender, polish animation, add aditional graphics. And then reimport new polished animation into IFSRenderer for final render.

bezo97 commented 3 weeks ago

@vitos1k Awesome, thanks for testing it out. The feature will be available in the next release 👍

As for the CSV export, I feel its a bit out-of-scope but I'll think about it. Feel free to open another Issue or send a PR for this