[Closed] Replace "Render button/max quick render" sequence with custom function?
I’m a bit off topic here…coz I do things in MCGs rather than mxs…
I animate something that is not animatable by creating a ‘dummy’ MCG object, checking a dummy value that IS animatable every frame and interp that to the non-animatable parameter…this is seen with my AniFake:
http://www.scriptspot.com/3ds-max/mcg/mcg-anifake
It does On/Off only…but there’s absolutely no reason why it can’t do values 1,2,3 => X,Y,Z
So I don’t see why it’s not possible with a dummy piece of mxs instead of MCG…but I doubt very much you want to take the approach of ‘injecting’ a piece of mxs into a file somehow…just sounds too dodgy…
Actually, setting up something like that using Maxscript is exactly what I want to do.
Vusta: I haven’t actually tried using AniFake yet, and the video doesn’t show one way or another… Does it work for rendering, or only moving the time slider? Because the rendering is the thing I’m having an issue with…
because a user asked if VisibleToCamera could be animated…it’s not, as it’s only On or Off, but he used my MCG for network rendering and I think it has worked…i’ll try and dig up the thread for you…
here…
http://forums.cgsociety.org/showthread.php?f=6&t=1436924
the last video shows the effect of rendering at different frames ‘as if’ the VisToCamera was animated
So this does only VisToCam…then I thought why not do a general case with AniFake…
also for multiple objects
So for my case, I went in and keyframed an animatable value in the MCG object…then at each frame the MCG is eval…it interps the value to something the user wants…some checkbox On/Off whatever…
Have you tried rendering multiple frames at a time though? That’s where I’m running into trouble. Any non-animated properties are checked once before a render begins, and any changes made to them frame-to-frame are discounted. I’m guessing that how those changes are made probably doesn’t make a difference…
no, I’ll probably have to stand and think about this…(…I work STANDING up, not a single chair in the house)
Andres: what version of Max are you using? I’m not getting the bug you mentioned.
Also, not entirely sure I understand what you mean by the second part.
Hi Kevin. You are making me work!
I was working in 3dsMax Design 2014. I confirm this is the (bad) behavior.
Now, trying in 3dsMax 2016, I see this works fine.
But for the render, just the same behavior: if I render the whole range from the first frame with a key (#1 in 2014, #0 in 2016) AND with the ‘timeSlider’ positioned in this starting frame, the render is OK (each image renders with the appropriate shadow).
If the ‘timeSlider’ is in another frame, the render gives me images with the same initial shadow or black images.
I made a few changes, and I’ve got something that is working for me. If anyone has any problems with it on their version of Max, please let me know.
Beyond that this is strictly proof-of-concept. There’s a bunch I’ll be changing before putting it to any serious use.
global renderLights = #()
-- Create custom attributes
CA_LIGHTS_CTRL = attributes CA_LIGHTS_CTRL attribID:#(0, 0) (
parameters params rollout:params (
id type:#integer default:1 animatable:on ui:lightID
)
rollout params "Lights Control" (
radiobuttons lightID "Light ID" labels:#("1", "2", "3", "4", "5")
)
)
-- Create temporary lights before render
fn CreateRenderLights lit = (
L1 = copy lit; L1.name = "L1"; L1.shadowGenerator = (Adv__Ray_Traced())
L2 = copy lit; L2.name = "L2"; L2.shadowGenerator = (mental_ray_Shadow_Map())
L3 = copy lit; L3.name = "L3"; L3.shadowGenerator = (Area_Shadows())
L4 = copy lit; L4.name = "L4"; L4.shadowGenerator = (shadowMap())
L5 = copy lit; L5.name = "L5"; L5.shadowGenerator = (raytraceShadow())
renderLights = #(L1, L2, L3, L4, L5)
lit.enabled = false
for i in renderLights do i.enabled = true
)
-- Remove temporary lights after render
fn RemoveRenderLights lit = (
delete renderLights
lit.enabled = true
)
(
delete objects
max modify mode
ca = createInstance CA_LIGHTS_CTRL
-- Create control object
ctrl = point pos:[0,0,100] box:on cross:off
append ctrl.baseObject.custAttributes ca
-- Create light
global lit = omniLight pos:ctrl.pos castShadows:on parent:ctrl isFrozen:true
-- Create hack object
-- Max needs the CA to be attached to a renderable object, or it will be ignored for renders.
-- Setting it to a size of 0 makes it invisible.
hack = geosphere segs:1 baseType:1 pos:[0,0,100] radius:0 parent:ctrl isFrozen:true
append hack.baseObject.custAttributes ca
-- Set script expression
scr = hack.visibility = float_script()
hack.visibility.controller = scr
scr.addNode "me" hack
expr = "for j = 1 to renderLights.count do try (
"
expr += " renderLights[j].enabled = me.id == j
"
expr += " renderLights[j].ishidden = me.id != j
"
expr += ") catch()
"
expr += "1"
scr.setExpression expr
-- Set callbacks
callbacks.removeScripts id:#test
callbacks.addScript #preRender "CreateRenderLights lit
" id:#test
callbacks.addScript #postRender "RemoveRenderLights lit" id:#test
-- Set up scene
plane length:50 width:150 lengthsegs:1 widthsegs:1 wirecolor:white isselected:true
box()
with animate on (
at time 0 ctrl.pos.x = -100
at time 100 ctrl.pos.x = 100
for j = 100 to 0 by (random -5 -10) do at time j hack.id = random 1 5
)
completeredraw()
select ctrl
)