Help with your scripting

Video -ogg

Video -ogg

Postby epsilonion » 01 Feb 2018, 12:26

Opening Video
I have searched through the API library and looked through the default game manager script but can not find an example of how to add video in .ogg format as shown in the blog for opening screens.

can you help?
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Video -ogg

Postby SolarPortal » 07 Feb 2018, 14:56

Video's have not yet been placed to the user... only the ident is working at the moment.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg [Complete]

Postby SolarPortal » 12 Feb 2018, 00:35

Hey @epsilonion,
i have spent my sunday tinkering with the video system and now have lua commands to create videos and play them fullscreen using the built in screen quad or have the ability to get the video texture name and apply this to a material..

This has added 2 new libraries:
  • video.library() -- This is the video library and is fully working now.
  • material.library() -- This one only has the 1 function to setUnlitTexture(); PBR textures are still to be added as are all the other material controls. This was just so i could render the video on a material in the scene.

Here is my current script which contains a full utility set for managing multiple videos easily:
Code: Select all

obj = 0;
videos = {};

VIDEO_IDENT = "ident";
VIDEO_02 = "video02";

function onInit(objID)
   obj = objID;
   --sky.print("Scene Script Acitve");
end

function onStop()
   destroyAllVideos();
   
   -- Set the material back to No texture
   material.setUnlitTexture( "LightSource", "null"); -- use null to remove the texture
end

function onUpdate( td )
   updateVideos();
end

function onKeyDown( key )
   if(key == "1")then
      -- | Create the fullscreen cutscene video
      createVideo( "_Skyline_Ident.ogg", VIDEO_IDENT,  true );
      
      -- |  Create the second video and render it on an object
      createVideo( "bunny.ogg", VIDEO_02,  false );
      setVideoOnMaterial( "LightSource", VIDEO_02 );
      playVideo(VIDEO_02);
   end
   
   if(key == "2")then
      destroyVideo( VIDEO_IDENT );
   end
   
   
   if(key == "3")then
      pauseVideo( VIDEO_IDENT );
   end
   
   if(key == "4")then
      playVideo( VIDEO_IDENT );
   end

   -- Show/ Hide the fullscreen overlay for cutscenes
   if(key == "9")then
      video.ShowFullscreenPlayer( videos[VIDEO_IDENT] );
   end
   
   if(key == "0")then
      video.HideFullscreenPlayer();
   end
end



-- | ===============================================================================================================
-- | Video Utility functions that will allow you to load and render videos quickly and keep management of the videos.
-- | ===============================================================================================================

function keyExists(table, element)
   for key, value in pairs(table) do
      if key == element then
         return true
      end
   end
   return false
end

--/;/ EnumVidErrors
ENUM_exists = 0; ENUM_exists_empty =1; ENUM_Unused =2;
function isVideoValid( alias )
   if( keyExists(videos, alias) == true)then
      if(videos[alias] > -1)then
         return ENUM_exists;
      else
         return ENUM_exists_empty;
      end   
   end
   return ENUM_Unused;
end

function createVideo( clip, alias, autoplay )
   if(isVideoValid(alias) == ENUM_exists)then  return videos[alias]; end

   videos[alias] = video.create(clip);
   if(videos[alias] == -1)then
      lprint("Error: Failed to create video of name: "..clip.." and alias: "..alias);
      return -1;
   end
   
   if(autoplay == true)then
      video.ShowFullscreenPlayer(videos[alias]);   
   else
      video.pause(videos[alias]);
   end
   
   -- return the id if needed
   return videos[alias];
end

function destroyVideo( alias )
   if(isVideoValid(alias) ~= ENUM_exists)then  return; end
   
   video.stop(videos[alias]);
   video.HideFullscreenPlayer();
   video.destroy(videos[alias]);
   
   videos[alias] = nil;
end

function destroyAllVideos()
   for key, value in pairs(videos) do
      destroyVideo( key );
   end
end

function pauseVideo( alias )
   if(isVideoValid(alias) ~= ENUM_exists)then  return; end
   
   video.pause(videos[alias]);
end

function playVideo( alias )
   if(isVideoValid(alias) ~= ENUM_exists)then  return; end
   
   video.play(videos[alias]);
end

function updateVideos()
   for key, value in pairs(videos) do
      isVideoFinished( key );
   end
end

function setVideoOnMaterial( matname, alias)
   if(isVideoValid(alias) ~= ENUM_exists)then  return; end
   
   vidTex = video.getTextureName(videos[alias]);
   if(vidTex == "")then return; end
   
   material.setUnlitTexture(matname, vidTex, 1); -- The 1 signifies to place a RTT on the material
end


function isVideoFinished( alias )
   if( isVideoValid(alias) ~= ENUM_exists )then  return; end
   if( video.isDone(videos[alias]) == 1 )then
         video.HideFullscreenPlayer(videos[alias]);
         video.destroy(videos[alias]);
         videos[alias] = -1;
   end
end


Images to come soon!
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg

Postby SolarPortal » 12 Feb 2018, 18:08

Here are the images:

Cutscene video that uses fullscreen quad for rendering video on:
Cutscene.png
Cutscene.png (376.61 KiB) Viewed 29673 times


Video Texture on material that plays the video in the scene:
material_video.png
material_video.png (677.27 KiB) Viewed 29673 times


I have also wrote a Video Manager lua class that quickly gives the ability to add, update, delete videos with minimal management and only an alias needs passed around.

Next jobs is too look into the game manager and extend it so users can add more idents to the start of a game load. :)
Then will look at creating a trigger volume for showing cutscene videos and make a couple demos.
And to top it off, we need 2 new game states in skyline that will help manage game code. These game states are "Cutscenes" and "Cinematics" as using the pause state may not be the best move in a big game and will give finer control over the states :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg

Postby epsilonion » 12 Feb 2018, 18:54

Thank you this is awesome work and in a short time period.. you are awesome.. :P
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Video -ogg

Postby karmacomposer » 12 Feb 2018, 19:04

Fantastic!

We are going to need to have videos playing on assets, so this is perfect.

Question: Can videos be blended or filtered onto assets with existing textures? Like in photoshop where you can screen or multiply a texture - we are going to have animated silhouettes that I want a video to fade in when the player walks near a wall, for example, and have the silhouette animation play and then fade out when they walk away. The video will have the fades in it, but I want it to play on, say, a brick wall so you can still see the bricks.

Is this possible?

Mike
karmacomposer
Skyline Initiate
 
Posts: 12
Joined: 19 May 2015, 20:43
Skill: Audio
Skill: Programmer
Skill: Scripter
Skill: Level Designer
Skill: Great creative

Re: Video -ogg

Postby karmacomposer » 12 Feb 2018, 19:08

In the best scenario, we would love to displace the actual polygons in an asset to really creep out the player.

For example, a hand reaches out of the brick wall and then goes back to normal - the brick wall stretching and displacing the hand. I understand that DX11 and tessellation would likely be required for such an advanced trick.

Is this even possible?

Mike
karmacomposer
Skyline Initiate
 
Posts: 12
Joined: 19 May 2015, 20:43
Skill: Audio
Skill: Programmer
Skill: Scripter
Skill: Level Designer
Skill: Great creative

Re: Video -ogg

Postby SolarPortal » 12 Feb 2018, 19:10

@epsilonion: great to heaR! :)

@karmacomposer, Blending videos onto a pbr material should be possible especially with the detail channel but i have only programmed the unlit material at the moment, i will see if i can fit in a PBR texture slot also while im at it.. When i do it, i'll post a pic :) Even the fade in should be programmable lol :P

Edit: The second one not so much unless you used a mesh or animation of some sorts.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg

Postby karmacomposer » 12 Feb 2018, 19:11

I'm guessing that we would utilize the alpha channel perhaps?

Mike
karmacomposer
Skyline Initiate
 
Posts: 12
Joined: 19 May 2015, 20:43
Skill: Audio
Skill: Programmer
Skill: Scripter
Skill: Level Designer
Skill: Great creative

Re: Video -ogg

Postby SolarPortal » 12 Feb 2018, 19:14

Each detail is able to be blended like in photoshop but also has lets say an opacity slider of the blend. This enables you to get just the right amount of detail blending. The brick texture would be the diffuse layer.

The problem you might find is the UV's as a brick wall is generally tiled over and over..
The detail layer however also has the ability to scale the uv's used, so you could lower those values and offset the position to make the video fit. Its one to be explored :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg

Postby karmacomposer » 12 Feb 2018, 19:49

It would be great if there was a decal mode where we could define the X and Y coordinates (2D space) of the video on a side of the object and it would just stick there and play.

Further, it would be great to choose from play once or looped. In our case, we need it triggered and played once.

Mike
karmacomposer
Skyline Initiate
 
Posts: 12
Joined: 19 May 2015, 20:43
Skill: Audio
Skill: Programmer
Skill: Scripter
Skill: Level Designer
Skill: Great creative

Re: Video -ogg

Postby SolarPortal » 12 Feb 2018, 20:59

Triggered and play once is what we have at the moment. Instead of the decal, you could place a plane on the wall and then use a material on that plane to hold the video. When its not active, just disable the visibility of the plane.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg

Postby SolarPortal » 13 Feb 2018, 00:17

The game manager can now add more Splashscreens / Idents... as many as you want actually without programming them in :)
This can all be done from the main editor > Game Manager panel. The video's can be reordered by simply dragging them around in the container and pressing save.

i have had the skyline game engine ident followed by the nvidia one :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg

Postby epsilonion » 13 Feb 2018, 00:29

WOW great work... speedy.. :)

Whats the conditions of using there logo? is there a license or something or can anyone use it?
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Video -ogg

Postby SolarPortal » 13 Feb 2018, 00:44

not a clue, was only a test lol :P

i have had 4 videos playing at game startup now, one little bug i will iron out tomorrow :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Video -ogg

Postby epsilonion » 13 Feb 2018, 00:55

Just emailed them to see whats involved, license, agreement or other.. lol

Some clarity should be soon delivered to the mail box..... hopefully..
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 6 guests

cron