1
$\begingroup$

I am using the following script I found in a youtube video, to have video in BGE.

######################################################
#
#    Movie.py        Blender 2.50
#
#    Tutorial for using Video.py can be found at
#
#    www.tutorialsforblender3d.com
#
#    Released under the Creative Commons Attribution 3.0 Unported License.  
#
#    If you use this code, please include this information header.
#
######################################################

#import GameLogic
import bge.logic

# get current scene
scene = bge.logic.getCurrentScene()

# get the current controller
controller = bge.logic.getCurrentController()

# get object script is attached to
obj = controller.owner

# check to see video has been added
if "Video" in obj:

    # get video 
    video = obj["Video"]

    # update the video 
    video.refresh(True)

# if video hasn't been added 
else:

    # import VideoTexture module
    import VideoTexture

    # get matID for the movie screen    
    matID = VideoTexture.materialID(obj, "MA" + obj['material'])

    # get the texture
    video = VideoTexture.Texture(obj, matID)

    movieName = obj['movie']

    # get movie path
    movie = bge.logic.expandPath('//' + movieName)

    # get movie
    video.source = VideoTexture.VideoFFmpeg(movie)

    # set scaling
    video.source.scale = True   

    # save mirror as an object variable
    obj["Video"] = video

    # check for optional loop property
    if "loop" in obj:

        # loop it forever
        if obj['loop'] == True:
            video.source.repeat = -1

        # no looping
        else:
            video.source.repeat = 0

    # start the video
    video.source.play()

Everything works but the video is distorted (or pixelated better). Definitely not the same resolution as the one I have. So what am I missing? Do I need to change camera settings? Add some line of code like the "capsize" that I found in another thread (but don't know how to use in my case)? Change something in the UV editor?

Thanks for any suggestions.

Edit: This is the video with the blend file. If you want to check what I mean.

$\endgroup$
4
  • $\begingroup$ What resolution is the video? $\endgroup$
    – Monster
    Commented Nov 27, 2017 at 9:03
  • $\begingroup$ It is 1920 x 1080. $\endgroup$
    – Lev
    Commented Nov 27, 2017 at 10:57
  • $\begingroup$ That should be fine. Just now I do not see why it should be downsized. $\endgroup$
    – Monster
    Commented Nov 27, 2017 at 12:45
  • $\begingroup$ I added the .blend whose settings I use with the video. If you run it you can see the same results. Don't know why. Check if you can find anything else,if you can else I'll just go with it. $\endgroup$
    – Lev
    Commented Nov 27, 2017 at 19:17

1 Answer 1

1
$\begingroup$

The answer is : "Play with the UV unwrapped mesh till it gets better".

Although I imported as plane and I thought this would be enough it isn't.

You need to move the vertices of the uv-unwrapped mesh and check what it produces. After some testing I brought it to levels that it is not pixelated.

I would like though, to know what is the exact size in that unwrapped mesh to match the video perfectly. Comment if anyone knows.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .