Tropical island Demo

Thanks!! I’ve seen that you are making some survival game, maybe I can help you with it?

Yes! I need good working(high, very high FPS), but realistic underwater shader…)

i like the rock models you added there. How did you make the water mirror reflection?

The water shader is from Martinish demo. I tweak it a lot and also I’m using a Wave script for it.

This is the third video test, due to recording and aplayed filters(bloom and DOF) FPS is very low.
I’ve tested a lot of posibilities to have more FPS.
This scene is about 500000tris, and on my old computer (4x2.33ghz, 4GB ram and Geforce 9800GT) I get about 32-45 FPS. All foliage use LOD, rock models also.

Beautiful, indeed!

Are you sure it is optimized well? I see your logic goes up to 20ms, which is not good. What else is there, except the lod, first person camera and filters?
If there is nothing else, check the sensors pulse mode…you should never set a sensor to true with a pulse mode 0.
Otherwise it looks great!

P.S. It is very possible, that the shadows are lowering your fps with ~50%. What is the fps without shadows?

I’ve checked everything and the main logic consumer are watershader scripts (15ms) 5ms for LOD.
WIthout sun lamps shadows I’ve got 37-45 FPS, when i swith on it is about 30-37 FPS.
Now I understand that the main problem is Rasterizer, It doesen’t matter how many polys are on scene, matters how many polys are in view.
I’ve made some test and there are some strange things:

  1. When I group grass in to bigger objects (joined small grass) the rasterizer goes down and I get about 2-4 FPS more but when I enable filters it is slowing down drasticly from 30FPS to 22 FPS. It is not slowing down when grass is in small groups, why?
  2. Sometimes when I start the Game Engine the GPU Latency is going to 8% and more when I play, and sometimes it is 0% all the time, why is this happening?

The Rasterizer is doing 1 draw call per object, no matter how many polygons are in it. So if you have 1000 objects with 1 polygon in them the Rasterizer will execute 1000 draw calls per frame. If you have 1 object with 1000 polygons, the Rasterizer will execute 1 draw call per frame. Draw calls are the main performance killer ,when it comes to the Rasterizer, so try to create objects with many polygons and avoid objects with small amount of polys.
A 2dfilter performance is totally connected to its code, try to find better 2dfilters. The “If” statement in many 2d filters is their performance killer. More “Ifs”=low framerate. Ofcourse there are many other issues with them, like “number of samples”.
Sometimes the passes of 2dfilters matters. It is important to reorder the 2dfilters passes right. In other words it matters if a Bloom filter is on pass 1 and Outlines filter is on pass 2 or vice versa.
The Bloom filter costs to my game 15fps, but I found another one, called CrossBloom it costs only 5-8fps here it is:

uniform sampler2D bgl_RenderedTexture;uniform sampler2D bgl_LuminanceTexture;
int NSAMPLES = 5;
uniform float bloomIntensity;
void main()
{
   vec4 sum = vec4(0);
   vec4 bum = vec4(0);
   vec2 texcoord = vec2(gl_TexCoord[0]);
   int j;
   int i;


   for( i= -NSAMPLES ;i < NSAMPLES; i++)
   {
        for (j = -1; j < 1; j++)
        {
            sum += texture2D(bgl_RenderedTexture, texcoord + vec2(-i, j)*0.002) * bloomIntensity;
            bum += texture2D(bgl_RenderedTexture, texcoord + vec2(j, i)*0.003) * bloomIntensity;            
        }
   }


   if (texture2D(bgl_RenderedTexture, texcoord).r < 2)
        {
        gl_FragColor = sum*sum*sum*0.0080+bum*bum*bum*0.0080+ texture2D(bgl_RenderedTexture, texcoord);
        }


}


// + texture2D(bgl_LuminanceTexture, texcoord)



I have been planning on using my own lod,
to set a property in items LOD and replace mesh,

if the LOD = 3 no little objects are spawned

lod = 2 tile executes script spawing items into the scene

lod 3 again, object itterates scene.objects over a few frames removing items from the tile, and building the list to add back, so items can move tiles etc.

This is the 0.1 version of the island, not finished.
You can adjust sun position by simply grabing it with left mouse button, there are also 2 filters under buttons 1 and 2 (enabling and disabling). 1-bloom filter, 2-dof filter.
Tell my how smooth it is working on your computers and what do you think about this project.

  • with filters activated ~40-45fps,
  • without filters 55fps
  • without shadows and with filters 75-80fps
  • without shadows and filters 120fps

I think it’s pretty obvious, the shadows are making problems, but that’s a problem for many engines. Use shadows wisely, bake shadows for some objects and leave some objects with dynamic shadows.

The filters doesn’t affect my framerate at all. They look so great and work so great. I wanna use them in my game, but… I need to make DOF effect a bit less so my hands ain’t blurred so much. Could anyone help me?

Thanks for the answer.derful
I know that shadows affects FPS a lot. I wanted to have dynamic shadows and night and day.
Maybe I will bake shadows to terrain.
Haidme your project is wonderful, hope you will make it to the finish.

Thanks, you are also doing great job! Add some particles, like dust or falling leaves to this demo and a sea boat, maybe a ship wreck or something. It will help a lot for the overall atmosphere.

I’ve got a question to you guys about Mist in game engine.
How can i enable and disable mist during game?
I found a small script but it is just enabling Mist:

import bge
from bge import render

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner

on = own[‘on’]
self = scene.objects[own.name]
key = cont.sensors[‘Keyboard’]

if key.positive == True and on == False:
render.disableMist
self[‘on’] = True
if key.positive == True and on == True:
render.setMistStart(1.00)
render.setMistEnd(35.00)
self[‘on’] = False

Maybe setting valuse of mist to 0.0 would turn it off? Or maybe set it to very far distance? I don’t know other ways, but I think there was a way…

The functions related to the mist were deprecated, they only work while you’re using the multitexture mode.

Recently, some patches by HG1 were commited to the master branch, they fix the problems with the mist, dowload a blender 2.74 version. The functions were changed to attributes and were changed to a new class object = KX_WorldInfo, and were renamed.

Example of the new api:

from bge import logic
scene = logic.getCurrentScene()

world = scene.world

#Enable mist
world.mist_enable = True


#Change mist start
world.mist_start = 32

#Change mist distance
world.mist_distance = 64

I don’t know if the documentation have been updated too.

Othere new attributes:
world.mist_intensity = float
world.mist_mist_type = KX_MIST_QUADRATIC, KX_MIST_LINEAR or KX_MIST_INV_QUADRATIC
world.mist_color = Vector(r, g, b)
world.background_color = Vector(r, g, b)
world.ambient_color = Vector(r, g, b)

Apart form that. Your island is really good! Keep up work.

P.D: You are using quotes intead of [ code] [ /code] for post your code.

I’ve managed to work a little bit with underwater enviroment in my file.
The transition when you dive is not smooth, but this is still a very early version.

Looks good, but improving transition between water/underwater would come good for oyu!