I’m looking for scripts that can speed up the rendering process since it means that I would be able to have more complex scenes in my animations…
An example script is like this level of detail (LOD) one:
Here’s the script the LOD example contains:
import GameLogic cont = GameLogic.getCurrentController() sensorlist = cont.getSensors() #print len(sensorlist) camera = cont.getOwner() position = camera.getPosition() #print position actuatorlist = cont.getActuators() #print len(actuatorlist) for act in actuatorlist: sphereobj = act.getOwner() spherePos = sphereobj.getPosition() dx = spherePos - position dy = spherePos - position dz = spherePos - position distanceSq = (dx*dx)+(dy*dy)+dz*dz) if (distanceSq < 50): act.setMesh("Sphere.005") else: act.setMesh("Sphere") GameLogic.addActiveActuator(act,1)
I know how to program in lots of different languages but I haven’t tried to learn python scripts yet.
This code looks pretty straight-forward to me… I guess #print isn’t really necessary - it could just be for debugging-type purposes. I typed out that code manually - I couldn’t figure out how to copy and paste it or save it as a file. So there might be typos. There were a few different levels of detail and sphere meshes in the actual code but I simplified it to reduce typing.
Anyway, I don’t want to use any of Blender’s game features - I just want to render animations. So I guess many parts of that code like “GameLogic” shouldn’t be in there.
I was wondering how to make some code that is “called” with each frame of an animation… it would also be called for each subframe for motion-blurring, and fields rendering, etc.
Basically I want to make scenes that have lots of trees, etc, that are detailed up close while not taking long to render when in the distance (due to LOD).
BTW, I’ve tried rendering that demo but the objects show up in their original form - as cylinders… though when in game mode, the LOD works properly.