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 / 3D Object Occlusion Testing

Author
Message
puzzler2018
User Banned
Posted: 1st Jan 2019 18:33 Edited at: 1st Jan 2019 18:34
Another thread as inspired me to do something with this, here is what have so far

Probably bad practice but here is a version to dynamically build cubes as they come into view




Move cursors and click left mouse button to rotate the result

It dynamically instances cube too in processing which i think is very bad practice, but it seems to work
Its not finished yet cause got lots of other things to think about
puzzler2018
User Banned
Posted: 1st Jan 2019 20:03 Edited at: 1st Jan 2019 20:04
There are lots of variations, all different algorthms work better than others and would be good to create different variations

A few vids



Although a few examples he shows, he does tell which algorithm he uses



This guy seems to be alright in his vids to explain how it works and developed.

Enjoy!

Dont fall a sleep now!! lol
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 1st Jan 2019 22:10
I think ideally using that method you need some sort of array that keeps the data for all objects
That way you can delete and recreate as necessary

fubar
puzzler2018
User Banned
Posted: 1st Jan 2019 22:12
Just so not to confuse anyone

- Frustrum - is anything not seen in the camera view - whether it been at the back of the camera - This is all sorted by the GPU

- Backfaces - this is all polygons that are not shown of each object thats not visible - this is all sorted with AppGameKit automatiically

- Occlusion - this is all objects that are not suppose to be shown in a geometric world in front of the camera - this is not managed by AppGameKit or the GPU due to complexities

We shall sort this little problem out



Happy new year


puzzler2018
User Banned
Posted: 1st Jan 2019 22:15
Thanks Fubarpk

yes we need to build a depth buffer / octree system
puzzler2018
User Banned
Posted: 1st Jan 2019 22:24
Here is a version that see if an object is air (nothing) or something



fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 1st Jan 2019 22:26
Thanks for the explanation of terminology Puzzler
fubar
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 1st Jan 2019 22:53
@puzzler Last one works but boxes rotate strange ...the important thing is that you got it !!
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 1st Jan 2019 22:55
Thanks - i need to work on the rotational camera views to also cull with the angles of the camera - this will come once worked that out
puzzler2018
User Banned
Posted: 1st Jan 2019 23:16
There is one more i like to add - is a depth system.

Come back to you soon with this
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 2nd Jan 2019 12:25 Edited at: 2nd Jan 2019 12:26
Hey about the Octree, I have some code lying around.
I was inspried by somone here and was following a tutorial so its not complete...was stuck at combining the nodes again



Octree Demo

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 2nd Jan 2019 12:40
Awesome - thanks Janbo!
puzzler2018
User Banned
Posted: 2nd Jan 2019 17:47
Just some info on Greedy Meshing - could be very useful too

COde in Java to achieve it
https://github.com/roboleary/GreedyMesh/blob/master/src/mygame/Main.java

Could be ported...

Results in


chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Jan 2019 18:56
Hi there. Nice and interesting video puzzler .
what I always thought about doing is a CSG system ....in a voxel world that is easy, just deleting or adding little boxes but what about two 3D primitives ?
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 2nd Jan 2019 19:12
Thanks

This greedy mechanism works better just with cubes, the other types of prims will have to think of another

Im currently trying this method at moment and bashing my head against the keyboard again at the same ... bear with me...
puzzler2018
User Banned
Posted: 2nd Jan 2019 19:34
Only done the X axis for the minute



Need a rest now with programming all day too
puzzler2018
User Banned
Posted: 2nd Jan 2019 19:44


Definately more on this tomorrow

Enjoy!
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Jan 2019 20:34
Hey ....lol don't forget when setting full screen mode to put something like ..

if ( GetRawKeyState( 27) ) then end to let go out....I had to closse session
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 2nd Jan 2019 20:38
oooops - i then realised soon after. ill pop it in before i forget lol
puzzler2018
User Banned
Posted: 2nd Jan 2019 20:40
Its worser than a great tip to non literate computer peeps

Press ALT and F4 for a great surprise

LOL
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Jan 2019 20:51
Quote: "Press ALT and F4 for a great surprise"


Does it really works ?? I'm getting old ...
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 2nd Jan 2019 20:56
Yes I think so, dammm I didnt save what i was doing lol....
puzzler2018
User Banned
Posted: 2nd Jan 2019 21:43 Edited at: 2nd Jan 2019 21:44
With this we can set vertices to 0 if any are connected together along the X and indeed any on the Z too, this will dramatically reduce FPS too for a say 200x200 X Z map using the indices Fubarpk found

Y will come soon
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 4th Jan 2019 01:12
I'm not sure where your trying to go with this, I can't see you ever getting this dunno g at a decent speed in T1, bearing in mind that there will presumably be some game going on in the back ground too.

I found a tutorial and example for occlusion culling, but it needs to be done by Paul I think, or perhaps someone else on GitHub......it doesn't seem to be a pure GPU function, and in T1 your code will be too slow to do anything practical with it.

Are you still trying to get the Minecraft idea running?
puzzler2018
User Banned
Posted: 4th Jan 2019 13:57
Hey Santman - thanks for your input, i understand that this requires really to be done in the processing of C++ cause its 100 times faster performing the horrid loops that are involved to resolve this..

Was just having a little go, so see what can come up with and make an algorithm that seems to do it.

Paul and TGC Roadmap might not have this on their to do lists too. so we maybe waiting a very long while before things could be in place.

and yah - Minecraft is still in the back of my mind and when i have a potential new idea, i will send some code onto that thread

hope your world is taking shape too
puzzler2018
User Banned
Posted: 4th Jan 2019 15:10
Im hoping that one day Paul / TGC sees this thread and either go. Yikess! not another job! or it will come soon.. - lol
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 4th Jan 2019 15:27
AGK already has per mesh occlusion culling, you can use GetPolygonsDrawn to see how many polygons it is drawing. It takes some shortcuts for performance reasons, so might sometimes assume a mesh is visible when it isn't, but should get it right most of the time.
puzzler2018
User Banned
Posted: 4th Jan 2019 15:33
OK cool - thanks Paul
puzzler2018
User Banned
Posted: 4th Jan 2019 16:35

Enjoy a very interesting vid


blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jan 2019 21:48
Quote: "AGK already has per mesh occlusion culling, you can use GetPolygonsDrawn to see how many polygons it is drawing."

I'm not sure that is the case with the current version. I know it was culling with earlier versions but it appears that it is not working with the current version (At least the reporting).
If you look at the top left of the video it is showing GetPolygonsDrawn() which does not change at all and reports the TOTAL number of polygons in the scene
puzzler2018
User Banned
Posted: 4th Jan 2019 22:25 Edited at: 4th Jan 2019 22:26
Thanks for testing - it was same for me too and an example I did - polygon count just stayed the same. Ill upload a small snippet example too tomorrow to show.

But Paul did say it can either be hit or miss in doing it., but yes thanks for checking it out..


Cheers
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jan 2019 22:33 Edited at: 4th Jan 2019 22:42
*edit*
puzzler2018
User Banned
Posted: 4th Jan 2019 23:02 Edited at: 4th Jan 2019 23:03
Blink0K,., But what does it mean when you just say *edit*, you mean you agree to a previous post?
puzzler2018
User Banned
Posted: 4th Jan 2019 23:12 Edited at: 4th Jan 2019 23:16
Moving on a little, cause we need to use Memblocks for performance purposes.


The wheel need to be reinvented a little.

Check out a version of



Build this using AppGameKit and also into meshmemblock and check out the FPS for each to see if any performance issues.

I still go with meshes

So we need to reinvent the wheel a little and create own rotation matrices and scalings for each indepentant object - this will be job tomorrow.

Cause the setobjectposition or setobjectscale, or setrotationx y z doesnt affect the actual object - these values are positioned /scaled/rotationed after the are created by the createobject......

So the translation will always be 0,0,0 for the mesh memblock insertion.

So we have to apply scalings/rotations to the mesh after the individual objects are created - AppGameKit version of setobjectscale and setobjectrotation works internally in C++ to remember them


blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jan 2019 23:17 Edited at: 4th Jan 2019 23:18
Nah. I just said something that was incorrect. I do see it culling in another game but i don't see what the difference is between the other game and the one i showed.
I'm thinking the culling might be object based and not poly based
puzzler2018
User Banned
Posted: 4th Jan 2019 23:19
It may not be really important - Im just happy with Meshmemblocks - thought give it a go.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jan 2019 00:27 Edited at: 5th Jan 2019 00:27
From looking at it it seems like object culling. With that in mind it would be awesome to have something that split a model up along a grid.
I don't think it's a easy as it looks but i can imagine it would be a huge boost for performance for modeled environments.

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 5th Jan 2019 00:35 Edited at: 5th Jan 2019 00:39
There is indeed Portal Culling - Split your meshes and organise what needs to be rendered yes. Agreed

Like if we had a huge map of 50000 voxels but the player is in a certain area which consisted of 100 voxels - it would not make sense to render the ones thats outside a certain distance area


This will work well for large meshes
puzzler2018
User Banned
Posted: 5th Jan 2019 00:46
Port culling will be good for Doom or Wolenstien type on environments
puzzler2018
User Banned
Posted: 5th Jan 2019 00:55 Edited at: 5th Jan 2019 01:02
Do you beleive your full scene is rendering then- even though you just viewing one box say, so your 1000 boxes say for example as a whole

and what you basing your model on.

as it will have to be cut into seperate meshes if its huge.

if it just tiny then we have to work out the expense of the size of a model to what the culling actually requires - is it worth it
puzzler2018
User Banned
Posted: 5th Jan 2019 01:04 Edited at: 5th Jan 2019 01:07
If mazey type construction apps then Portal Cullling will do justice..

But again - it boils down to FPS - it thats ok for you then dont worry about it im sure - i am talking 20 mins real time to walk from one side of a map to the other type of thing - thats a map!!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jan 2019 01:15 Edited at: 5th Jan 2019 01:15
Quote: "Do you beleive your full scene is rendering then"

Yes. I know this because that poly count reported by AppGameKit is the total poly count from my 3D proggy.

Quote: "it will have to be cut into separate meshes if its huge."

It's huge in terms of size but not polys (3600 odd polys). But i believe slicing it up will cut the render from 3600+ to maybe just a few hundred which i think would be a huge performance boost (especially for mobile devices)

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 5th Jan 2019 01:17
Thanks

Portal Culling is what you require - why render a mesh that is 1000 kilometers away.

Ill have a think of the algorithm
puzzler2018
User Banned
Posted: 5th Jan 2019 01:26
Do you accept that theory?
puzzler2018
User Banned
Posted: 5th Jan 2019 01:34
How did you create that huge model?

could you share so can do some choppping testing
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jan 2019 01:48 Edited at: 5th Jan 2019 01:49
Quote: "Do you accept that theory?"

I don't think real time culling will work. It will only make it slower. Splitting up the model would work though


Quote: "How did you create that huge model?"

My 3D proggy

Quote: "could you share so can do some choppping testing"

You have a PM
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Jan 2019 07:03
@blink0k
That track looks awesome i must say
fubar
puzzler2018
User Banned
Posted: 5th Jan 2019 09:39 Edited at: 5th Jan 2019 09:40
Yes - look great - and indeed just tested and correct, the polygons doesnt change cause it works on meshes rather than objects - and if that looks like a massive track on one mesh then it will always draw that one mesh no matter what

A split meshing algorithm is required
puzzler2018
User Banned
Posted: 5th Jan 2019 10:02 Edited at: 5th Jan 2019 10:06
Damm this is not what i was expecting



Press the cursors < and > and moe mouse

Am I been totally been misunderstood in the theory..

My mind boggles sometimes

Shall continue researching and testing
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jan 2019 20:54 Edited at: 5th Jan 2019 20:55

Login to post a reply

Server time is: 2024-04-19 20:32:56
Your offset time is: 2024-04-19 20:32:56