Graphics

 View Only
  • 1.  Play Face/Material on exact frame

    Posted 03-27-2023 10:36

    Hello,
    I have one material with a video which have in animation and than loop. So I set it to loop, autoStart off and loop from frame 25.

    The question is:
    I have lets say 5 quad objects with this material on them and I want each quad to "play" lets say on frame 0, frame 20, frame 40 etc.

    How I can do that? Doesn't matter script or VL...



    ------------------------------
    Svetlin Aleksandrov
    Motion Graphic Designer
    Euronews Bulgaria
    ------------------------------


  • 2.  RE: Play Face/Material on exact frame

    Posted 03-28-2023 12:32

    Hi Svetlin,

    one easy way to do it - is instead of looping it in the material - to put the video material in a extra scene directer. In that sd to loop it with a event and to start that "video sd" from the main sd with a scene director trigger on the frame you want. 

    A other way is via VL to start and stop the video in the material as shown in the picture. While this is also possible to script.

    Picture and Demoproject attachet. In the demo i just put a textfield in to show you the frame.

    A other tipp video material that is on the scene director can be manipulated too (shorten or only play part) is also possible.

    Greetings Nicole



    ------------------------------
    Nicole Schindeldecker
    FERNSEHGRAFIK
    ------------------------------

    Attachment(s)



  • 3.  RE: Play Face/Material on exact frame

    Posted 03-28-2023 16:32

    You will need to create 5 versions of the material with the video. If all the objects have the same material then when one object plays they all play.
    You can drag each individual material into the scene director exactly where you want it to start playing.



    ------------------------------
    Azathoth
    Son of Cthulhu
    ------------------------------



  • 4.  RE: Play Face/Material on exact frame

    Posted 03-29-2023 03:26

    Yes, that's the way I have done it, but I was wondering is there a way to make it "cleaner" and have to duplicate the same thing over and over again...
    Kinda Master/Essential Properties in AE, where you one thing like kinda template and you can have many instances with diferent info or look.

    Anyway, tnx for the replays. :) 



    ------------------------------
    Svetlin Aleksandrov
    Motion Graphic Designer
    Euronews Bulgaria
    ------------------------------



  • 5.  RE: Play Face/Material on exact frame

    Posted 03-29-2023 10:49

    I've been trying to get this to work, but it only works in Designer mode and the Sequencer. When I play it through iNews to Xpression Studio, it fails. But maybe someone here might see my mistake.

    The following are global scripts I used to handle repetitive tasks:

    Sub CopyVideoMaterial(Engine as xpEngine, Scene as xpScene, srcQuad as String, destQuad as String)
      Dim theQuad as xpQuadObject
      Dim theMat as xpMaterial
      Dim theShader as xpBaseShader
      Dim theShader2 as xpBaseShader
    	Dim didItWork as Boolean
    
      Scene.GetObjectByName(srcQuad,theQuad)
      theQuad.getMaterial(0,theMat)
      theMat.GetShader(0,theShader)
    
      Engine.WriteToLog("CVM : Grabbed OMS :")
    
      theMat=Engine.CreateMaterial()
      Engine.WriteToLog("CVM : Create Material :")
      didItWork = theMat.AddShader("Video",0,theShader2)
      Engine.WriteToLog("CVM : Add Video Shader : " & didItWork)
      didItWork = theShader2.SetFileName(theShader.FileName)
      Engine.WriteToLog("CVM : SetFileName : " & didItWork)
      theShader2.LoopCount = -1
      Engine.WriteToLog("CVM : LoopCount Set :")
      didItWork = Scene.GetObjectByName(destQuad,theQuad)
      Engine.WriteToLog("CVM : Get Object : " & didItWork )
      theQuad.ClearMaterials()
      Engine.WriteToLog("CVM : Clear Materials : " )
      didItWork = theQuad.SetMaterial(0,theMat)
      Engine.WriteToLog("CVM : Set Material : " & didItWork )
    End Sub
    
    Sub PlayVideoRange(Scene as xpScene, srcQuad as String, _start as Integer, _end as Integer)
      Dim theQuad as xpQuadObject
      Dim theMat as xpMaterial
    
      Scene.GetObjectByName(srcQuad,theQuad)
      theQuad.getMaterial(0,theMat)
      theMat.PlayRange(_start,_end)
    End Sub
    
    Sub RemoveMaterial(Engine as xpEngine, Scene as xpScene, srcQuad as String)
      Dim theQuad as xpQuadObject
      Dim theMat as xpMaterial
    
      Scene.GetObjectByName(srcQuad,theQuad)
      theQuad.getMaterial(0,theMat)
      Engine.DeleteMaterial(theMat)
    End Sub
    

    Right now there is a problem with the CopyVideoMaterial subroutine. For some reason it doesn't copy on Xpression Studio, except there is a new line of code that is untested, theQuad.ClearMaterials(), and hopefully it will help. Also, all those WriteToLog lines are new so I can see where the script fails in Studio. I am on Xpression 9.5, so results may vary.

    Note that in CopyVideoMaterial is the line theShader2.LoopCount = -1, that forces No Looping. Use 0 for infinite loops and 1 or greater for a specific number of loops.

    Here's how to use it.

    1) Have one material with the desired video and attach it to the objects you want to see the video on. This allows for you to do design without duplicate materials.

    2) Your "IN" scenes will need to then have a script that duplicates the video material. Your first object will keep the video material which is duplicated onto the other objects.

    3) Add scripts that play video based on object names.

    4) "OUT" scenes destroy the duplicated materials. This is most important during the design process because otherwise you end up with lots of new materials you need to manually delete.

    Here is an example of an IN scene that goes to the animation scene. Then the OUT scene.

    Script 1 in the IN scene is the following:
    CopyVideoMaterial(Engine,Scene,"TopGlass 1","TopGlass 2")
    CopyVideoMaterial(Engine,Scene,"TallGlass 1","TallGlass 2")
    CopyVideoMaterial(Engine,Scene,"TopGlass 1","TopGlass 3")
    CopyVideoMaterial(Engine,Scene,"TallGlass 1","TallGlass 3")
    Scripts 2 thru 7 are something like this:
    PlayVideoRange(Scene , "TopGlass 1" , 0, 30)
    Script 8 in the OFF scene is this:
    RemoveMaterial(Engine,Scene,"TopGlass 2")
    RemoveMaterial(Engine,Scene,"TallGlass 2")
    RemoveMaterial(Engine,Scene,"TopGlass 3")
    RemoveMaterial(Engine,Scene,"TallGlass 3")
    I don't know if it will work for you. It works for me in the design and preview process but fails in Studio.
    Note: Playing scene directors in design mode will not play videos at full speed but the Sequencer will.


    ------------------------------
    Azathoth
    Son of Cthulhu
    ------------------------------