Page 1 of 1


Posted: Wed Jan 26, 2005 12:59 pm
by Rendman
Ok, So I have this idea and wanted to see if anyone had any better ideas or had some experience doing it this way.

Let's say I have a whole bunch of prefabricated mesh objects that represent rooms. My program randomly generates rooms using these objects. Now if I place the player anywhere inside one of these rooms and shoot out "rays" in all 360 degrees to determine what other meshes are in the players line of sight, what sort of performance can I expect? I'm sure that it's got to be better than rendering all the meshes. (This process has to be completed for every frame)

I should probably ask, does a scene manager already exist that does this? If not I will have to code my own(obviously)


Posted: Wed Jan 26, 2005 1:09 pm
by :wumpus:
This is very very slow. It can take minutes to reliably calculate sector-to-sector visibility.

The better method is to do this visibility querying in the preprocessing stage (ID software did it like this in quake). Create a list of visible areas for each area, and store that.

Note that Ogre already does object-to-frustrum culling, so that objects outside the view frustrum of the camera are not rendered. The hard problem is finding occlusion (finding objects blocking others from sight and not rendering them), which AFAIK can't be done in real time for scenes of any real size.

Posted: Wed Jan 26, 2005 1:18 pm
by Rendman
Okay, here's the idea that I have and maybe (if you so please) could give me some ideas about the best way to approach it.

Like I said I have a whole bunch of model files that represent rooms. The program just sticks the models together using 'tags' that represent doorways and such. I then populate these rooms with lights, static models and creatures. The idea that I'm getting to is a sort of 3D third person view nethackish like game. This view fustrum stuff sounds kinda good. So if my frustrum? is say like 3000 world units large(I don't know if this is a good number or not) then everything beyond that is simply not drawn? What if the program generates a really long hallway? Fog maybe? Or I could just not allow it to create stuff that long.

What do you think?


Posted: Wed Jan 26, 2005 1:26 pm
by :wumpus:
Yes, you could use fog for that, but as you have an inside environment you can better just make sure there is a doorway far before that that obscures the rest :) Fog looks cheap.

Btw, as everything is connected by doorways, your scene could very well be represented by a portal scene manager. A portal manager would render the current room, then only the rooms it connects to when the portal to them is visible (=lies inside the view frustrum), and so on.

Cool game idea btw.

Posted: Wed Jan 26, 2005 6:15 pm
by Rendman
Can someone give me an idea on how to implement portals with ogre mesh objects. Can I just apply a special texture to openings that I can use to identify it as a portal or what? Any help would be appreciated. Also if you know of any good links that had information of portals and the way they work that would be appreciated.


Posted: Wed Jan 26, 2005 7:46 pm
by epopov
Try this for portals related to Ogre: ... ght=portal

Try here for info on portals:

Posted: Fri Jan 28, 2005 4:43 am
by klepto
You might be interested in the Cube engine, which uses ray casting to determine visiblity. Performance is excellent.