TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 14 of 14

Thread: Tutorial [T2 NewDark] Camera Overlay On Demand

  1. #1
    Registered: Sep 2000
    Location: Lexington, KY

    Tutorial [T2 NewDark] Camera Overlay On Demand

    This is a quick guide for making a camera overlay that you can turn on and off on demand. I am using NewDark 1.25 and NVScript 1.26 to achieve this effect, make sure your Dark version is up to date and that NVScript is loaded into your mission. Skip down to the video to see the end result of this tutorial.

    1. Create a new Meta Property in the object hierarchy, let's call it CamOverlay. Add Renderer -> Camera Overlay. Edit the properties as follows:
    Active: [TRUE]
    Bitmap Scale Mode: [Scale to fit screen]
    Filter Color: (This can be whatever color you want, I am using 240,5,5 for a red overlay.)
    Alpha: (I recommend a value between 10 and 100, depending on how much you want to limit player vision with the overlay on.)
    (The rest of the fields are unused for this demo, but you can use them for bitmap overlays, I will reference the instructions at the end of this guide.)

    2. Save your gamesys to ensure the Meta Property remains in the hierarchy.

    3. Create the following items nearby:
    One (1) fnord -> Marker, One (1) fnord -> TrapTrig -> Inverter, Two (2) physical -> Gizmo -> Switches -> Buttons -> Button.

    4. Edit each Button's properties:
    Name one button OverlayOn and the other button OverlayOff for the purpose of this tutorial. You can call them whatever you like for your own tasks.

    5. Edit the Marker's properties:
    Change the name of the marker to OverlayTrap for the purpose of this tutorial.
    Add S -> Scripts and set Script 0 to NVMetaTrap.
    Add Editor -> Design Note and add the following text:NVMetaTrapOn="TurnOn";NVMetaTrapOff="TurnOff";NVMetaTrapMeta="CamOverlay";NVMetaTrapTarget="&ControlDevice"
    Note that the name in NVMetaTrapMeta must be the exact name you used for your custom Meta Property.

    6. Create the following object links:
    A. ControlDevice from Button 'OverlayOn' to the Marker 'OverlayTrap'.
    B. ControlDevice from Button 'OverlayOff' to the Inverter.
    C. ControlDevice from Inverter to Marker 'OverlayTrap'.
    D. ControlDevice from Marker 'OverlayTrap' to Garrett. (Note: You must link this to Garrett(-2099), linking to the starting point does not work].

    7. All done! Save your mission and enjoy. This is the result.

    You can also place the buttons in a blue room or anywhere outside the playable area, and trigger them with other events within your mission. For example; a bounds trigger that creates an overlay when the player enters a specific area, etc.

    NVMetaTrap is vital for this setup. Essentially you are sending a TurnOn message to the Trap with one button to add the overlay Meta Property, and sending a TurnOff message to the trap via an Inverter with the second button to remove the overlay Meta Property. If not for the custom script it would require S&R's or conversations to achieve the same effect. It's late and I'm past due for bed, hopefully I didn't miss anything, if so I will correct it tomorrow. Cheers taffers!

    P.S. Here are the instructions for different ways you can use Renderer -> Camera Overlay:
    New Prop: Renderer->"Camera Overlay"
    The property can be assigned to objects that have, or can have, a camera attached to have a custom camera overlay
    rendered while the camera is attached to it. The object could be the player, or for example a scouting orb. If
    the "Camera Overlay" is active it will override any default overlay of the game. In other words if a custom overlay
    is set on scouting orb, it will be used instead of the default overlay effects for it.
    An overlay can either be a color tint on the entire screen, like the coloring when the player is under water, or
    a bitmap. For example a black bitmap with two holes "cut out" in the alpha channel to get a viewing-through-
    binoculars effect.
    The bitmap is loaded from the "BITMAP" dir, like with bitmap particles, except it can either be a single texture
    with one image file in "BITMAP" or it can be an animated bitmap with numbered files in "BITMAP\txt" or "txt16".
    In order to deal with different display aspect ratios when using a bitmap overlay, there are following scale modes:
        "Scale to fit screen"      - Bitmap is scaled to cover the entire screen, shapes will look stretched/squished
                                     depending on if viewed on 16:9 or 4:3.
        "Fit 4:3, mask w. color"   - The bitmap is treated as a 4:3 image (regardless of its actual dimensions) and
                                     is scaled to fit screen while maintaining the 4:3 ratio, the empty areas on the
                                     sides on widescreen displays will be filled using the specified "Mask color".
        "Fit 4:3, mask w. edge"    - Same as above except that instead of filling the sides with the mask color, it
                                     uses the edge pixels of the bitmap and stretches them outward.
        "Crop 16:9, mask w. color" - The bitmap is treated as a 16:9 image, and if the display aspect ratio is
                                     narrower the image will be cropped, down to 4:3 at most (the bitmap should be
                                     created so that it looks ok when cropped to 4:3, but giving 16:9 user a little
                                     extra fluff). In the unlikely event that masking is required, it's done the
                                     same way as "Fit 4:3, mask w. color".
        "Crop 16:9, mask w. edge"  - Same as above except masking is done like "Fit 4:3, mask w. edge".
    If the bitmap object has multiple frames the animation rate is set with "Ani frame time (ms)" as the duration, in
    milliseconds, per frame. A value of 0 disables animation.
    The "Filter color" is multiplied with the bitmap, so if the bitmap is black it has no effect, if it's white it will
    end up using the filter color as is. If no bitmap is used, the filter color is used as the tint color for the entire
    "Alpha" sets the overall transparency, including any masking areas. Setting alpha to 0 will skip overlay drawing
    and can be used if you want to disable a native overlay without wasting any rendering time.

  2. #2
    Registered: Sep 1999
    Location: Portland, OR
    oh wow I wish I didn't have to head to bed! This is awesome thank you!

  3. #3
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    We used a colored overlay in Godbreaker m4 when you're invisible from using the talisman, and in both missions 2 and 4 when using the crystal ball. It's a great effect and could be used a lot more. I was just thinking watching this that you could add the red overlay for 1/2 - 1 second each time the player takes damage, or a green overlay if they're poisoned. Not suitable for just any mission perhaps, but it would be cool.

  4. #4
    Registered: Jul 2010
    Location: Le Havre (France, 76)
    It would be nice if there could be a system of ''render area'' which use LUT's Table to the camera to create some different color ambiances.

  5. #5
    Registered: Jan 2012
    Location: Gèrmany
    Thanks a lot. I always have to start at the basics again when thinking about the camera (overlay). Good to have that post

    But sorry I have to throw in some of my opinions.

    a) You can trigger(link to) the MetaTrap/Inverter directly. No need for any blue room button as relay in between.
    Especially in a direct TurnOn/Off situation like RoomEnter/Exit you want to relay the TurnOff directly as well.

    b) NVMetaTrapOn="TurnOn";NVMetaTrapOff="TurnOff"
    I think it's good to point out that option exists as you can for example use stuff like "PhysEnter" or "FrobWorldEnd" and save extra script objects. But as TurnOn,Off are the standard parameters there is no need to extra write them.

    c) NVMetaTrapTarget=player
    should work. And saves the Garrett link

  6. #6
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    He used the buttons to demonstrate the effect, I don't think he was suggesting that it would typically be implemented that way in a mission. Your other two points are spot on, though.

  7. #7
    Registered: Sep 2000
    Location: Lexington, KY
    Those are good points Daraan. This is basically just a dumbed down example version of what I have built in my mission, which uses buttons disguised as other objects that the player must frob. But you definitely could activate it directly without the use of buttons. And you could use the same steps to add other properties to the player instead of a camera overlay.

    Le MAlin, I think you could achieve that using bitmaps instead of a solid color, I will do some experiments and post the results.

    Yandros, I remembered reading that you did some of that in Godbreaker, but I'm still on mission #2 and didn't want to dig that far ahead just yet.

  8. #8
    Registered: Jan 2001
    Location: Formby, NW England
    Quote Originally Posted by Daraan View Post
    This should be NVMetaTrapTarget="Player" because in game that's an ordinary object name. It's not case sensitive but I like using a capital P.

  9. #9
    Registered: Sep 2000
    Location: Lexington, KY
    Quote Originally Posted by R Soul View Post
    This should be NVMetaTrapTarget="Player" because in game that's an ordinary object name. It's not case sensitive but I like using a capital P.
    Any advantages or pitfalls of using "Player" versus the "Garrett" archetype? I assume Player refers to the concrete player object generated when the game starts and Garrett refers to just the base archetype, so what issues could arise using one or the other...?

  10. #10
    Registered: Sep 2000
    Location: ZylonBane
    You can also just do this with a Squirrel script:
    class playerOverlay extends SqRootScript {
    	function OnTurnOn() {
    		Property.Set("Player", "CameraOverlay", "Filter color", "255, 255, 0");
    		Property.Set("Player", "CameraOverlay", "Alpha", 25);
    	function OnTurnOff() {
    		Property.Remove("Player", "CameraOverlay");
    Last edited by ZylonBane; 27th Jan 2018 at 17:10.

  11. #11
    Registered: Mar 2005
    Location: The Inverted Manse
    I posted a tutorial for a similar effect a few years ago:
    My method uses a custom object.

    Here's a video of the effect used in the mission (sliding netween two colours during the "travel back in time" section):

  12. #12
    Registered: Sep 2000
    Location: ZylonBane
    Yes, but that method for screen tinting is now obsolete.

  13. #13
    Registered: Jan 2001
    Location: Formby, NW England
    Quote Originally Posted by Phantom View Post
    Any advantages or pitfalls of using "Player" versus the "Garrett" archetype?
    I don't think there's a technical advantage, but in this case you're giving yourself an extra step for no benefit. NVMetaTrap targets its own object by default. Making it use CD links requires changing the target, but if you're going to do that you may as well give it the name of the only object this can possibly need.

    For other uses of this script, targeting CD links is useful if you want multiple targets.

  14. #14
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    NVMetaTrapMeta="FrobInert"; NVMetaTrapTarget="@Treasure";

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts