Don't render what camera cannot see?

Hello :slight_smile: , I am trying to make a simple game/application where the user can click cubes to remove them and make a model. However I am experiencing EXTREME lag issues. I think this is because the game engine is rendering the non-visible cubes even though the user cannot see them. I will post a link to my .blend so that you may understand what I mean:


So my question is, is there any way (with or without python) that I can make it so that the only objects rendered are the ones that are directly visible to the camera, to reduce the lag.

I would be extremely grateful to anyone who could provide help (of any kind) to me.

Thanks in advance,

I believe occlusion culling is what you are talking about. Use this link to help. If you can’t find out what you need at that link, then I’m sorry. I can’t help further. But I hope I helped!

its logic, not rendering that is the issue

you need 1 mouse over any to feed a script based on mouse.hitObject

you have HUNDREDS of mouse over

it being just over 30 mb makes it hard to give back

one sec

now its tiny

USE ALT D :smiley:


BlockModelerBPR(Pack).blend (1.93 MB)

Alright, but how would I get that one mouse over to act upon all of the objects individually?

Oh, sorry My page didn’t load in that last bit sorry :stuck_out_tongue:

Wow! thanks a bunch, I really appreciate it! I subbed to your Youtube.

I edited it in :smiley:

I know this is a topic for another thread, and maybe completely impossible, but as long as I have your attention… Is there any possible way to join the cubes as one object in the game and export them as an obj or some other model format that the user could then edit in blender?

If you don’t know or anything that’s fine too, just thought I’d ask. Thanks

Long and short is its not worth it, unless you have ALOT of time, you could manipulate faces directly, by getting verticies, even then, it’s a game in a 3d animation suite :smiley:

it’s like making a working etch a sketch in gimp, cool but not productive :smiley:

Alright thanks, that’s kinda what I figured.

Actually, it’s both perfectly possible and quite interesting. I’d considered using BGE->Blender->BGE interactions to enable semi-realtime destruction. It would be a task, but a fun one.

yes, keeping it in game would be amazing, but using it as a editor might not be so productive

( I was thinking of it as a shape maker (blender is really good at that) )

but for adding damage to a mesh… that is a great idea,

Can you explain what mesh damage is, and what role it would play here? I am not new to blender but I am not fully acquainted with the game engine and its features just yet.

Hold on, does mesh damage mean that it would save data that can be used in Blender to deform a mesh to look like it?

so, have you little cubes at every vert of a simple item,

if they are clicked, or damaged, move the vertices inward with python…

this could work, for in game car damage, or ship, etc, (denting on impact etc)

This thread is going off topic.

So the question was:

  • Why is my game so slow

The answer is:

  • Because you have hundreds of mouseover sensors

The solution is a script run by the camera like: (untested)

import bge

cont = bge.logic.getCurrentController()

mouse = bge.logic.mouse
mouse_sensor = cont.sensors['Mouse']
if mouse.active_events[] == bge.logic.KX_INPUT_JUST_ACTIVATED:
    #The mouse has been clicked
    if mouse_sensor.hitObject != None:

Select the camera, go to the logic brick panel and add:
Mouse (mouse over any) -> Python (this script)

If you need help, ask.

You will still hit performance issues when you get lots of cubes, but it should help a lot.

So what would this be useful for in this case?

its faster