p2or / blender-loom

image sequence rendering, encoding and playback
175 stars 10 forks source link

Feature request: Viewport rendering option #70

Closed Ulf3000 closed 8 months ago

Ulf3000 commented 11 months ago

hey man , great addon ! thanx alot ! rendering only selected keyframes is an option which is is surely missing from native blender and you added this important feature!

i have one request though , is it possible to add an option to use "viewport rendering" instead of "normal rendering" ? I often use viewport rendering becasue A) its like 10 times faster than normal, B) it outputs the exact visual representation from the viewport and C) you can just isolate an object, render it and leave isolation mode , no need to fiddle with the outliner render properties for each object.

p2or commented 11 months ago

Hi @Ulf3000,

thanks for your feature request and your kind words - glad that the add-on is also useful to others. Regarding your question: In Blender the viewport is rendered using the workbench engine which you can also use for rendering:

Screenshot 2023-12-16 at 16 42 37

Does that help you? Otherwise, please be more specific about what do you mean by viewport rendering, thanks.

Cheers, Christian

Ulf3000 commented 11 months ago

I was referring to the bpy.ops.render.opengl() operator:

grafik

Example render of the EEVEE viewport using the realtime compositor. I'm getting great results out of it.

p2or commented 11 months ago

Hi @Ulf3000,

if this is really a thing and helps others in their work too, I'm in. I created a new flipbook-branch to play with and get the ball rolling. For now you can either use CtrlShiftF10 or go to Render > Loom > Render Flipbook (OpenGL):

Screenshot 2023-12-22 at 22 18 39

If you have the time, please download the add-on from there and report back. If you have better ideas for placement, name, handling etc. let's just discuss it.

Cheers, Christian

Ulf3000 commented 11 months ago

Works perfect here, just the line 5808 needs to be commented out, otherwise the script fails. I used CrtlShiftF10 and then put in arbritrary numbers, it rendered them fine and opened the folder afterwards. Just like the normal version. If that could be implemented to the dopesheet button too would be nice.

Also I always run bpy.ops.view3d.view_center_camera() and bpy.ops.view3d.zoom_camera_1_to_1() before rendering. This ensures that the camera is zoomed fully and sits directly in the middle. Overlays, imported videos etc. will now render in the right location at the right size.

grafik


One thing to note, when I use the realtime compositor and have a blended texture in the compositor it will render that textures at the wrong size depending on the actual zoom level.

grafik

turns into this when rendering:

grafik

I dont know if thats a bug which will be ironed out or not.

p2or commented 11 months ago

Hi @Ulf3000,

just the line 5808 needs to be commented out

Thanks, a leftover from my tests that I just removed (7900e8f).

If that could be implemented to the dopesheet button too would be nice.

To put there - it needs a name, an icon, a description and so on... If you have an idea, just let me know.

so i always do a bpy.ops.view3d.view_center_camera() and a bpy.ops.view3d.zoom_camera_1_to_1()

Good to know, something we could put on the panel and execute automatically for the user (if truly relevant). I think, having an option on the panel to disable all overlays while rendering automatically would be helpful as well. Do you agree?

Anyway, this feature is a lot of work and will not be easy to maintain over the next years. Your current findings feel more like quick notes to me so I would ask you, please just work with it on a longer period and write down all your thoughts in a comprehensible way before we push this even further or perhaps make a sketch of what it might look like and especially how this could work for others too, thanks.

Cheers, Christian

Ulf3000 commented 11 months ago

I think, having an option on the panel to disable all overlays while rendering automatically would be helpfull as well. Do you agree?

Sure, most of the time it would be enabled (for me). I toggle overlays with a shortcut all the time and before rendering but thats convinient.

please just work with it on a longer period and write down all your thoughts

Will do, thanks for your hard work.

p2or commented 10 months ago

Hi @Ulf3000,

good news, overlays are now automatically hidden during rendering as discussed and can be switched on if required:

Screenshot 2023-12-27 at 18 19 33

However, when I tried to implement your camera settings (maximizing the camera bounds as well as setting the 1:1 ratio), I found that this has no effect on the actual result - regardless of the zoom level, there is technically no difference:

Comp_cameraBounds

Am I missing something here? Or is this just your personal preference?

Cheers, Christian

Ulf3000 commented 10 months ago

Am I missing something here? Or is this just your personal preference?

In the example i posted , i overlayed an image texture( a gradient made in photoshop) with the realtime compositor. If the image isnt zoomed 1:1 then that gradient will not apply to the whole render image but just as a box in the middle depending on the zoom level (the smaller the camera is zoomed the smaller that rectangle will be ). Zoom levels bigger than 1:1 dont seem to affect it. Only zoom levels lower than 1:1.

So its ONLY to fix this shortcoming of the realtime compositor.

p2or commented 10 months ago

Hi @Ulf3000,

FYI: In my tests, the image renders perfectly fine using our new flipbook feature without adjusting the camera of the viewport - even if the viewport is tiny and the image is not displayed as expected when in camera view, the result is actually correct. Example of a comped image on top of the render layer (scene with comp on the left, render result on the right):

Test-CameraOptim_v01

If you still see a need for optimization, please let me know.

Cheers, Christian

p2or commented 9 months ago

Hi @Ulf3000,

to support rendering of markers and keyframes, I've just added a new property to the popover in the timeline that allows to switch between regular and viewport rendering:

Screenshot 2024-02-05 at 16 26 00

What do you think? Does that work for you? Or do you have a better idea?

Cheers, Christian

Ulf3000 commented 9 months ago

Hi @Ulf3000,

to support rendering of markers and keyframes, I've just added a new property to the popover in the timeline that allows to switch between regular and viewport rendering:

Screenshot 2024-02-05 at 16 26 00

What do you think? Does that work for you? Or do you have a better idea?

Cheers, Christian

hi i downloaded loom.py from the branch but that icon doesnt appear for me. the idea is good , if it keeps being selected. otherwise the crtl+shift+f10 worked great for me grafik


also the issue above is not resolved for me , can you share the test blend file ?

p2or commented 9 months ago

Hi @Ulf3000,

hi i downloaded loom.py from the branch but that icon doesnt appear for me.

Cannot confirm, works fine. Any error message in the console?

ezgif-5-79e4f5cbf8

the idea is good , if it keeps being selected.

Yep, the state is stored per scene.

also the issue above is not resolved for me , can you share the test blend file ?

Sure, here it is: flipbook-feature_clean.blend.zip.

Cheers, Christian

Ulf3000 commented 8 months ago

Hi @Ulf3000,

hi i downloaded loom.py from the branch but that icon doesnt appear for me.

Cannot confirm, works fine. Any error message in the console?

ezgif-5-79e4f5cbf8 ezgif-5-79e4f5cbf8

the idea is good , if it keeps being selected.

Yep, the state is stored per scene.

also the issue above is not resolved for me , can you share the test blend file ?

Sure, here it is: flipbook-feature_clean.blend.zip.

Cheers, Christian

sorry man , i mixed up the files. it works alright here:

grafik

are selected keyframes messed up though ? i get other numbers than the selected keyframes:

grafik

p2or commented 8 months ago

Hi @Ulf3000,

please make sure that no keyframes from other objects in the scene are selected by activating the Limit by object selection toggle. Just tested and cannot confirm this behavior. If this does not work for whatever reason, please report back.

Screenshot 2024-02-27 at 09 35 21

Does everything else work for you?

Cheers, Christian

Ulf3000 commented 8 months ago

yes that worked, thanx : grafik it were probably selected keyframes in realtime compositor or shader editor which messed it up

p2or commented 8 months ago

Hi @Ulf3000,

had the time to test it while working on a project and it works fine for me, hence I think I'm ready to merge this branch into the master in the next few days. Do you have any suggestions for improvement? Is there anything else bothering you?

Cheers, Christian

Ulf3000 commented 8 months ago

go ahead, its been working fine for me since the first iteration.

the problem above with the realtime compositor and zoom levels is still not resolved for me , but that has nothing to do with your addon. Let the blender devs fix this at core level imo.

It would be cool if we could get OCA(Open Cel Animation format) and/or XDTS (used by opentoonz and toei animation sheet) when using "selected keyframes" rendering, but thats a different feature request.

Im very happy with your script, the ability to combine selected keyframes and viewport rendering is really awesome for me. I can render animations in mere seconds now.

p2or commented 8 months ago

Hi @Ulf3000,

the problem above with the realtime compositor and zoom levels is still not resolved for me , but that has nothing to do with your addon. Let the blender devs fix this at core level imo.

Wouldn't be hard to add a test (we already had one and the code is there) but as you can see in my Nuke screenshot, I can not reproduce it - I can only guess that the resolution of the image you are using is slightly different. Did you test my file?

Im very happy with your script, the ability to combine selected keyframes and viewport rendering is really awesome for me. I can render animations in mere seconds now.

Hi5! Christian

Ulf3000 commented 8 months ago

I can only guess that the resolution of the image you are using is slightly different. Did you test my file?

yes , same result for me: grafik

see the rectangle in the middle of the image (i disabled the bokeh blur node)

heres the simplified testfile with these settings: flipbook-feature_clean2.zip click view->viewport render image

p2or commented 8 months ago

Hi @Ulf3000,

click view->viewport render image

Aha, thanks. I guess we are talking about two different things. I naturally assumed that we were talking about our flipbook feature (which I tested with). Does this also happen when you render the image using Loom and our new flipbook feature?

Cheers, Christian

p.s. I can't really test your file because the image is missing.

Ulf3000 commented 8 months ago

Hi @Ulf3000,

click view->viewport render image

Aha, thanks. I guess we are talking about two different things. I naturally assumed that we were talking about our flipbook feature (which I tested with). Does this also happen when you render the image using Loom and our new flipbook feature?

Cheers, Christian

p.s. I can't really test your file because the image is missing.

its your file, just slightly edited. the spiral shader should be inside. i dont know about the other images i think you forgot to pack them too, but doesnt matter which image is overlayed, the rectangle will be there IF zoom levels are not at 100%.

The same render result as above when i use ctrl+shift+F10 or the loom button in the timeline.

I downloaded the newst loom.py from flipbook branch today.

but please dont care, you will just waste time, i now found another problem with this ... if the render resolution is lower than the actual screen resolution, for example i have a 1080p monitor but render only in 720p then even the workaround wont help. if the render resolution is the same as the monitor or bigger then the workaround will work. Its also a very specific problem for just my workflow as im probably the only one using viewport rendering anyways XD

p2or commented 8 months ago

Hi @Ulf3000,

i dont know about the other images i think you forgot to pack them too,

I've used a regular 'Color Grid' based on the scene resolution which can be generated on the fly, see the previous screenshot.

the rectangle will be there IF zoom levels are not at 100%. The same render result as above when i use ctrl+shift+F10 or the loom button in the timeline.

I haven't changed anything in your file except for generating the checkerboard and I unfortunatly still can not confirm. The zoom level is way off in the viewport and it works fine (even with the regular 'Render Viewport' operator in this case), see:

Screenshot 2024-03-24 at 20 04 29



but please dont care, you will just waste time ...

Good, agree. Just in case we need the file with the checkerboard for further tests: flipbook-feature_clean3.blend.zip.

Cheers, Christian

Ulf3000 commented 7 months ago

i found the difference in our setup 🤦‍♂️🤦‍♂️ it was blender 4.2 , im using it becasue it has the best performance and features for the rt compositor.

your newest file untouched in

blender 4.0: grafik

blender 4.1: grafik

blender 4.2: grafik

sorry for dragging this out.. can be closed, if i ever have a good idea on how to improve the addon ill post right away :)

p2or commented 7 months ago

Hi @Ulf3000,

sweet, thanks for letting me know. As Blender 4.2 is in 'Alpha' stage and experimental software at the time of writing, there is unfortunately nothing I can do for you and would be a waste of time (as you already mentioned). I'd suggest report this behavior to developer.blender.org in case anyone hasn't already noticed.

Cheers, Christian