capturing the view from a second camera

Ask a Question related to Macromedia Director 3D, Design and Development.

  1. #1

    Default capturing the view from a second camera

    hello;

    if I add a new camera to my world how do I capture what it sees;

    thanks
    dsdsdsdsd
    dsdsdsdsd Guest

  2. Similar Questions and Discussions

    1. camera.get for an outdoor camera ( not a webcam )
      hello; I would like to install an outdoor camera which has its own built-in server; I want the video capture to be delivered to a client-side...
    2. Capturing a Camera using Flash Communication Server
      Dear All, I am developing an aplication on streaming a live video from a WebCam on to a webpage. There are many cameras in the network. But they...
    3. Camera zooming, general 3D model view interaction
      hello i'm working on a viewer for 3D models. the possibilities of interaction are: - zooming by moving RMB - orbiting by moving LMB -...
    4. multiply camera view-is it possible?
      how can i see , on the stage, at the time, two points of view, of two different cameras, moving in the same 3d world? I have some idea that includs...
  3. #2

    Default Re: capturing the view from a second camera

    Look up addCamera() and rect (camera). You must set the rect of an added camera to something other than the default rect(0, 0, 1 ,1)
    openspark Guest

  4. #3

    Default Re: capturing the view from a second camera

    hello openspark; thanks for responding;

    I am wondering how I capture what the camera sees;
    I have read the manual with respect to the camera, but it does not mention how
    to make use of the camera;

    any thoughts;

    thanks
    Shannon Burnett

    dsdsdsdsd Guest

  5. #4

    Default Re: capturing the view from a second camera

    let me explain what I wish to do:

    I wish to put a new camera "behind" a mirror (model with shader and texture )
    and to show the camera's view on the surface of the mirror;

    does this seem reasonable?

    thanks
    Shannon Burnett

    dsdsdsdsd Guest

  6. #5

    Default Re: capturing the view from a second camera

    Here's a behavior that you can drop on an empty 3D sprite. It creates a cube
    in front of the main camera and a sphere behind. It creats a second 'rear-view
    mirrir" camera to look backwards, and display the sphere.

    on beginSprite(me)
    tSprite = sprite(me.spriteNum)
    tMember = tSprite.member
    tMember.resetWorld()

    tCamera = tMember.newCamera("Rear-view mirror")
    -- Add to the list of cameras for the sprite
    tSprite.addCamera(tCamera, 2)

    -- Give the insert a different background color
    tCamera.colorBuffer.clearValue = rgb(51, 51, 51)
    -- Place insert at center of top of sprite
    tCamera.rect = rect(80, 10, 240, 50)

    -- Move this camera with the main camera...
    tSprite.camera.addChild(tCamera, #preserveParent)
    tCamera.rotate(0, 180, 0) -- ... but facing in the reverse direction

    -- Create a model in front of the main camera...
    tResource = tMember.newModelResource("Box", #box)
    tModel = tMember.newModel("Box", tResource) -- at center of world

    -- ... and another model behind the main camera
    tResource = tMember.newModelResource("Sphere", #sphere)
    tModel = tMember.newModel("Sphere", tResource)
    tModel.worldPosition = vector(0, 0, 500)
    end

    Is this the sort of thing that you are trying to do?

    To create the effect of a mirror, you should place the mirror camera at the
    position where the main camera would appear reflected in the mirror. You
    should also change the mirror camera's projectionAngle depending on the
    distance the main camera is from the mirror: the closer it is to the mirror,
    the wider the angle should be, so that the camera frustrum includes all the
    objects that the main camera would see in the mirror.

    An interesting project.

    openspark Guest

  7. #6

    Default Re: capturing the view from a second camera

    Originally posted by: Shannon Burnett
    I wish to put a new camera "behind" a mirror (model with shader and texture )
    and to show the camera's view on the surface of the mirror;

    does this seem reasonable?

    Hi Shannon,
    Just create the second camera and tune up its position, rotation and FOV.
    Also you have to change the rect of the W3D member (default :
    rect(0,0,320,200)) according to your needed texture size (64x64, 128x128, etc).
    After that, at runtime, all you have to do is to switch the camera and to
    create a new texture #fromCastMember, using the W3D member as source.
    At the end, restore the default camera.

    But keep in mind: this kind of runtime created textures are frame rate killers
    !
    So if you need my advice: no mirrors in shockwave !
    LOL



    necromanthus Guest

  8. #7

    Default Re: capturing the view from a second camera

    openspark, thanks for your response;

    however this is not quite right; imagine that I 'capture' the Rear-view
    mirror's view and transfer that view to a texture residing on a model;


    necromanthus, thanks for your response also;
    I thought that I was correct using
    image_object = copypixel( new_camera , (a,b,c,d) , new_camera.rect )
    then
    my_texture = the_world.newtexture( ... , #fromimageobject , image_object )


    any thoughts,
    Shannon Burnett


    dsdsdsdsd Guest

  9. #8

    Default Re: capturing the view from a second camera

    Originally posted by: Shannon Burnett
    necromanthus, thanks for your response also;
    I thought that I was correct using
    image_object = copypixel( new_camera , (a,b,c,d) , new_camera.rect )
    then
    my_texture = the_world.newtexture( ... , #fromimageobject , image_object )

    Avoid using copyPixels at runtime (because the frame rate is going down
    deeply).
    The method I gave you works a little bit faster.
    But obviously not enough faster for shockwave ...
    Anyway, if you really want to emulate a mirror in SW3D (keeping a decent frame
    rate), use the algorithm I gave you.
    Also, do NOTcreate textures bigger than 64x64 !
    If you need badly a higher resolution, use a simple skip few frames routine
    and create a new texture after a sequence of (let's say) 5 frames.
    Try to do your best.



    necromanthus Guest

  10. #9

    Default Re: capturing the view from a second camera

    necromanthus, thanks again;

    unfortunately I am unable to make heads or tails of this;

    but I do appreciate your time;

    Shannon Burnett
    dsdsdsdsd Guest

  11. #10

    Default Re: capturing the view from a second camera

    Originally posted by: Shannon Burnett
    necromanthus, thanks again;
    unfortunately I am unable to make heads or tails of this

    I see ... is not so simple to transpose an algorithm into LINGO, isn't it ?
    But because you're a nice person, download and study this example:
    [url]http://necromanthus.com/Games/ShockWave/tutorials/Mirror.html[/url]
    note: the tricky part is that you don't need the second camera !



    necromanthus Guest

  12. #11

    Default Re: capturing the view from a second camera

    necromanthus wrote:
    > But because you're a nice person, download and study this example:
    > [url]http://necromanthus.com/Games/ShockWave/tutorials/Mirror.html[/url]
    > note: the tricky part is that you don't need the second camera !
    Nice. Do you intend to keep that page up long term. I've already downloaded the
    file for future reference perhaps for my students. Can I link to your site? Will
    you be increasing the amount of demos?:)

    regards
    Dean

    Director Lecturer / Consultant
    [url]http://www.fbe.unsw.edu.au/learning/director[/url]
    [url]http://www.multimediacreative.com.au[/url]

    Dean Utian Guest

  13. #12

    Default Re: capturing the view from a second camera

    Originally posted by: Dean Utian
    Nice. Do you intend to keep that page up long term. I've already downloaded the
    file for future reference perhaps for my students. Can I link to your site?
    Will
    you be increasing the amount of demos?:)

    Hi Dean,
    Yes. That's a permanent link (like this one:
    [url]http://necromanthus.com/Games/ShockWave/tutorials/PanCamera.html[/url] )
    Feel free to link to [url]http://necromanthus.com[/url] (you may use this button:
    [url]http://necromanthus.com/Images/necro_88x31.gif[/url] )
    As I said some time ago, I intend to open a ShockWave subdomain on my site
    (containing many interesting SW examples and tutorials).
    But I need a reason to do that.
    And here is the reason: Adobe MUST update (and improve) the SW3D engine.
    Otherwise, I can't waste my time for nothing.
    So ... it's up to Adobe !

    p.s.
    Someone told me about the increased number of machine guns in australian
    schools.
    ha ha ha


    best regards

    necromanthus Guest

  14. #13

    Default Re: capturing the view from a second camera

    Hi necromanthus.

    I am interesting in the mirror script you have uploaded and have attempted to
    add it to my game code. I have added an object called mirror but I get the
    error message
    object expected
    for this line
    w.newTexture("mir",#fromCastMember,member("3D"))

    3D is the name of my 3D sprite.

    Have I missed something very obvious lol?

    Thanks

    Michael

    Michaelcov Guest

  15. #14

    Default Re: capturing the view from a second camera

    Originally posted by: Michaelcov
    I am interesting in the mirror script you have uploaded and have attempted to
    add it to my game code. I have added an object called mirror but I get the
    error message
    object expected
    for this line
    w.newTexture("mir",#fromCastMember,member("3D"))

    3D is the name of my 3D sprite.

    Have I missed something very obvious lol?

    Hi Michael,
    Don't forget to declare the global 'w' variable in the MovieScript 'init' !
    p.s.
    But don't waste your time anymore.
    As I said before: this kind of runtime created textures are frame rate killers.
    This example is for didactical purposes only.
    Can't be used in a serious project (containing a bunch of polygons and tons of
    LINGO).
    cheers



    necromanthus Guest

  16. #15

    Default Re: capturing the view from a second camera

    Ok, I won't try mirrors. Advice taken :)

    Michael
    Michaelcov Guest

Posting Permissions

  • You may not post new threads
  • You may 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