PDA

View Full Version : .roq videos as textures



pollo
25th July 2020, 17:30
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 :confused: (I mean, I can make the texture but how to link a custom, or even a stock shader?)

Thanks in advance :)


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/)

serthy
25th July 2020, 17:36
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.

pollo
25th July 2020, 17:49
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? :confused:).

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 :)

serthy
26th July 2020, 07:44
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:
https://i7.pngguru.com/preview/800/750/373/sprite-animation-explosion-drawing-gunshot.jpg
You basically have to export your video clip into this format and fiddle around in the EffectsEditor to display every frame.

pollo
26th July 2020, 16:37
Ty for the clarification :) I will try doing that. Any other knowledge about this is welcome :)

IzNoGoD
27th July 2020, 17:54
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?

serthy
28th July 2020, 11:11
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.

IzNoGoD
2nd August 2020, 00:17
add a anglestoup(origin1.angles) at the end of your playloopedfx:



playLoopedFx(level._effect["dog"], delay, origin1.origin, dist, anglesToForward(origin1.angles), anglesToUp(origin1.angles));


That should fix the upside down stuff.

pollo
2nd August 2020, 00:34
yea I tried it too but still the same :/

IzNoGoD
2nd August 2020, 09:11
What about using this instead:


playLoopedFx(level._effect["dog"], delay, origin1.origin, dist, anglesToForward(origin1.angles), (0, 0, 1));

pollo
2nd August 2020, 13:55
I tried it but with same result

it's like the fx is played correctly only in the YZ plane and that the playloopedfx function ignores the last parameter for the up vector, because it should work if we provide both vectors

in the XZ plane it gets rotated 90 degrees :confused:

(there's a typo in my op, the buggy ones are fxorigin2/4 like i illustrate below, but anyway, if i rotate the fx in EffectsEd 90 degrees, 1 and 3 become buggy, and 2 and 4 are fixed)

a workaround could be to make 2 different .efx which use the same shader, rotated 90 degrees in EffectsEd; one of them played in all origins of YZ-plane; and the other, played in all origins of XZ-plane, but not rly a beautiful solution lol.

ty for the help :)

1632

serthy
2nd August 2020, 14:07
Yeah, I remember that something about placing such effects was weird in CoD2..
Do you spawn them with a bullettrace()? How do they behave on non axis aligned surfaces?
Maybe changing the type of the effect can help, there were different kinds for decals like bulletholes and such (just a guess)..

pollo
2nd August 2020, 14:51
Yeah, I remember that something about placing such effects was weird in CoD2..
Do you spawn them with a bullettrace()? How do they behave on non axis aligned surfaces?
Maybe changing the type of the effect can help, there were different kinds for decals like bulletholes and such (just a guess)..

yeah it's definitely a bit weird. I spawn them placing script_origins in radiant with a specific rotation per each one, thus their forward vector is (aprox. for other surfaces) the normal vector to each surface.

I will try later with bullettrace; already did with decal but apparently it doesnt show up in fx ed preview, besides it doesnt let me set the shader framerate.

This is how it looks in non axis-aligned surfaces with the current solution.


https://www.youtube.com/watch?v=RjH2IrQ9PTU

how it looks in radiant:

1633

thx :)

serthy
2nd August 2020, 16:21
I played around abit, and spawned the FX on a tag, but it seems it is the FX, it won't change its upward angle


init()
{
level thread MonitorPlayer();

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

precacheModel( "xmodel/tag_origin" );
}

MonitorPlayer()
{
while( true )
{
level waittill( "connected" , player );

player thread MonitorButton();
}
}

vs( v , s )
{
return ( v[ 0 ] * s , v[ 1 ] * s , v[ 2 ] * s );
}

MonitorButton()
{
self endon( "disconnect" );

while( isDefined( self ) )
{
if( self UseButtonPressed() )
{
start = self.origin + ( 0 , 0 , 64 );
end = start + vs( AnglesToForward( self getPlayerAngles() ) , 10000 );
trace = BulletTrace( start , end , false , self );

if( !isDefined( trace[ "position" ] ) )
continue;

a = vectorToAngles( trace[ "normal" ] );
up = AnglesToUp( a );
fwd = AnglesToForward( a );
right = AnglesToRight( a );

p = trace[ "position" ] + vs( fwd , 1.1 );

// PlayFx( level._effect[ "dog" ] , p , fwd , up );

thread TagFx( 7.1 , a , p );

while( self UseButtonPressed() )
wait( 0.05 );
}

wait( 0.05 );
}
}

TagFx( delay , a , p )
{
tag = spawn( "script_model", p );
tag setModel( "xmodel/tag_origin" );
tag.origin = p;
tag.angles = a;

wait( 0.05 );

PlayFxOnTag( level._effect[ "dog" ] , tag , "tag_origin" );

// doesnt affect the FX
tag rotatePitch( 360 , 2 );
tag rotateYaw( 360 , 2 );
tag rotateRoll( 360 , 2 );

tag moveZ( 200 , 7 ); // works

wait( delay + 0.05 );

tag delete();
}

I play around with the FX itself in the Editor, but its a pain in the ass to change it (change, move .efx file to iwd, start game...) it takes ages. And in the FX Editor not even all effects are shown (I cannot see the decals..)

1635


https://youtu.be/B4Bc-paOBnM

serthy
9th August 2020, 19:52
Some experiments with shaders: https://github.com/nonsensation/CoD2-Shader

However, texture atlas seems to be more integrated in the engine itself, no luck on that.


https://www.youtube.com/watch?v=pG24Pw6Se_I

pollo
10th August 2020, 16:18
that looks amazing, thx for the effort and sharing :)