I’d like to know how to reload an Image automatically.
Like: Theres a plane with the image “…/cam.jpg” mapped onto
On MouseMove I’d like to reload the picture (which has changed)
And map it onto the plane again.
(Intention: I’ll mount the cam on the mouse, so i have a 2D-Augmented reality )
Thanks a lot for your solutions and python-examples
i was looking around in python using print dir(The module)
and i found replace, when i was at getMesh and get Texture or something, i tryed it and it dident work thought
import Blender
import GameLogic
gobj = GameLogic.getCurrentController().getOwner()
# Assumes mesh name == object name... very bad
bme = Blender.NMesh.GetRaw(gobj.name[2:])
# Get Image handle for first face
ima = bme.faces[0].image
ima.reload()
Hmmm, i will try this.
The last thing i tried was exactly the ‘NMEsh’-Method, but i gave up frustrated. The other thing is, that the pictures from the cam are updated only once per second… Welll, let’s see.
Read the readme, you have to create a webcam.jpg file that can be updated.
I don’t have a real webcam, I’m just drawing in GIMP and then saving it. If you have a real webcam, it is probably capturing at eg 640x480 - you will need to resize/crop/letterbox to get to a valid texture (size must be a power of two)
I’m not exactly sure when Image.reload() was added, I’m testing in 2.34, and it won’t work in blenderplayer.
THX a lot.
It woked at the first try, the image changed.
I started it once again and i had the first Bluescreen on my Laptop ever. but just for a glance of a second, then all went dark…
Since Friday i didn’t dare to turn on my Comp again. But today, tried again,
no update
No matter, it looks fine.
Now, the plan is:
Get ARToolkit-Documentation (looked fine at a glance, Image via DirectX)
get a live-pic without saving (DirectX, Open GL) into Blender
I justed realized if reload is possible then Bump Mapping is possible as well! Just take all the 3d information, image location/name, get PIL running with it calculate the pixels and just write over file and reload.
Wiseman isn’t it possible like python modules, to script a path to the module and include it with the runtime?? :-?
This is what I did with some Python codes inside blender. I used py2exe to find out what kinds of modules where needed to run the python program scripts inside blender’s engine. Then at the beginning script the path to the python modules that you want to include in your game. It works well, only you need to convert the modules into pyo files (just make them pyc and when blender imports them they will be turned into pyo)