How would you blur a video texture?

i’m using the video texture script from tutorialsforblender3d.com

#######################################################
#    RenderToTexture.py        Blender 2.50
#
#    Tutorial for using RenderToTexture.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 GameLogic

# get current scene
scene = GameLogic.getCurrentScene()

# get the current controller
controller = GameLogic.getCurrentController()

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

# check to see RenderToTexture has been added
if "RenderToTexture" in obj:
                
    # update the texture
    obj["RenderToTexture"].refresh(True)

# if RenderToTexture hasn't been added 
else:

    # import VideoTexture module
    import VideoTexture
    
    # get a list of objects in the scene
    objList = scene.objects
    
    # get camera name being used for render to texture
    camName = obj['cam']
    
    # get camera object
    cam = objList[camName]
        
    # get the texture material ID
    matID = VideoTexture.materialID(obj, "MA" + obj['material'])
    
    # set the texture
    renderToTexture = VideoTexture.Texture(obj, matID)

    # get the texture image
    renderToTexture.source = VideoTexture.ImageRender(scene,cam)

    # save RenderToTexture as an object variable
    obj["RenderToTexture"] = renderToTexture     

what code would you add to blur the texture? (I’m a python noob)

file download: http://www.mediafire.com/?q2pjv2kcr1bb73g

thanks

Is blurring a texture on a plane possible? or is there limitations to it? I was thinking of bloom filters but they wouldn’t really work as it uses the 2d filter function instead.
thanks

Yeah, it’s possible. You could do it by adding a shader nodes material to the plane that displays the videotexture. It would involve taking multiple offset samples from the video texture and averaging them together. Or you could use a custom glsl shader, which would be a lot faster.

I think you could also do it by pure Python, reading and writing samples to the texture object. I don’t recommend doing it this way; it’d be slow as heck.

I wrote a GLSL shader that does a sort of cheap blur and some other effects per object (rather than the 2d screen filters) using a render to texture target to make it appear like it is a blurred overlay on the background. I have tweaked it to work for a video on a texture rather than the rendered image from a camera.

Download: https://dl.dropboxusercontent.com/u/41710/HUD%20Tests%20GLSL.zip
(Big Buck Bunny trailer video is included… should work when it is extracted.)

Disclaimers:

I am new to GLSL in general and really hacked this together from bits all over to get the effects I want. It is sucky and doesn’t bother with lighting or shading in anyway since I wanted to use this stuff for HUD in my project. (Other shaders that do those other things could of course be put in.)

I don’t guarantee anything is correctly done. My blur effect is something I just came up with. If you are looking for a true Gaussian blur then you will have to write or incorporate some other one. The other effects like invert, mosaic, etc are just for kicks.

I try to comment like crazy specifically for when I share something or put a project away for months. Hopefully you can read through it and make sense of what I was doing.

The video playback is essentially straight from the blender API site with the bits added to setup the texture so it can be accessed from the shader.

Hopefully it is of some use.

Thanks DownshiftDX, i’m not the best and trying to implement modules and stuff, also trying to render the camera’s view in realtime and blurring the output was a nightmare.

here’sthe file for anyone to play around with!
if you get something working please post the .blend!