Professional Web Applications Themes

Amateur needs help with film grain effect - Macromedia Director 3D

Hey all, Doing a third year project designing a level of a game that is aiming to mirror a 1940's film noir movie (basically). I was wondering could anyone give me an idea on how I would apply a film grain effect overlay to the camera, to give the impression of noise or its old age (if that makes sense). Quite stuck with this and any help or idea's would be amazing. Thanks. The film grain obviously can't be a static transparency over the top. Cheers....

  1. #1

    Default Amateur needs help with film grain effect

    Hey all,
    Doing a third year project designing a level of a game that is aiming to
    mirror a 1940's film noir movie (basically). I was wondering could anyone give
    me an idea on how I would apply a film grain effect overlay to the camera, to
    give the impression of noise or its old age (if that makes sense). Quite stuck
    with this and any help or idea's would be amazing. Thanks. The film grain
    obviously can't be a static transparency over the top. Cheers.

    deancolt45 Guest

  2. #2

    Default Re: Amateur needs help with film grain effect

    The only way is swapping a 32-bit ovelay textures (with alpha) but in
    case of large frostrum it may be pretty slow...
    Ziggi Guest

  3. #3

    Default Re: Amateur needs help with film grain effect

    Cheers for the advice Ziggi, yeh that def does seem to be the only way to
    achieve what I need, i am not brilliant at lingo, so does anyone know how to
    alternate the images so that they create the illusion of noise, I have the
    following code in my setup camera as an overlay, how would i get them to come
    up randomly changing every second or so, I have just have two alpha images at
    the moment to test it, the images are named as "noise". Thanks any help would
    be brilliant!
    Existing Code

    on setup_camera


    G_world.camera(1).transform.position = G_PC.transform.position +
    vector(0,-0,60)

    G_world.camera(1).transform.rotation = vector(80,0,0)


    G_PC.addChild(member(1).camera(1))

    -----------------------------------------------------
    CODE FOR THE IMAGES--- Need to know how to alternate them in milliseconds


    t1 = member("librarymockupBW").newTexture("Rough",
    #fromCastMember,member("noise"))
    sprite(1).camera.addOverlay(t1, point(100,100), 0)

    t1 = member("librarymockupBW").newTexture("Rough2",
    #fromCastMember,member("noise2"))
    sprite(1).camera.addOverlay(t1, point(100,100), 0)


    end
    ------------------------------------------------



    deancolt45 Guest

  4. #4

    Default Re: Amateur needs help with film grain effect

    Hi Man,

    Sorry - no time for writting code, though it will be easy.
    Just an advice - if you need performance it's better to swap overlay's
    texture than to swap overlay texture image.

    I mean - the bottleneck is sending data from main memory (accessible to
    CPU) to graphics card memory (available to GPU). While texture resides
    in graphics card memory, it's image resides in main memory, so:

    3D_member.texture("the_texture").image

    is slow, while:

    3D_member.camera("the_camera").overlay[the_index].source

    is fast

    Consequently - it is better to prepare dozen of textures in advance and
    swap overlay source than prepare dozen of images and swap the texture image.

    Good luck!,
    Ziggi
    Ziggi Guest

  5. #5

    Default Re: Amateur needs help with film grain effect

    Here's how I made an effect that looks a little like what you might be looking
    for:

    1) I created a new movie
    2) I added a 3D member and placed it on the stage (320 x 240)
    3) In Photoshop, I created an image with a noisy alpha channel (256 x 256)
    4) I imported this image into Director, and called it "Noise"
    5) I attached the following behavior to the 3D sprite



    -- OVERLAY NOISE --

    property pCamera -- camera of the current 3D sprite
    property pRange -- integer number of offset positions
    property pHShift -- if TRUE, overlay shifts horizontally
    -- if FALSE overlay shifts vertically


    on beginSprite(me) -----------------------------------------------------
    -- ACTION: Creates an overlay using a texture created from a bitmap
    -- named "Noise"
    ----------------------------------------------------------------------

    vSprite = sprite(me.spriteNum)
    vMember = vSprite.member
    vMember.resetWorld()

    -- Create a texture from the "Noise" bitmap
    vName = "Noise" -- <HARD-CODED>
    vBitmap = member(vName)
    vTexture = vMember.newTexture(vName)
    vTexture.member = vBitmap

    -- Use it as an overlay
    pCamera = vSprite.camera
    pCamera.addOverlay(vTexture, point(0,0), 0)

    -- Ensure that the texture covers the entire sprite
    vScale = float(vSprite.width) / vTexture.width
    vTemp = float(vSprite.height) / vTexture.height

    if vScale < vTemp then
    vScale = vTemp
    pRange = 1 + (vTexture.width * vScale - vSprite.width)
    pHShift = TRUE

    else
    pRange = 1 + (vTexture.height * vScale - vSprite.height)
    pHShift = FALSE
    end if

    pCamera.overlay[1].scale = vScale
    end beginSprite



    on enterFrame(me) ------------------------------------------------------
    -- ACTION: Moves the overlay randomly
    ----------------------------------------------------------------------

    vRandom = -random(pRange) - 1
    if pHShift then
    vLoc = point(vRandom, 0)
    else
    vLoc = point(0, vRandom)
    end if

    pCamera.overlay[1].loc = vLoc
    end enterFrame

    openspark Guest

  6. #6

    Default Re: Amateur needs help with film grain effect

    Cheers for all the help guys, much appreciated and a very Merry Christmas to
    you all!!!! Still having a few issues, haven't been using lingo long and my
    syntax seems different in how I have learnt it, so I am unsure as to what
    handlers go where etc. would anyone be able to point me in the right direction
    of where to put the previous code from openspark. I just don't fully understand
    it all well enough and after trying for a couple of hours i realised i still
    need help. Here is an initial part of the script dealing with the basics, minus
    lighting, collision etc etc. Where would I put it within here and do i need to
    change existing handlers or add new ones? Sorry to be a nuisance with
    this....... THanks for your patience.

    Global G_World, G_PC
    Global G_move_rate, G_Rot_rate
    Global G_ray_height



    ----------------------------------------------------------------
    ----------------- Initial Setup
    ----------------------------------------------------------------


    on startmovie

    _movie.go(1) -- move the playback head to frame 1

    -- reset the 3D world in cast member 1
    member(1).resetworld()


    Setup_World -- set the initial parameters
    G_Shader = 0

    end

    on exitframe

    _movie.go(_movie.frame) -- loop around the current frame

    if keyPressed(123) then Rot_left
    if keyPressed(124) then Rot_right
    if keyPressed(126) then Move_Forward
    if keyPressed(125) then Move_Back

    check_ground
    PC_Collision_Check



    end


    on Setup_world

    --set the globals for the world an PC

    G_World = Member(1)
    G_PC = G_world.model("dean")


    -- set the initial movement rates

    G_move_rate = 20 -- walk rate
    G_Rot_rate = 2 -- turn angle


    G_ray_height = 90 -- the height for casting collision rays

    setup_camera
    ---Setup_lights

    on setup_camera

    --move the camera to the PC and offset it
    G_world.camera(1).transform.position = G_PC.transform.position +
    vector(0,-0,60)

    --adjust the viewing angle
    G_world.camera(1).transform.rotation = vector(80,0,0)




    -- attach the camera to the PC by making it a child object
    G_PC.addChild(member(1).camera(1))




    ---system milliseconds (look for example of davids last year)
    --Grain overlay---------
    -- t1 = member("Scene").newTexture("Rough", #fromCastMember,member("noise"))
    -- sprite(1).camera.addOverlay(t1, point(100,100), 0) ------overlay noise
    -------member("librarymockupBW").camera[1].addOverlay(t1, point(20, 20), 45)
    -- t1 = member("Scene").newTexture("Rough2",
    #fromCastMember,member("noise2"))
    -- sprite(1).camera.addOverlay(t1, point(100,100), 0)
    ----note textures wrong size

    end

    on reset_PC

    G_PC.transform.position = vector(-1000,100,100)

    end


    on move_Forward

    G_PC.translate(0,G_move_rate,0)

    end

    on move_Back

    G_PC.translate(0,-G_move_rate,0)

    end


    ---- Rotate-----

    on Rot_Left

    G_PC.rotate(0,0,G_Rot_rate)

    end


    on Rot_right

    G_PC.rotate(0,0,-G_Rot_rate)

    end



    deancolt45 Guest

  7. #7

    Default Re: Amateur needs help with film grain effect

    The code that James has written is a self-contained behavior script intended to
    do its thing independently of other scripts. Here is more info on his list of
    instructions

    1) I created a new movie [/ref]

    2) I added a 3D member and placed it on the stage (320 x 240) [/ref]

    3) In Photoshop, I created an image with a noisy alpha channel (256 x 256) [/ref]
    alpha for transparency. Create it in Photoshop and save as NOISE.PNG.

    4) I imported this image into Director, and called it "Noise" [/ref]
    relies on is finding in your cast a bitmap called 'Noise' (no quotes)

    5) I attached the following behavior to the 3D sprite. [/ref]
    the Property Inspector, make sure the Type is set to 'Behavior'. Close the
    script window and drag the script member from the cast window onto the 3D
    member in the score window. Play the movie

    hth

    johnAq


    johnAq Guest

Similar Threads

  1. Help an amateur!
    By Lee G in forum Web Design
    Replies: 0
    Last Post: January 26th, 10:40 AM
  2. Some of my amateur photography
    By Steve in forum Photography
    Replies: 2
    Last Post: November 10th, 12:03 AM
  3. Grain in films...
    By . in forum Photography
    Replies: 2
    Last Post: August 27th, 04:13 AM
  4. Digital Film / Silicon Film(tm) - for real ?
    By Ken Chandler in forum Photography
    Replies: 2
    Last Post: June 26th, 10:30 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139