Professional Web Applications Themes

3d textures from video - Macromedia Director 3D

Hi all, I would like to know if there is a method to create textures for 3d objects from a Video ( quicktime, avi, realvideo ) without to set the " directToStage = false "... so, to have fast video for textures. Hope somebody from you can help me ! Thanks and sorry for my english Mauro...

  1. #1

    Default 3d textures from video

    Hi all,
    I would like to know if there is a method to create textures for 3d objects
    from a Video ( quicktime, avi, realvideo ) without to set the " directToStage =
    false "... so, to have fast video for textures.
    Hope somebody from you can help me !
    Thanks and sorry for my english

    Mauro

    Boomy3D Guest

  2. #2

    Default Re: 3d textures from video

    [url]http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=268&threadid=1043371&highlig ht_key=y[/url]
    Ex Malterra Guest

  3. #3

    Default Re: 3d textures from video

    yes i know there are some tutorials.
    Btw my question is : is possible to use a video to create textures with " DTS = true" ( so the video can have a fast FPS ) ?

    Boomy3D Guest

  4. #4

    Default Re: 3d textures from video

    take a look at the chromelib for using realmedia as texture. it will work quite
    fast if you prepare the video to have a size like 128x128 for the video file.

    you dont need to put it on the stage. if your 3d world has a higher framerate
    then the video, you should use a timeout object to generate new textures,
    because it will generate on every exitframe a new texture from the video. i
    changed the code some minutes ago and included a timeoutobject that refreshes
    the texture every 40 millisiconds, and i still have a framerate of about 85 fps.



    hondo3000 Guest

  5. #5

    Default Re: 3d textures from video

    OK, that's what i want, btw my texture is a video of 512x512 pixels... i will check this option.
    Thank you very much !

    Mauro
    Boomy3D Guest

  6. #6

    Default Re: 3d textures from video

    here is a changed behavior that is part of the the chromelib. i included a
    timeoutobject that refreshes the texture every 40 milliseconds, wich is a
    framerate of 25 fps.

    if you have a 3d member on the stage and a real video in your cast, just drop
    this onto the scene and select the shader you want to use and the videofile.

    this is just to illustrate the idea wich works on my maschine very fast. i try
    to run my projects at 85 fps so it goes down to 83-82 fps if the script is
    running. i tested only with a texture of 128x128, but this can be enough for
    playing videofiles throug shockwave.

    at the moment it doesn't stop acting if the vidoe is over, so its really for
    testing around. hope it will help you a little bit.

    i hope nobody is angry because i posted some code here not done by me ... BUY
    THE CHROMELIB!!! >
    [url]http://www.chromelib.com/[/url]


    --------------------------------------------------------------------------------
    ---
    -- Play Real Video - Copyright Karl Sigiscar ? 2003

    --------------------------------------------------------------------------------
    ---


    -- Standard properties

    property spriteNum
    property pMember
    property pAlerted


    -- Parametered properties

    property pShader -- reference: the shader whose texture is being scrolled
    property pVideoMember -- reference: the Real Video cast member
    property pTriggered -- boolean: tells whether the video is triggered


    -- Dynamic properties

    property pVideoTexture -- reference: the texture created from the video stream
    property timeout_obj


    on beginSprite me


    pAlerted = false
    pMember = sprite(spriteNum).member

    -- Reference to video member
    pVideoMember = member(pVideoMember, 1)

    if pTriggered then startVideo(me)

    end


    on startVideo me

    -----------------------
    -- 3D initialization --
    -----------------------

    -- Create screen texture

    if voidP(pMember.texture("videoScreen")) then
    pVideoTexture = pMember.newTexture("videoScreen", #fromCastMember,
    pVideoMember)

    else
    pVideoTexture = pMember.texture("videoScreen")
    end if


    -- Assign texture to shader

    if stringP(pShader) then
    pShader = pMember.shader(pShader) -- reference to the shader
    end if

    pShader.texture = pVideoTexture
    pShader.texture.quality=#high


    ----------------------------------
    -- Start real video cast member --
    ----------------------------------

    pVideoMember.play()
    pTriggered = true
    timeout_obj=timeOut().new("real_video", 40, #playme , me) --## this is
    new!!!!
    end

    on endsprite me
    timeout_obj.forget()
    end


    on stopVideo me
    pVideoMember.stop()
    end


    on pauseVideo me
    pVideoMember.pause()
    end


    on resumeVideo me
    pVideoMember.play()
    end


    on playme me --## changed this from exitframe to playme that is called by the
    timeoutobject

    if pTriggered then
    pVideoTexture.member = pVideoMember
    end if

    end


    -----------------------------------
    --PURPOSE: Allows the user a dialog box access to the behavior's properties.
    --ACCEPTS: 'aScript' as a reference to a script member.
    --RETURNS: 'TGPDList' as a property list containing author definable behavior
    -- properties
    -----------------------------------
    on getPropertyDescriptionList(aScript)

    if the currentSpriteNum > 0 then

    tGPDList = [:]
    if aScript.is3D(sprite(the currentSpriteNum).member) then

    tList = []
    tList = aScript.getShaders(sprite(the currentSpriteNum).member, tList)

    if tList.count > 0 then
    tGPDList[#pShader] = [#comment:"Texture Shader", #format: #string,
    #range: tList, #default: void]
    end if


    tList = []
    tList = aScript.getRealMedia(sprite(the currentSpriteNum).member, tList)

    if tList.count > 0 then
    tGPDList[#pVideoMember] = [#comment:"Real Video Member", #format:
    #string, #range: tList, #default: void]
    end if

    tGPDList[#pTriggered] = [#comment:"Start at once ?", #format: #boolean,
    #default:true]

    end if

    return(tGPDList)

    end if

    end getPropertyDescriptionList



    --------------------------------------------------------------------------------
    --Predefined Handler
    Support----------------------------------------------------

    --------------------------------------------------------------------------------
    --PURPOSE: Gets the names of each shader in a member.
    --ACCEPTS: 'aScript' as a reference to a script member.
    -- 'aMember' as a member.
    -- 'aList' that will be used to store the names.
    --RETURNS: 'aList' containing the model names.
    -----------------------------------
    on getShaders(aScript, aMember, aList)

    repeat with j = 1 to aMember.shader.count
    aList.add(aMember.shader[j].name)
    end repeat

    return(aList)

    end getShaders



    --------------------------------------------------------------------------------
    --Predefined Handler
    Support----------------------------------------------------

    --------------------------------------------------------------------------------
    --PURPOSE: Gets the names of each real media in the internal cast
    --ACCEPTS: 'aScript' as a reference to a script member.
    -- 'aMember' as a member.
    -- 'aList' that will be used to store the names.
    --RETURNS: 'aList' containing the model names.
    -----------------------------------
    on getRealMedia(aScript, aMember, aList)

    repeat with j = 1 to the number of members of castLib 1
    if member(j).type = #realMedia then
    aList.add(member(j).name)
    end if
    end repeat

    return(aList)

    end getRealMedia


    -----------------------------------
    --PURPOSE: Determine if a member is set to, or is of type 3D.
    --ACCEPTS: 'me' as an instance of this script.
    --RETURNS: 'tName' as a string.
    -----------------------------------
    on is3D(me, aMember)

    tIs3D = FALSE

    case aMember.type of
    #shockwave3d:
    tIs3D = TRUE
    #text:
    if aMember.displayMode = #mode3D then
    tIs3D = TRUE
    end if
    end case

    return(tIs3D)

    end is3D


    -----------------------------------
    --PURPOSE: Verifies that linked files are at a usable state.
    --ACCEPTS: 'me' as an instance of this script.
    --RETURNS: True if the member has the minimal download reached.
    -----------------------------------
    on isMemberStateOK(me)

    tOKstate = FALSE

    case pMember.type of
    #shockwave3d:
    if pMember.state >= 2 then
    tOKstate = TRUE
    end if

    #text:
    if pMember.displayMode = #mode3D then
    if pMember.state >= 2 then
    tOKstate = TRUE
    end if
    else
    if NOT(pAlerted) then
    me.textTypeAlert()
    pAlerted = TRUE
    end if
    end if
    end case

    return(tOKstate)

    end isMemberStateOK


    ---------------------------------
    on textTypeAlert(me)

    tString1 = "The behavior indicated below requires that its text member's
    display be set to 3D Mode. " & \
    "This sprite's member is not set that way. " & \
    "Please correct this." & RETURN & RETURN
    tString2= "Sprite" & ":" && string(me.spriteNum) & RETURN & RETURN
    tString3 = "Behavior" & ":" && QUOTE & me.getScriptName() & QUOTE
    alert(me.typeset(tString1 & tString2 & tString3))

    end textTypeAlert





    --------------------------------------------------------------------------------
    --Predefined
    Handlers-----------------------------------------------------------

    --------------------------------------------------------------------------------
    --PURPOSE: Determines whether the behavior can be dropped onto a sprite in the
    -- score.
    --ACCEPTS: 'aScript' as a reference to a script member.
    -- 'aSpriteType' as a symbol. It indicates the type of sprite
    attempting
    -- to be dropped on to.
    -- 'aSpriteNum' as an integer. Indicates the channel of the sprite
    being
    -- dropped on to.
    --RETURNS: True if the behavior is allowed to be dropped on the sprite or
    score,
    -- false otherwise.
    -----------------------------------
    on isOKtoAttach(aScript, aSpriteType, aSpriteNum)

    case aSpriteType of
    #Graphic:
    case sprite(aSpriteNum).member.type of
    #shockwave3d:
    return(TRUE)

    #text:
    if sprite(aSpriteNum).member.displayMode = #mode3D then
    return(TRUE)
    end if
    end case

    #script:
    return(FALSE)
    end case

    end isOKtoAttach


    -----------------------------------
    --PURPOSE: Provides a tooltip in the behavior library palette.
    --ACCEPTS: 'aScript' as a reference to a script member.
    --RETURNS: 'tString' as a string.
    -----------------------------------
    on getBehaviorToolTip(aScript)

    tString = "Stream a RealVideo? cast member as a texture on a given shader."
    & RETURN & RETURN &\
    "You can import a .rm or .ram RealVideo? file in the Internal cast." &
    RETURN &\
    "If on the other hand, you would like to stream a video from a given URL:," &
    RETURN &\
    "1- Select Insert > Media Element > RealVideo?" & RETURN &\
    "2- Select the newly created RealVideo? cast member in the Internal cast" &
    RETURN &\
    "3- In the Member tab of the Property Inspector," & RETURN &\
    "enter the URL to the real video in the Filename field ([url]http://,[/url] rtsp:// or
    pnm://)" & RETURN &\
    "4- Give the RealVideo? cast member a relevant name" & RETURN & RETURN &\
    "If 'Start at once' is unchecked, then the video will be on hold." & RETURN &\
    "RealVideo? is a registered trademark of RealNetworks, Inc." & RETURN & RETURN
    &\

    "------------------------------------------------------------------------------
    hondo3000 Guest

  7. #7

    Default Re: 3d textures from video

    Thanks !!! i will show some test results soon with bigger video-textures and some compression options!!

    Thanks again!
    Mauro
    Boomy3D Guest

Similar Threads

  1. W3D & textures in 3ds max
    By extol in forum Macromedia Director 3D
    Replies: 0
    Last Post: August 18th, 08:36 PM
  2. dynamic 3d textures
    By cemongzongvang in forum Macromedia Director 3D
    Replies: 4
    Last Post: April 17th, 03:08 AM
  3. Size of textures
    By mickybhai in forum Macromedia Director 3D
    Replies: 2
    Last Post: June 9th, 07:06 AM
  4. Mesh textures
    By HomeBrewer in forum Macromedia Director 3D
    Replies: 1
    Last Post: July 16th, 03:00 PM
  5. textures
    By loadmovie webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 10
    Last Post: November 14th, 05:47 PM

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