View Full Version : How to get active camera in #prerender callback ?
04-06-2009, 11:38 AM
I have to make some scenechanges depending on which camera gets currently rendered. Whats the quickest way to get the this active camera in a #prerender callback ?
This should work in netrender, should respect the render dialog lockbutton, should work with scripted "render camera" commands etc...
It's really strange that there is no easy property somewhere to get the currently rendered camera (since it's not always the activeViewport ). There are several functions scattered all arround in maxscript which will help, but some of them are Max 2009 and up only and i want to keep some sort of backward compatibility
Any tips for me - please ? :wavey:
04-06-2009, 01:02 PM
There was a previous topic on this for the more generic "how do I find out what view is being rendered" a la the drop-down in the render scene dialog.. which I think was unresolved; but CGTalk's Search function seems to be having issues at the moment. In the API/SDK this seems to be Interface8::GetRendCamNode()
Edit 2: Let's try that again. Added in 3ds max 2009, some functions that help, but not when using the MaxScript render() command:
if (rendUseActiveView) then ( renderView = viewport.activeViewport )
else ( renderView = rendViewIndex )
Unfortunately, the callbacks themselves offer no information about what camera is being used to render with. #preRenderFrame contains the camToWorld and worldToCam matrices, from which you could derive which camera is being used (presuming you don't have 2 cameras in the exact same spot; or at least with the same transform) - but #preRenderFrame is 'too late' for changing most settings anyway.
For a netrender job, if a camera -is- used, you could extract that information from the job (file) itself I believe; <job>.renderCamera , so the help file says.
If you could force users to use batch render, batchRenderViewOps.camera seems to serve the same purpose.
04-06-2009, 02:25 PM
thx richard :) - so you help again :bowdown:
so my initial thought of "no direct and easy way" seems right, and i have to jump through hoops for such a basic & essential thing....
thx a lot - i will search for the thread you mentioned....
04-06-2009, 02:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.