VRML cells & portals - HOW?
Hi NG,
I'm working on an architecture-file (a house in VRML) and want to
optimize the rendering performance by preventing the calculation of
things that aren't seen. I found an opportunity at blaxxun's site
called cells & portals.
Unfortunately I don't get how the mechanism works, although I've read
the descriptions at blaxxun and the very few texts I found with
google.
What I understood so far is that I have to define e.g. rooms as cells
and doors or windows as portals. If a portal isn't visible for the
viewer, the corresponding cell isn't either. The aim is to decide in
real time wether to remove those cells (and their content) from the
3D-scene or show them, by checking the visibility of their portals.
My problem is that I don't even get how I have to define those cells &
portals. In my understanding everything must be wrapped by a CellGroup
node. Then the "cells" field of that CellGroup node must be filled
with the list of cells (rooms and content). Then I have to define the
portals by specifying the "window" geometry in the "coord" field of
each Portal node. Each Portal points to a corresponding cell (which is
seen through that portal).
I tried it with just a small house (one room). The user starts outside
the house (default viewpoint). The house has a door and a window
(=portals Pdoor and Pwin). Inside the house there's a sofa
(="Content"). What I want is to remove the sofa if the door is not
seen, but it doesn't work - the sofe is never there! Does anybody know
where my mistake is?
Here's my cells&portals code:
CellGroup {
cells [
DEF Cell_0 Cell {
children []
portals[
DEF Pdoor Portal {
coord Coordinate {
point [
-3.04 0 1.917,
-3.04 1.05 1.917,
-3.04 1.05 1.067,
-3.04 0 1.067
]
}
cell
DEF Cell_House Cell {
# the sofa:
children DEF Content Transform {...}
}
},
DEF Pwin Portal {
coord Coordinate {
point [
.015 .625 .569,
.015 .834 .662,
.015 .945 .899,
.015 .906 1.169,
.015 .736 1.345,
.015 .514 1.345,
.015 .344 1.169,
.015 .305 .899,
.015 .416 .662,
.015 .625 .569
]
}
cell USE Cell_House
}
]}
]}
I'd be glad if one of you could explain the (VRML) cells & portals
mechanism to me or give me links where I can find better and detailed
information about it.
Thank you very much,
Ulli
p.s.: I hope my english is good enough!
|