Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

Render Time

Author
Message
  Topic Search Topic Search
evanbbb View Drop Down
Member
Member
Avatar

Joined: 2010 Oct 13
Online Status: Offline
Posts: 11
Direct Link To This Post Topic: Render Time
    Posted: 2011 Nov 23 at 9:09am

User Information:

Cinema 4D Version:   13 
Platform:    Mac  ;  
Language(s):   C.O.F.F.E.E  ;    

---------

I have a COFFEE script that changes the document's current frame that works normally but not in the picture viewer. Basically it jumps back a few frames so its rendering the same frames over and over (with a little modification in between of course). But in picture viewer, it makes the modification but doesn't move back the time.

/--------
var renderFrame = 20;
var t = doc->GetTime();
var f = t->GetFrame(30);

t->SetFrame(renderFrame,30);
doc->SetTime(t);
EventAdd();

/---

I tried looking for active document or not but couldn't locate the render doc. Any help appreciated, thanks.
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1143
Direct Link To This Post Posted: 2011 Nov 24 at 2:53am
Hi,

Can you explain more ? I don't fully understand what's occuring.

Regards,

MAXON
Developer Support
Back to Top
evanbbb View Drop Down
Member
Member
Avatar

Joined: 2010 Oct 13
Online Status: Offline
Posts: 11
Direct Link To This Post Posted: 2011 Nov 24 at 3:12am
Essentially I want to render the scene at frame 20 over and over but from different angles. I understand I can just stop the animation but I want to record the motion blur inherent in that frame. So I've written a COFFEE script so that when the document gets to frame 21, it makes an adjustment to the camera then jumps back to frame 20. After x times, it just plays as normal. Works fine normally, but when I try to render, the jump in time doesn't occur. Looking at the console, its clear that the picture viewer takes data from other frames, which is cool but it doesn't jump in time. I've tried referencing the non-active document but that doesn't seem to help.
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1143
Direct Link To This Post Posted: 2011 Nov 24 at 7:49am
Thanks for explaining the problem more in depth.

Originally posted by evanbbb

Essentially I want to render the scene at frame 20 over and over but from different angles. I understand I can just stop the animation but I want to record the motion blur inherent in that frame. So I've written a COFFEE script so that when the document gets to frame 21, it makes an adjustment to the camera then jumps back to frame 20. After x times, it just plays as normal. Works fine normally, but when I try to render, the jump in time doesn't occur. Looking at the console, its clear that the picture viewer takes data from other frames, which is cool but it doesn't jump in time. I've tried referencing the non-active document but that doesn't seem to help.
If I understand, you expect the problem comes from the render process not taking into account the change made to the camera, right ?
Have you tried to call doc->AnimateDocument(0) after doc->SetTime() and before EventAdd() ?

And I'm just curious, how do you got the non-active document with COFFEE ?



Edited by Yannick Puech - 2011 Nov 24 at 7:50am
MAXON
Developer Support
Back to Top
evanbbb View Drop Down
Member
Member
Avatar

Joined: 2010 Oct 13
Online Status: Offline
Posts: 11
Direct Link To This Post Posted: 2011 Nov 24 at 8:30am
Originally posted by Yannick Puech

If I understand, you expect the problem comes from the render process not taking into account the change made to the camera, right ?

No, the camera change is fine. I just want that frame to be rendered over and over. I know, logically if I do that I'm just writing over the same file but was hoping to have it increment the file number.

Originally posted by Yannick Puech

Have you tried to call doc->AnimateDocument(0) after doc->SetTime() and before EventAdd() ?

And I'm just curious, how do you got the non-active document with COFFEE ?


That didn't seem to help. As for non-active, I guess I wasn't doing it. Thought I had done that but guess not. Here is a condensed version of my code:

main(doc,op)
{
//bunch of code to get my coffee tag and the align to spline tag
//now the time stuff
var t = doc->GetTime();
var f = t->GetFrame(30);

//float that says start of align to spline
var start = myTag#ID_USERDATA:1;

//float that says end of align to spline
var finish = myTag#ID_USERDATA:2;

//number of steps needed
var frames = myTag#ID_USERDATA:3;

//the frame I want to catpture from multiple angles
var renderFrame =  myTag#ID_USERDATA:4;

if(f > renderFrame)
{
var frameStep = (finish - start) / frames;
if(myTag#ALIGNTOSPLINETAG_POSITION < finish)
{
myTag#ALIGNTOSPLINETAG_POSITION = myTag#ALIGNTOSPLINETAG_POSITION + frameStep;
}
if(myTag#ALIGNTOSPLINETAG_POSITION > finish)
{
myTag#ALIGNTOSPLINETAG_POSITION = finish;
println("finished");
}
else
{
t->SetFrame(renderFrame,30);
doc->SetTime(t);
doc->AnimateDocument(0);
EventAdd();
}
}
}

So it moves the camera by 'frameStep' each time it enters the frame. My problem is that instead of jumping to renderFrame, it keeps going forward.

Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1143
Direct Link To This Post Posted: 2011 Nov 24 at 9:14am
Thanks again for your explanations.

Are you executing this code inside a COFFEE tag ?
Also are you sure, the 'else' is executed:
else
{
    t->SetFrame(renderFrame,30);
    doc->SetTime(t);
    doc->AnimateDocument(0);
    EventAdd();
}



Edited by Yannick Puech - 2011 Nov 24 at 9:15am
MAXON
Developer Support
Back to Top
evanbbb View Drop Down
Member
Member
Avatar

Joined: 2010 Oct 13
Online Status: Offline
Posts: 11
Direct Link To This Post Posted: 2011 Nov 24 at 9:25am
Thanks for the help so far.

Yes, its on a COFFEE tag connected to the camera. And the else gets called (tested with println). 
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1143
Direct Link To This Post Posted: 2011 Nov 24 at 9:35am
OK. Could you create a simple scene reproducing this problem ?

MAXON
Developer Support
Back to Top
evanbbb View Drop Down
Member
Member
Avatar

Joined: 2010 Oct 13
Online Status: Offline
Posts: 11
Direct Link To This Post Posted: 2011 Nov 24 at 10:02am
Here you go. Many thanks

Back to Top
affa View Drop Down
Member
Member


Joined: 2005 Mar 03
Location: Germany
Online Status: Offline
Posts: 114
Direct Link To This Post Posted: 2011 Nov 24 at 10:50pm
as i understand it you want to change the current frame number while rendering in the picture viewer?
That won't be possible. The PV renders the specified frame sequence, you can't tell him while rendering to start over and render a different frame while it is still executing the sequence

you would need to start the rendering yourself for every single frame, you can't start a sequence rendering of 30 frames and expect it to render 100 frames because of a tag that changes the frame time

Edited by affa - 2011 Nov 24 at 10:52pm
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1143
Direct Link To This Post Posted: 2011 Nov 25 at 12:17am
I'll just add a precision to what affa said.

When rendering a sequence, it keeps moving forward even if you change the frame number but calculates the new frame with the frame you changed to.
For example at frame 53, you change the current frame to 52, it calculates frame 53 with the data at frame 52. At frame 54, you change the current frame to 52, it calculates frame 54 with the data at frame 52. etc.

MAXON
Developer Support
Back to Top
evanbbb View Drop Down
Member
Member
Avatar

Joined: 2010 Oct 13
Online Status: Offline
Posts: 11
Direct Link To This Post Posted: 2011 Nov 25 at 2:21am
I thought that might be the case. Is there any way to keep the motion blur on an object while rendering from different angles?

So I have the blur occurring at a certain density by animating my object over a few frames. Now I want to re-render that blur from a different angle. At the moment I have a rig of 30 cameras and I render each one individually. Bit of a pain to set up and change. Any thoughts?
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.141 seconds.