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.

Newcomers DBPro Corner / Can i please have some help me with hideing objects that can't be seen?

Author
Message
crazeymark
20
Years of Service
User Offline
Joined: 3rd Nov 2003
Location:
Posted: 27th Nov 2010 13:35
Basically at the moment I've a huge amount of objects on screen but but only a small amount are actually visible to the player. The bulk of the objects are hidden behind other objects, if you imagine a big cube made out of smaller cubes then you'll have a good idea of my problem. Most of the objects are inside the cube and can't be seen but will slow the game down as they are still been drawn.

so far I've hidden any object that's to far away from the camera and also any object behind the camera but the game still is getting allot of slowdown because of the shear number of objects.

I need to find a way of checking if one object is behind another so I can hide it. as that would speed my game up ALOT.

So i was wondering if anyone knew how i could do this, I would be very grateful for any help anyone can offer.
crazeymark
20
Years of Service
User Offline
Joined: 3rd Nov 2003
Location:
Posted: 27th Nov 2010 15:01
Ok, I've worked out how I can do it, but I'm just not sure how to implement it.

I need to be able to have a plain that i position at the centre point from the object to the camera and then scale and rotate it so that one end is colliding with the object i check if i can see and the other is colliding with an object positioned at the camera location.

then all i will need to do is check if any other object collides with the plain object.

If anyone could help me work out how to go about implementing that i would be insanely grateful, assuming it wouldn't end up been slow to the point it would be useless lol.
Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 28th Nov 2010 14:57
There is an 'Object in screen' command, but it can be slow depending on how many times you use it each loop.

=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 28th Nov 2010 19:00
Would just checking if the objects co'ords are infront or behind the camera co'ords be enough?

Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 28th Nov 2010 19:32
Infact, you could use sparky's to raycast each object from the camera, if there is a collision, something is blocking the object

crazeymark
20
Years of Service
User Offline
Joined: 3rd Nov 2003
Location:
Posted: 30th Nov 2010 15:36 Edited at: 30th Nov 2010 15:53
Thank you for trying to help me but after thinking about it i beleave i'll need to find a better way of doing it. as with 20,000 objects checking each one upto 8 times (one for each corner) will be way to slow, may have a looksie at the 'Object in screen' command and see how slow it is lol.

once again thank you

*edit*

The 'Object in screen' doesn't hide any objects that are behind outher objects sadly.
Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 30th Nov 2010 16:50
Quote: "The 'Object in screen' doesn't hide any objects that are behind outher objects sadly."


If you're using a lot of objects, you will have to use a lot of different techniques. The first technique is to split your world up to zones. These zones can be large transparent cubes. You can check if the zone is visible with the 'Object In Screen' command, if it's not, none of the objects inside can possibly be visible. If it is, check each object inside for it's visibility with 'Object in screen' again, if it is, raycast it, to check if it's behind somthing. If it's not... well it's not on screen. :p

crazeymark
20
Years of Service
User Offline
Joined: 3rd Nov 2003
Location:
Posted: 1st Dec 2010 17:52
I think i'll have to leave it as is for now as i've an ok fps on this laptop just not as high as i would have liked.


For now i'm going to leave it with clipping any objects to far from the player and anything behind the them lol i'm spending way to much time i think trying to get an extra few fps.

I may just add more information to the level array to tell if an object is completely surounded by other objects, if it is then hide it untill one side is exposed. I'm supprised i didn't think of that earlier if i'm honist lol.

Thanks anyway

Login to post a reply

Server time is: 2024-09-29 00:29:16
Your offset time is: 2024-09-29 00:29:16