i need a simple lod for grass ive tryd alot and to no avail all i need is a plane to be visible when ur close and invisible when ur far away …any help


You can use the visibility actuator to make your grass visible or not. This way it would work without python. Be careful with the sensors. The number of objects will influence the performance.

For a python LOD check this:

ya saw that script befor , cant even get it to work, and it wouldnt do what i whanted anyway and logic bricks r to slow in this case becouse this is a lod script and there will be tons of grass that would need a lot of logic

o never mind found one that works heres the link http://blenderartists.org/forum/showthread.php?t=26853

hey took some insiration from the script i found and made my own it works great and ony the player needs the script not all the objects being loaded

import GameLogic as g
cont = g.getCurrentController()
ob = g.getCurrentScene().getObjectList()
near = cont.getSensor("near")
go = cont.getSensor("go")
objs = near.getHitObjectList()
if go.isPositive():
    for obj in ob:
        if obj in objs:
            if hasattr(obj,"grass"):

it works perfectly but if u use it in your own game gimy some credit please

sweet thanks for sharing, don’t know if I’ll ever get around to using but thanks all the same.

what is the “go” sensor? and if the “near” sensor is a near sensor won’t it make things behind you visible?

go is an always sensor and yes things behind you ar visible becuase that radar sensor is so glitchy and it sends physics through the roof

Wow, very useful, thanks man

Thanks alot, I will try this out later.

I must try this at once! You have my thanks Jat, and also do you think that improvements could be made?
Like say I’m 600 yards away from a tree dont show it, I’m 500 yards away show the tree, but with no texture, and only a tenth of the vertics, I’m 400 yards away, show texture, but very low-quality, now show the tree with only a 5 of the vertics etc etc…?

You could do that with replacing objects. Say when you’re 10 units away from a tree, it’s just a plane stick with a cone on it. When you are 5 units away it shows you a detailed tree. If you’re 20 units away, it will show you a plane with a tree texture facing the camera.

You just need 3 objects and control with python or logic bricks the ways of adding and removing objects. If I’m right there is a LOD blender file in the gamekit from blender.org. I think the same blend is somewere around on the net, no idea where but I have seen it a long time ago.

sure ill try a replace mesh script and post it in a while

Thanks a lot mate :slight_smile:

try to use an object, shaped like a trangle that covers the view and have a collision sensor on that? so just the object in view will be drawn.

static object dont detect colition

Then Convex Hull Prototype, but as ghost?

ya but that would take up uneeded physics

What do you mean? It would reduce loaded objects by say 75 %, I’m not quite sure if we are understanding eachother here…
Anyway so far the script rules! XD

to have say fifty object with convex hull polytope would take up an huge amount of physics you want as much static as posible

We mean like this, an object registers all objects witin view, and only objects within view are affected by the lod script, meaning 75% performance increase…