Check if GetVirtualObjects is called for Motion Blur
-
In other software packages they have 4 callbacks PRERENDER, PRERENDER_FRAME, POSTRENDER_FRAME and POSTRENDER.
Obviously if between PRERENDER_FRAME and POSTRENDER_FRAME GetVirtualObjects is called more than once we know that the first one is the actual call and the others are just called for effects like Motion Blur.
Is there something similar or any other way to get this information in C4D ?
Thank you in advance
-
Hi @victor first of all welcome in the PluginCafe community.
There is nothing in an ObjectData that fits your need but I would say I don't really see why would you need such information within an ObjectData generator.
A generator will and must be time agnostic (I would say in 99% of the case), this is the parameter and the matrix of this generator that the user animate, then GetVirtualObject only needs to output geometry based on these parameters.
This will be the job of the render to evaluate the scene for each subframe (So if you have an animated float parameter, this value will be set correctly).In any case, if you are doing the animation within your generator (which is not recommended but it can be needed) let's say you create a cube that moves with a sin curve in the time. This shouldn't be an issue since you retrieve the current document time but as GetFrame returns an int, you may need to re-implement it to retrieve a float value to support SubFrame.
So here a python example in a Python Generator that does that (The main method is an alias for GetVirtualObject in the Python Generator).
import c4d import math def main(): docTime = doc.GetTime() currentFrame = math.floor(docTime.GetNumerator() * doc.GetFps()) / math.floor(docTime.GetDenominator()) if int(currentFrame) != currentFrame: print "Within SubFrame", currentFrame else: print "Round frame", currentFrame return c4d.BaseObject(c4d.Ocube)
And finally, if you really need to have these steps, as said they are only known to the render, so your best bet is to create a VideoPostData plugin (only available in C++) and in the Execute you have all the step you want, so you could write the current step in the BaseDocument and reads the data from the BaseDocument in your generator.
Cheers,
Maxime. -
Hi Adam I think that probably I've posted with my personal account right now but I've been on the forums for a while, I'm the developer of the Anima for c4d plugin (and I know Riccardo for a long time since I was on the development team of Thea)
My question is tricky and related to Anima (the crowd system) plugin.
We have a new kind of models that could change its topology with the time, also we have a fallback that allows me to retrieve the non-changing-topology mesh for motion blur. Your suggestion works nice if the mb call only less than one frame but fails for bigger ranges since it could give us an integer frame and I'll return a different topology.
I'm still wondering if there is any other way...
Regards, VΓctor
-
Hi,
have you considered listening for an up-coming rendering via
MSG_MULTI_RENDERNOTIFICATION
, check theRenderNotificationData
(does the render type support motion blur) and the render settings of the document (is there a motion blur effect or not) and determine by that if your object geometry has to be rebuild?Cheers,
zipit -
@zipit MSG_MULTI_RENDERNOTIFICATION was a nice tip but in our case, it only works for still since that MSG is triggered only once in an animation, the same MSG if it could be called once per frame in an animation could be just perfect.
-
Hi,
I am aware of that, but since the document is cloned for a rendering, I do not see a problem with that, i.e. flagging your object instance in the render document as
ALWAYS_YIELD_MOTIONBLUR_SAFE_GEOMETRY
should not impact anything but the rendering. Or are there render settings now which allow you to enable motion-blur on a by frame basis? I am not really up to date when its comes to Cinema's core features ...Cheers,
zipit -
@zipit sorry I didn't find anything related to ALWAYS_YIELD_MOTIONBLUR_SAFE_GEOMETRY
-
@victor said in Check if GetVirtualObjects is called for Motion Blur:
@zipit sorry I didn't find anything related to ALWAYS_YIELD_MOTIONBLUR_SAFE_GEOMETRY
Sorry, I was probably a bit unclear on that. What I meant was: Listen to the message and once you retrieved it (and determined that this is an animation rendering that contains a motion blur), you can set a flag in the instance of your plugin object that tells
GVO
that this instance should be constructed as motion blur safe. And since you are then in a rendering document, that should have no impact on the editor behavior of your object. The made up symbol was just an attempt on trying to convey that without writing a wall of textCheers,
zipit -
@zipit said in Check if GetVirtualObjects is called for Motion Blur:
n that. What I meant was: Listen to the message and once you retrieved it (and determined that this is an animation rendering that contains a motion blur), you can set a flag in the instance of your plugin object that tells GVO that this instance should be constructed as motion blur safe. And since you are then in a rendering document, that will have no impact on the editor behavior of your object. The made up symbol was just an attempt on trying to convey that without writing a wall of text
I disabled it by using a motion blur tag, btw I was speaking about these characters, unfortunately since I cannot get that preframe signal c4d won't support motion blur
-
Hi @victor just to be sure, you want to retrieve the initial frame render within the Object Generator.
So if you have motion blur enabled and with a time of 1 frame with 1 step.
You press the render button while being on frame 4, it will evaluate frames 3, 4 and 5. And in all of these, you want to know the original frame rendered (aka the frame 4). And of course, have something that works with animation and not only still.
If that's correct I will forward it to the development team(since I wasn't able to find a way until now) but I prefer to ask first since we are not 100% that is what you really want to know.
If it's not your real question, could you send us an email at[email protected]
with as many information as possible.Thanks in advance,
Cheers,
Maxime. -
Yes, the situation you described is exactly what we need.
We released v4.0 without mb support in C4D for the new 4D characters (in regular rigged and ambient characters it works ok) but we could introduce it in a 4.1 or something like that.
-
Hi @victor unfortunately, the development team told us there is no way to achieve that without hooking directly into the render which is not possible for Cinema 4D built-in rendered.
Cheers,
Maxime.