[Closed] Having an issue with camera facing and rendering
Hey all.
I made a camera facing script for rendering large crowds. Everything looks great in the view port, and when I make previews. However when I render my objects they are not camera facing. I'm thinking it has something to do with how max processes objects to render. I figured if it was a script controller I wouldn't run into this kind of an issue.
A little Background:
I'm rendering a huge background of characters for a scene, so I have the B.G. characters as animated textures on planes. The camera does sweeping pans so I want the planes to be camera facing. I know I could have used a look at constraint but I wanted this to be automated as possible. I just run a script and the crowd is camera facing to which ever camera view I am in (I have multiple cameras). I could always create a camera picker and switch between different look at targets but I wanted something a little more elegant. I used a rotation_script controller that calls a function from a custom attribute on each plane. The function calculates and returns the correct rotation for each plane based on which ever camera view its in.
- Thanks in advance!
- Alex
Well,
I decided it was worth the effort to just change what I was doing. I’m using a orient constraint and have a master control for all my cards that controls which camera they “Face”. I really do want to know why the rotation didn’t update during render. I guess I could have made my own render script that rendered each frame individually, that would have just taken longer though.
Do you by any change use “slidertime” in your script. This is a variable that gives back the currenttime but only in interactive sessions like viewport or preview. if so instead use currenttime, this variable is also evaluated on rendertime.
-Johan
Johan,
Thanks for the reply. I actual don’t use either. I have a function that gets the transform of the view port, and the transform of a each plane, and calculate a new matrix and return the rotation value from it. The function is in a custom attribute on each plane. I call that function from a rotation script controller. Maybe I better use the currenttime value in the script some how to get the render to work?
-Thanks!
-Alex
I don’t know if that will help, you say you use a function to get the viewport tm, is that a gw function? I don’t think they work on rendertime:
These methods are for use in the existing 3ds Max viewports, and only work on the active viewport. Note that these methods typically are not for casual use, as they are not intended to be a high level graphics library. For example, many steps are required to display a single lit polygon. These methods are optimized for speed, and not at all for script programmer ease of use.
Maybe that’s the problem and you should get the camera’s tm?
Stabbing in the dark without some sample code/details.
-Johan
Johan,
I am using the gw functions to get the viewport transform. I thought this would be the easiest route. I wouldn’t need to figure out which camera was active (I guess I’m trying to make things to easy LOL). The code is really basic its more or less from the maxscript help (I think its was from aligning a gizmo to a normal). I’m going to try and get the transform directly from the camera instead of the viewport and see if that helps.
Thanks!
Alex
Johan,
Getting the transform from the camera worked. Now I’m going to see which view is active and select that camera at render time.
Thanks for help! It was the gw functions, they don’t update for render time.
Alex