|
|||||
|
|
#1 |
|
Registered User
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
How to execute MAX Script on every frame at render time ? - please advise
Hello All !
I wonder if somebody would be so kind as to point me closer to the solution of the particular MAX Script issue I have. Using Max 6, I need a precise control over a video file bitmap starttime property (found in "Time" rollout of the Material editor). That property is not animatable directly in Max 6 , so I wrote a tiny script that manages what I want to achieve, but only at viewport level.Here's a script : ************************************* unRegisterTimeCallback startFrame_add fn startFrame_add = ( if mod sliderTime 100 == 0 then ( meditMaterials[1].material1.diffuseMap.starttime += 25 ) ) registerTimeCallback startFrame_add ************************************* I know it's very crude, but as said - it works as a "proof of concept". What it does is : Every 100 frames the start time (offset) of a video file placed in difussion channel of my object material is set back by 25 frames. I won't bore anybody explaining just why do I need such effect, suffice to say the script above works, but just in the viewports. It does not execute at render time, however ![]() I know I am missing something vital to do with a different type of callback mechanism, but after trying out several routes I am none the wiser still ... Can anybody think of how to implement a script that will have the same result, but at reder time ? (And before anybody suggests to edit my source Video file in the first place prior to using it in Diffuse channel - Thank you, but it would be very unpractical in my case as I need to use several varying segments of it with different delays) Your help will be much appreciated ! Thank you. |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
Hi
I hope I understand the problem correctly, here's a solution that could work... if you haven't already tried it ![]() You could use the "general event callback" from Max; #postRenderFrame: callbacks.addScript #postRenderFrame "startFrame_add()" id:#MyCallBack According to MaxScript reference, this callback will is sent after each frame is rendered. So the function "startFrame_add" will be called after each frame is done rendering. I haven't tried that particular callback, so I dont know if it's gonna work... Good luck ![]() Oh and, you might wanna kill the callback when you close your script or something... (callbacks.removeScripts id:#MyCallBack) Hope this helps... |
|
|
|
|
|
#3 |
|
Registered User
Join Date: Mar 2004
Location: UK & Canada
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
|
why dont you call the fn on each frame, then render each frame sequencially using a for loop? then load the frames into the video post and render out as a movie etc?
__________________
Please leave a message after the beep... Snr Technical Animator Bioware Corp, Canada |
|
|
|
|
|
#4 |
|
Registered User
|
I used for loop generate keys.
![]() Code:
deleteKeys meditMaterials[1].diffuse.controller /*Delete diffuse color keyframes at Slot1 material if applicable*/ delete $* /*Delete everything on scene*/ b = box() /*Create box*/ b.material = meditMaterials[1] /*Assign Slot1 material to box*/ animate on ( for i=0 to 100 by 10 do /*Create key at every 10th frame within 100 frames*/ ( at time i ( --Generate random color meditMaterials[1].diffuse.r = (random 0 255) meditMaterials[1].diffuse.g = (random 0 255) meditMaterials[1].diffuse.b = (random 0 255) ) ) ) Last edited by MaggieQue; 20-04-2007 at 04:35 AM.. |
|
|
|
|
|
#5 | |
|
Registered User
|
Quote:
meditMaterials[1].diffuseMap.starttime = 9f meditMaterials[1].diffuseMap.playBackRate = 2 meditMaterials[1].diffuseMap.endCondition = 0 --0:Loop, 2:Ping Pong, 3:Hold |
|
|
|
|
|
|
#6 |
|
Registered User
|
u could try this little funny script:
Code:
s = sphere() for i = 0 to 100 do ( sliderTime = i s.radius = currentTime ) And I learnt this from maxscript reference file: Code:
s = Sphere() s.radius.controller = Float_Script() s.radius.controller.script = "currentTime" Correct me if I'm wrong. Last edited by MaggieQue; 09-05-2007 at 11:29 AM.. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|