Hi everyone, here’s a little demo with fake(ish) frustum culling in python. It’s obviously not as good as doing it in source, but it gives a reasonable speed up. The landscapes split into sectors, and these are made invisible when outside the view.
Use the arrow keys to move around, X and C to turn fog on/off and A/Z to increase/decrease view distance.
I’ve kept the poly count high, and the codes pretty messy, so with optimizations it’ll run faster, but this should show it’s possible. I get 20 - 40 fps increase, which can’t be bad
PS - sorry it’s a big file, I kinda got carried away…
Any idea what the scale is?
I got lost on the water… I got the impression I could go forever?
What size would you say the terrain represents?
The scale is pretty arbitrary but i think its about half a mile across. Scale everything down though and it could be miles
…and stay away from the water, i didn’t have time to make it look good
Pretty nice saint_pill. Good work!
That was nice!!!
But It is bad that the alpha channals goes over each other sometimes.
That is a problem that is in blender so we cant fix it .
Wow :o … You made a really great Job Man! Impressive!
Great way of culling, I even had a framerate of 55. That’s better then the person who released the last culling. (forest demo)
Btw, it should be awesome if you cooperate with the person who made Character AI, then you can create with each other a city (using your culling) with people (using test AI) THen we’ve got a awesome demo.
Nice saint_pill!!! Very simple the way it’s set up too I duplicated the sectors you had so there were 8 surrounding the ones you have already(total of approximately 320k faces) and it was still able to run at around 16fps!
Saint_pill, I tried to remake a blend with your technic of culling with python. I made a scene with some planes, camera, and an empty. I added sensor with script to the planes, and empty. But when I run the game, it doesn’t cull, so what did I wrong, and what do I have to add more? I’ve .blend of what I mean.
In your realtime buttons you have your 2 keyboard sensors setup…these have to be named to ‘up’ for A and ‘down’ for Z in your file(they’re named sensor1 and sensor2 in yours). Then you will see that your whole group of tiles will disappear when you run the game. Holding down A will make a few sqares visible in front of the camera.
Sorry, I was going to write a short explanation on how it worked when I got the first landscape in my game up and running, but thats taking some time so heres a quick fix…
…and Hush beat me to it…(thanks for saving me the effort :P)…but theres a few other things to change as well…
on the empty, change the values of “view_dist” and “tile_width” to match your scene - “view_dist” is the starting distance the camera can see and “tile_width” is the distance from the tiles centre point to the edge (I think it’s 6 in your .blend).
Also, the “always” sensors on the tiles should have both pulse modes OFF, they only need to trigger once when the scene starts.
And finally, at the bottom of the script is “if cam.view_dist < 30”, change 30 to match the maximum distance you want the camera to see.
I think thats everything, hopefully by the end of the week I’ll have a proper demo working with a cleaner version.
I chanced all the options liek you said, but nothin happens, it still doesn’t work. :x So I think I have to wait for your .blend file with the cleaner one.
Nice work! Looks quite “pro”.
Unfortunatelly it’s another proof that at actual state the Game Logic of Blender
is quite limitated.
We’ll need much more Logic Bricks to get a bit of the scripts power!
Thank you for sharing the file.
Hi there, here’s a slight update:
The landscapes not finished or setup very well, but I’ve commented the scripts so now it should be easier to use and see whats going on This is just so anyone can use it if it’s useful.
:o :o :o , Great, you are so cool. Awesome, I get it to work, I appriciate it so much, thanks Saint_pill, thanks for sharing.
Saint_pill, how did you do that cool fog effect in your landscape demo?
And I did everything you said, but It’s not working.
Well, you sure you did everything?
What’s not working, is it doing anything at all or what? Do you get any error messages in the console? I need more info if you want me to do something about it…
and that fog is just your basic mist, in the world settings (the blue/white button).
I tried applying the mist, with the exact same settings as you and it still won’t work. It’s in a third-person game with a sky sphere, but the mist is within the sky sphere the camera follows the player as a parent, abut the mist STILL WON’T WORK :x :x :x