Custom Render Engine extending Eevee

Hi there.
Is it possible to create a custom Render Engine (bpy.types.RenderEngine), inheriting or extending Eevee instead of coding a complete external engine?
What I want to do is –sort of– simple, just render a number of subframes in eevee, and average them into a single image, to achieve full object based motion blur, easily and fast.

I already wrote an addon (very hackish btw GitHub - g3ntile/eevee_motion_blur: Script to render in Blender EEVEE with motion blur) that does that: It creates a panel that uses eevee to render the subframes, average them and saves the result to disk. It achieves a beautiful smooth motion blur that works with object animation, particles, deformation, physics, and everything with interpolated animation, about 5 times faster than cycles :+1:.

But I ran into a couple of issues:

  1. The script freezes Blender until it finishes (I couldn’t make it cancelable, due to my limited coding skills :-S . I’m learning to use modal operators hoping to solve that at least).

  2. I can’t give feedback to the user about the progress of the render (via status bar, panel, etc). If I write to the status bar, it ignores all writes until the script is finished. I send the output to the console, and it works ok there of course. While that is enough for myself (I use my addon in production with no issues), but for average users it’s annoying; not everyone checks the console, and they just see Blender freeze with no update and start to panic.

I thought that creating a Custom Render Engine that just uses Eevee is a more elegant solution that may solve both issues and integrate better into Blender (without messing with a patch for Eevee, for which I completely lack the coding skills).

Is that possible somehow?
(something like:

class myCustomRenderEngine(bpy.types.RenderEngine, whatever_className_Eevee_has):
      """I extend both RenderEngine AND Eevee yay!"""

)

Thank you very much! And sorry if this is a silly question :slight_smile:

ps: I tried switching the render engine to EEVEE inside the render() method of the customRenderClass (silly and hackish, I know) and it crashes really bad.

Sorry, I don’t know a whole lot about the topic, but maybe using gpu.offscreen rendering would work?

Not sure about hooking into progress though. I have only really scratched the surface of what Blender is capable of “under the hood”.

I have a couple of questions though, pardon me if they are obvious:

  1. Do you want it to be cancelable?
    a. thoughts here are if it’s a production / server render farm maybe just exiting the process is good enough (thereby “cancelling”)?
  2. Do you have a crash log?
  3. I’m not sure what your production environment looks like, but if “it’s working” is good enough indication to the user, maybe you could use a portable install of Blender and do get_pip.py to install halo or some other terminal based spinner output.

Interesting project!

Thank you for your interest!
The addon works ok for me. I do mostly stills and very simple animations and motion graphics for corporate videos. I just needed real Motion Blur under Eevee to make very fast renders, and I know the addon very well. If I really need to cancel I kill Blender :wink:
I don’t plan to charge anything for using the addon, so it comes “as it is”. I made it for myself, and released just in case it’s of use to someone else :slight_smile:
That said, I just want to improve it, to learn a bit more about the Blender API, to learn to code a bit better, and to make the addon more usable.
I think Eevee is awesome and more than enough for many rendering needs, but the lack of true MB
is a game stopper in many cases. That’s why I want to find a way for the addon to integrate better with the rest of Blender, so many animations may be rendered in Eevee truly fast with professional quality. This Custom Render Engine technique was just an idea, maybe just not a good one.
I’ll dive into that gpu.offscreen thing to see if it serves the purpose.
Thank you!