Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Occlusion ideas

Author
Message
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 26th Sep 2016 05:25
Hi all!

So I have a 3D game I'm making, and I threw in a fairly standard occlusion system to hide any objects that weren't needing to be rendered, and it works pretty well I guess, but I thought I'd throw this out there to see if anyone had any ideas of how I can make it even better or more efficient?



So yeah. Pretty straightforward. Fairly sure it's not doing anything with objects behind other objects, however that doesn't REALLY matter as the game is fairly straightforward and doesn't get that advanced. I am, however, using my own 3D particle system which can bring the framerate down a little. I'm fairly sure though that the fps drop is due to me using too many different counted loops rather than condensing things down to make it simpler.

In either case I thought I'd throw this into the waters and see if any of you had any ideas on how to make it nicer or even more efficient! Thanks!
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 26th Sep 2016 09:15
You could break the map into checkerboard, and only check objects in your 'cell'.
You could also have different 'LODs' and check visibility on larger objects at a larger distance, ans smaller ones at a smaller one.

The trick it to reduce the number of objects your checking per loop.
Le Verdier
12
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 26th Sep 2016 10:55 Edited at: 26th Sep 2016 10:56
A long time since I come here !!
I'm not sure it is so efficient. What you are doing is similar to frustum culling, a task normally already done by the 3D engine before rendering an object.
I agree with Mobiius for a checkerboard grid system and LOD. The off screen cells are thereby culled by the engine.
For the static objects, this Implies some upstream scene processing to scatter every face into the right cell and regroup to create an object per cell (and texture).. The cell size is carefully set according the scene size. Too small , there is a lot of objects..too large, there is not enough culling done..
All hail the new flesh
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 26th Sep 2016 14:02
AGK already does this by default:

SetObjectScreenCulling( objID, mode )

And im pretty sure GetObjectInScreen is the same used internally by AppGameKit , so your just doing the same thing 2 times with no effect.
You should try to print the poly count and see if you get any difference.

best regards Preben Eriksen,
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 26th Sep 2016 16:42
You could use sprites... like a sprite version of the cone shape the camera renders, with a sprite per object positioned depending the the objects X Z position. Then you can get a sequence of the sprites that are hitting the camera cone sprite, and show them, otherwise hide them. To be honest I haven't tried this with AGK2, but it does some good in AGK1. Also, it might result in faster AI visibility checks, rather than using 3D raycasting you could use 2D sprite raycasting first.
The code is dark and full of errors
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 27th Sep 2016 05:52 Edited at: 27th Sep 2016 05:53
Preben, I didn't realise this! Very cool.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 29th Sep 2016 11:33 Edited at: 29th Sep 2016 11:33
Render 3D Imposter Sprites, from any angle (16 x 16, all 22.5°)
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 29th Sep 2016 11:42
I may sound stupid, but why just don't use the SetCameraRange? Everything not in range will not be rendered too.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 29th Sep 2016 17:44
Since AppGameKit uses OpenGl ES 3.0 maybe it is possible to use occlusion query.

http://malideveloper.arm.com/downloads/deved/tutorial/SDK/linux/2.4.4/html/occlusion_culling.html
The coffee is lovely dark and deep,and I have code to write before I sleep.

Login to post a reply

Server time is: 2024-11-25 01:31:31
Your offset time is: 2024-11-25 01:31:31