Forum rules - please read before posting.

Main Camera render at specific framerate

Hey again,

As the title says, i'd like to render the main camera at a specific frame rate. 

The question that has already been posted, but the link doesn't work:
https://adventurecreator.org/forum/discussion/7523/render-camera-not-application-at-lower-framerate


Comments

  • This isn't an AC-specific issue.  Though the script you rely on will need to go on AC's MainCamera, it shouldn't have to rely on any AC code.

    I would recommend first finding a technique that works outside of AC (i.e. in a test scene with no AC scripts or prefabs), and then look into having it work with AC.
  • @calli

    Try this: http://pasteall.org/983994

    Have a maincamera that's culled to nothing just to raycast hotspots, mouseclicks/hovers. Then I have that script that goes onto the rendering camera, then the rendertexture goes into the rawimage, then the raw image goes either onto the screen overlay or a third camera that projects the rawimage into screenspace so you can add your camera post-process effects.

    Or, if you don't mind everything getting a lower framerate, put this on a gameobject in your scene: http://pasteall.org/1284373

  • Hey @zebbi! Thanks so much for the help - it worked!

    Now only issue is that the camera that renders to the render texture has a Field of View that is independent from the main AC camera.

    So I use this script to copy the Field of View to the texture rendering cam.
    http://pasteall.org/1405174

    Unfortunately, there is a jittery effect as there's a a few frames delay before it copies the Field of View.

    Any idea how to make sure it's copied instantly?

  • @calli: Use Update instead of FixedUpdate.

  • @calli no problem! That took many weeks of extracting ideas from various sources and a few people with genius way beyond my scope to get something that actually works! :D I might actually put it in the wiki in case it's of any use to anyone, even though it isn't specifically AC related and I'll keep your tweaks in mind for it! I think

    I might be too stupid to figure it out, but I'm using multiple cameras to display 3D skyboxes ie: city buildings that move/rotate relative to the player at a divisional speed, and it seemed difficult to get this rendertexture method working with multiple cameras.

    Anyways, I know this post isn't AC related, but I'm glad it worked for you!

  • @ChrisIceBox Unfortunately there is still that delay, even when I disable every other camera image effect and scripts.

    I'm trying to write it as a custom action to change the FOV right now (might take me a while), but I'm not sure it will work either. Any reasons why the FOV change would be delayed?

  • I'm not clear on what you've assigned as your two cameras in the script. What are "cam" and "cam2"?

    You could also try "LateUpdate", but it may even be a case of modifying the script's Script Execution Order to either -100 or +100 to force the execution relative to AC itself.

  • Yes, LateUpdate worked like a charm thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.