Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: .roq videos as textures

  1. #1
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    98
    Thanks
    80
    Thanked 58 Times in 25 Posts

    .roq videos as textures

    Hi all

    Would it be possible to use .roq videos as Radiant textures? Kind of like the water texture, but instead of deforming the texture, somehow play a video on it. I've been searching and apparently it's possible in some Q3-based games like Star Wars: Jedi Knight, but I'm not so sure about cod2 (although it's based in q3). As I read it has something to do with shaders, is it possible to implement such custom shaders like this I post below in cod2? If so, know any good resources I can take a look on how to do it? Would appreciate it

    P.d. I saw there are shaders in the materials folder, but how did they make the actual material file that is used in radiant and is "linked" to the shader which animates it? I see no option in asset manager for that (I mean, I can make the texture but how to link a custom, or even a stock shader?)

    Thanks in advance

    PHP Code:
    textures/GPChannelsmap/video
    {
        
    qer_editorimage    textures/GPChannelsmap/video
        q3map_nolightmap
        
    {
            
    videoMap video/openinglogos
        
    }
        {
            
    videoMap video/openinglogos
            alphagen 
    const 0.25
            blendFunc GL_SRC_ALPHA GL_ONE
            glow
        
    }

    (source: https://jkhub.org/forums/topic/10458-video-texture/)
    Last edited by pollo; 25th July 2020 at 16:53.
    ";" <- Hide and seek champion since 1958.

  2. The Following 2 Users Say Thank You to pollo For This Useful Post:

    iBuddie (27th July 2020),kung foo man (27th July 2020)

  3. #2
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    94
    Thanked 293 Times in 187 Posts
    You can play .roq files, like the CoD2 intro sequence when you first start the game, but only fullscreen.

    You can use atlas-textures to play 'videos' or more gifs.
    However you have to export every frame of the video into such an atlas texture.
    I've done it with something like 144p resolution or even smaller, as these textures grow really big really fast.

    It its possible - yes, but not really practical.
    Last edited by serthy; 26th July 2020 at 06:46. Reason: Its atlas-texture, not alias...
    ╭━━━━━━━━━━╮
    YouTube
    Origin & Steam
    ╰━━━━━━━━━━╯

  4. The Following 2 Users Say Thank You to serthy For This Useful Post:

    kung foo man (27th July 2020),pollo (26th July 2020)

  5. #3
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    98
    Thanks
    80
    Thanked 58 Times in 25 Posts
    Quote Originally Posted by serthy View Post
    You can play .roq files, like the CoD2 intro sequence when you first start the game, but only fullscreen.

    You can use alias-textures to play 'videos' or more gifs.
    However you have to export every frame of the video into such an aliax texture.
    I've done it with something like 144p resolution or even smaller, as these textures grow really big really fast.

    It its possible - yes, but not really practical.
    Yeah, I know it is possible to play a full-screen .roq video and back in time I used a similar technique of playing gifs, exporting every frame and playing with hide() show() in script (maybe you mean the same with the aliax? ).

    The idea is to play a .roq looping on a surface, eg. make a case texture similar to the water one, and somehow with asset manager, link it with the shader above that plays the .roq video in-game. Because as you rightly say using a lot of images is unpractical and makes the map fat.

    Thanks for the reply
    ";" <- Hide and seek champion since 1958.

  6. #4
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    94
    Thanked 293 Times in 187 Posts
    I think I kind of remember now.
    It was done as an effect, not as a texture, so placing and scaling can be abit tricky.
    Lookup how smoke or fire effects are done, they use an 'atlas'-texture, something like this:

    You basically have to export your video clip into this format and fiddle around in the EffectsEditor to display every frame.
    Last edited by serthy; 26th July 2020 at 06:47.
    ╭━━━━━━━━━━╮
    YouTube
    Origin & Steam
    ╰━━━━━━━━━━╯

  7. The Following 2 Users Say Thank You to serthy For This Useful Post:

    kung foo man (27th July 2020),pollo (26th July 2020)

  8. #5
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    98
    Thanks
    80
    Thanked 58 Times in 25 Posts
    Ty for the clarification I will try doing that. Any other knowledge about this is welcome
    ";" <- Hide and seek champion since 1958.

  9. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,622
    Thanks
    17
    Thanked 961 Times in 602 Posts
    Quote Originally Posted by serthy View Post
    You can use atlas-textures to play 'videos' or more gifs.
    However you have to export every frame of the video into such an atlas texture.
    I've done it with something like 144p resolution or even smaller, as these textures grow really big really fast.

    It its possible - yes, but not really practical.
    Any quick n dirty "howto" on these atlas textures?
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

    Sending me a private message makes me want to help you LESS.

  10. #7
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    94
    Thanked 293 Times in 187 Posts
    Quote Originally Posted by IzNoGoD View Post
    Any quick n dirty "howto" on these atlas textures?
    Sorry, my first reply was misleading.
    I have done it using an effect and placing this in the world, not a rela texture.

    I've played with CoD2 shaders several years ago, the only thing I managed to get to work was changing the speed of the scroll-texture on xmodels, as far as I can remember. Not even the yellow-pulsating glow on objective-textures changed colors. I gave shaders a couple of hours/days to try to modify them and getting the CoD engine to accept them, but I did not 'understand' them well.

    CoD4 got those TV's that display a short video, I remember recreating these without much success.
    ╭━━━━━━━━━━╮
    YouTube
    Origin & Steam
    ╰━━━━━━━━━━╯

  11. #8
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    98
    Thanks
    80
    Thanked 58 Times in 25 Posts
    Quote Originally Posted by IzNoGoD View Post
    Any quick n dirty "howto" on these atlas textures?
    I've been playing with this today, although I managed to get it working, I couldn't manage to play the fx in the correct angle.

    This is the result:



    This is my dirty how-to. Sorry for the typos, and sry because it is not rly finished, I had a bit of trouble with placing it correctly in map, that's fixable by script but I don't really know how to adjust it properly. Tools I used:

    - Photoshop CS6
    - NVIDIA Texture Tools Exporter plugin for photoshop (link)
    - AtlasMaker plugin for Photoshop (link)
    - EffectsEd
    - Assman
    - CoD2 Radiant
    - Notepad++ for the script
    - This cute dog gif:

    Click image for larger version. 

Name:	dog.gif 
Views:	5 
Size:	4.49 MB 
ID:	1618

    First of all was to install the plugin, the readme.md at the github repo explains easily how to do that.

    Then, in Photoshop, I first disabled the color profile dialogs which open at opening any image, because otherwise I'd have to click 200 times "no" at each frame opening. For this I went to Edit -> Color settings, and in "color manager rules section", uncheck all three checkboxes.

    Next step was to export each gif frame, that is done by opening the gif in photoshop, selecting all the layers by hitting Ctrl-Alt-A, then click on Layer in the menu bar -> Arrange -> Reverse (in order to atlasmaker to load every frame in the correct order), and at last, click on File -> Scripts -> Export layers to files. Select an empty folder, JPEG format and hit Ok.

    So we got now each frame saved as a jpg, now we use AtlasMaker to glue them all together into a single file. For that click on File -> Scripts -> AtlasMaker, select the source directory where you saved your jpg's, this will get a while since it has to load every frame. In "Packing method" select "Texture Atlas", and leave the sorting method set to "none". Now in "Destination image" tab, we add enough size (multiple of 4 and greater than that) so that only 1 page is used (number of output pages are displayed under the source dir, and gets updated every time size is changed). Once we do that, we click on "Create atlas". We will get something like this:

    Click image for larger version. 

Name:	atlas1.png 
Views:	6 
Size:	499.2 KB 
ID:	1619

    Now we have to combine all layers together (Ctrl-Alt-A and then click on "Combine") and crop the image so that we leave out the last row which is not full (otherwise, we will have to mess with alpha channels to set transparency to 0 for the last frames). For that we select the area we want, then we click on "Image" in the menu bar, then "Crop". Now we get this:

    Click image for larger version. 

Name:	atlas2.png 
Views:	7 
Size:	462.8 KB 
ID:	1620

    Almost done with photoshop, but now we have to resize the resulting image to a multiple of 4 size. For that we select "Image" -> "Image size" and select a proper size in pixels (for this I used 2048x2048, this is a critical step if we want less size or more quality). Once we do this we save it as .DDS file: "File" -> "Save as" -> select "D3D/DDS" type, then OK and in the following dialog use these settings:

    Click image for larger version. 

Name:	atlas3.png 
Views:	3 
Size:	35.8 KB 
ID:	1621

    Now we did the photoshop part, next is to create the material file with Assman. The entry to create is a "material" asset, the rest of the settings are like these (set the "color map" path to where your .dds is saved):

    Click image for larger version. 

Name:	atlas4.png 
Views:	7 
Size:	40.3 KB 
ID:	1622

    Once we do this, we create the .gdt somewhere in our cod2 folder and convert that asset.

    Time for EffectsEd now. We must create an "Oriented Particle", and we have to leave these settings to get a kind of static, color and size stable effect.

    (Note: "Life" means the time in milliseconds that the fx will live. Set this to the total duration of the gif, in photoshop you can get it by multiplying the rate per frame times the number of frames in the gif -> 176 * 0.04 = 7040)

    Click image for larger version. 

Name:	atlas5.png 
Views:	8 
Size:	11.2 KB 
ID:	1623

    Click image for larger version. 

Name:	atlas6.png 
Views:	5 
Size:	7.2 KB 
ID:	1624

    Click image for larger version. 

Name:	atlas7.png 
Views:	5 
Size:	11.7 KB 
ID:	1625

    Click image for larger version. 

Name:	atlas8.png 
Views:	4 
Size:	10.1 KB 
ID:	1626

    Click image for larger version. 

Name:	atlas9.png 
Views:	7 
Size:	16.4 KB 
ID:	1627



    Radiant part: I made a little map, and placed script_origins rotated to where cod2 should play the fx towards to, like below. Important to displace the origins 1 square of 1 inch (select grid -> grid1, or just click 1) so that the fx doesnt play in the exact same position than the brush, thus overlapping it. I put another photo of that below.

    Click image for larger version. 

Name:	radiant1.png 
Views:	7 
Size:	714.0 KB 
ID:	1628

    Click image for larger version. 

Name:	radiant2.png 
Views:	7 
Size:	626.3 KB 
ID:	1629

    This is the entity settings of one of the script_origins.

    Click image for larger version. 

Name:	radiant3.png 
Views:	6 
Size:	17.7 KB 
ID:	1630

    Now we save the map, and compile it.

    For the script part I did this, however, 2 of them work correctly (fxorigin1 and fxorigin3) and the other 2 not:

    PHP Code:
    main()
    {    

        
    maps\mp\_load::main();


        
    game["allies"] = "american";
        
    game["axis"] = "german";
        
    game["attackers"] = "allies";
        
    game["defenders"] = "axis";
        
    game["american_soldiertype"] = "normandy";
        
    game["german_soldiertype"] = "normandy";
        
        
    precache();
        
    fx();

    }

    precache()
    {
    level._effect["dog"] = loadfx("fx/dog.efx");
    }

    fx() {
        
    origin1 getent("fxorigin1""targetname");
        
    origin2 getent("fxorigin2""targetname");
        
    origin3 getent("fxorigin3""targetname");
        
    origin4 getent("fxorigin4""targetname");
        
        
    delay 7.05// Gif duration, you can get this by multiplying the rate in photoshop, times the number of frames (for this: 0.04s x 176 frames = 7.05)
        
    dist 0;
        
    // a bit buggy!
        
    playLoopedFx(level._effect["dog"], delayorigin1.origindistanglesToForward(origin1.angles));
        
    playLoopedFx(level._effect["dog"], delayorigin2.origindistanglesToForward(origin2.angles));
        
    playLoopedFx(level._effect["dog"], delayorigin3.origindistanglesToForward(origin3.angles));
        
    playLoopedFx(level._effect["dog"], delayorigin4.origindistanglesToForward(origin4.angles));


    And that is all. I attach here all of these files if anyone wants to give it a try and would like to fix it, by my side I will keep working to check how I can rotate that damn vector that makes the gif play rotated. I tried rotating the script_origins in radiant, giving different values in script, playing with anglestoforward/right/up functions, but to no avail.


    files_and_map.zip
    Last edited by pollo; 2nd August 2020 at 13:03.
    ";" <- Hide and seek champion since 1958.

  12. #9
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,622
    Thanks
    17
    Thanked 961 Times in 602 Posts
    add a anglestoup(origin1.angles) at the end of your playloopedfx:

    PHP Code:
    playLoopedFx(level._effect["dog"], delayorigin1.origindistanglesToForward(origin1.angles), anglesToUp(origin1.angles)); 
    That should fix the upside down stuff.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

    Sending me a private message makes me want to help you LESS.

  13. The Following User Says Thank You to IzNoGoD For This Useful Post:

    pollo (1st August 2020)

  14. #10
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    98
    Thanks
    80
    Thanked 58 Times in 25 Posts
    yea I tried it too but still the same :/
    ";" <- Hide and seek champion since 1958.

Posting Permissions

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