Hi there!
I want to build a reaction game, which contains a video file - at some random point it should change the color and the user has to react.
Now im thinking of the best method to achieve this - i thought rendering two differend videos and then load another one isnt a good solution (due to matching the perfekt frame and load / unloading videos latency on poor performance hardware)
1 Idea - UV Coordinats: I thought to render the same video on the same video texture and change the uv coordinates (to avoid loading / unloading and matching the perfect frame)
2 Idea - Color Overlay: Using a Camera color overlay - but that would affect the complete screen / video area and isnt a good solution in case the video will have some other color details
3 Idea - Shader for the video texture / material: Same problem as for Idea 2 i assume… it could affect colors i wount like to have another color.
In my opinion the uv map switch would be the best solution (Idea 1). I would like to hear your inputs
Thanks in advance!
You could apply a color tint to it easily, see this example:
https://playcanvas.vercel.app/#/graphics/video-texture
add these two lines to it and reload the source code right there to see it being tinted red:
material.emissive = new pc.Color(Math.sin(time) * 0.5 + 0.5, 0.5, 0.5, 1);
material.update();
1 Like
Hi @mvaligursky,
thanks for your input!
Ok this would be a solid solution in terms the complete video can be tinted. But i think a few elements in the video will have to keep their “neutral” colors.
Lets say there are some red elements and they will be green at some random point - and in the video there are some “beauty” objects in… blue - they should stay blue, when the red elements turn green.
lets update the ideas:
Idea 1: Still the uv map change.
Idea 2: Color tint would work, but then i would have to make two videoTextures - one for the bg and then the videotexture (alpha video Texture) with the color tint applyed to.
Rendering two videoTextures - especially one with alpha video is costly on some devices in terms of performance - also if they have to be synchronious i experienced, that on some older devices it often isnt the case.
I think tinting the video texture is great, if the complete video can be tinted and there are no “beauty” details in other colors.
What do you think?
Thank you!
You could perhaps have the alpha channel in the video to mask what gets re-colored. And use a custom shader to only re-color those. You could even have some look up texture for re-coloring and do some more complex shader to detect what colors are remapped to what. But sure, it’ still limited.
Or you can do one video with two viewports in it … and offset into it as needed. Twice the download size, but more control.