Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by cgk, posted on August 14, 2001

Image Description, by cgk

This is a screenshot of the editor to my gfx engine "Vision3". There is still a lot to be done, but the engine already features: -sector/portal visibillity using sectors and portals generated with a CSG based algorithm. I've never seen such an approach in any app, but i think this is a very innovative technique, as it generates really good portalization with nearly no processing time and not too much to care for by the artist.
  • an advanced high lvl CSG algorithm, which leads to damn fast rebuild times
  • damn fast rebuild times :)
  • a geometry optimizer caple of removing practically all unnecessary geometry splits introduced by CSG
  • collision detection using per sector BSPs and portals
  • lightmaps and vertexlighting
  • rendering using DirectX8
  • the nemesis of every MFC programmer: an editor with an UI which can actually handle resizing windows and dialogs! ("bla.Anchors := [ akLeft, akRight, akTop ]" ...) ;))
  • the next things i want to do are:
  • add support for external objects (like decoration, done in 3ds or something)
  • add more material features (or better: implement them :) )
  • improve the lighting system by adding more light types. (i'm very optimistic that you can fake equal or better looking results than most radiosity implementations feature with simple stuff like normal raytraced pointlights, ambient pointlights, "ambient directional pointlights (:))" and stuff like that ... and still have an acceptable rebuild time^^)
  • I'm kinda proud of the project, mainly because i've done it on my own. The ideas and algorithms for the CSG, geometry optimizing and portalizing were all 100% generated in my mind :) (although that doesnt necessarily have to mean that no one generated them before *g*). I've come farer than i expected...

    I just released the first "public" preview of my Editor to show off my tek a bit ;).

    The project homepage is at There you can find more infos, screenshots and - of course - the editor download (although the demo "level" still suffers from "programmers art" quite a bit... so if anyone would make something cool with it, i'd like to see^^).

    Gerald "cgk" Knizia

    Image of the Day Gallery


    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
    Angel Popov

    August 15, 2001, 03:05 AM

    This looks a lot like the level editor for my 3D engine.
    It also has features like CSG, automatic(nearly perfect) portalization, very fast rebuild times, a geometry optimizer(capable of removing small holes caused by the CSG to reduce splits)...
    The portalization algho is quite different from yours.
    I first do the CSG then rebuild the BSP from the CSGed polygon soup using some heuristics for balance, least number of splits, etc.
    Then I create the portals from that BSP (like most PVS compilers do) and finaly merge the adjacent sectors using this heuristc - take two adjacent sectors, find their convex hull, contract that hull and don't merge the sectors if the contracted hull contains large polygons. The order in which the merges are tried is very important -I collect all coplanar adjacent portals and evaluate their contour (is it convex, does it have edges that "hang" in the air, how big is it) and give that contour some score (higher scores for contours that will form nice portals). Merges of sectors located on both sides of such high score contours are performed last. There are many other small tricks to make this work well. The autoportalization is performed only using brushes marked as structural to avoid small details adding extra portals.

    Here's a screenshot: ,
    and here's the editor: (2.6M)


    August 15, 2001, 04:23 AM

    i cant test it, but that looks like a damn fine editor too. nice map.

    Dean Harding

    August 15, 2001, 05:03 AM

    Wow, I'm really impressed! I've been meaning to do some sort of indoor engine for a while. This was a sort of inspiration for me!

    One problem, when I try to move up/down in the 3D view, or zoom in/out in the 2D views (i.e. when I try to do the "left+right at the same time" thing), it doesn't work. It'll move a little way, then it seems to "forget" the right button is pressed, and when I let go, it selects whatever is under the mouse.

    Perhaps if you made it a middle button feature. Most mouse drivers include a "both buttons = middle button" option anyway. Maybe make it an option?

    Maybe it's just these dodgitech mouse drivers (I have one of those funcky cordless mouseman optical deals)


    August 15, 2001, 06:18 AM

    i also allow concanve brushes and therfore concave sectors. later added brushes ("added" in terms of "fill volume with solid space") also remove their volume from sectors, so that some more complex situations can result. a sector in my interpretation is more or less a bunch of polygons (which are more or less in the same area) and a bunch of portals connecting the sector to other sectors


    August 15, 2001, 06:20 AM

    yes, the frontend is written in delphi. i think it's the best tool for creating UI's. everything that needs more processing time (all the rebuild stuff, rendering and so on) is written in VC however

    Steve 'Sly' Williams

    August 15, 2001, 06:37 AM

    It seems to be a common misconception that Delphi is slower than VC. I think that if you had written your backend stuff in Delphi, you would not notice any difference speed-wise. Borland compilers are just as good as Microsoft's.


    August 15, 2001, 07:09 AM

    I've never seen such an approach in any app, but i think this is a very innovative technique, as it generates really good portalization with nearly no processing time and not too much to care for by the artist.

    While at Assembly2001 in helsinki, I went to a seminar with the Unreal coder Tim Sweeney and he showed the level editor in Unreal 2 which will be shipped later and also discussed all kind of stuff going on in their engine.

    They seemed to go the same way as you do in your editor, using CSG in the editor and portals for the rendering.


    August 15, 2001, 07:21 AM

    >> I got some more ideas on the portal detection problem. It's really an extention of what I mentioned earlier. To find the portals connecting a pair of brushes A and B, we first find their intersection int(A,B). In general, this will be a set of faces (possibly empty). For each of these faces, we see if they fall inside a face of either A and B or is identical to one. The faces that fulfill this will be stored in a list of portals.

    Well, you got the idea, its about like that. But i dont do a real CSG Intersect operation, more
    a "GiveMeAllPolygonsOfBrush1WhichAreInsideBrush2" (and reverse) operations, so i dont have
    to check which which polygons came from where. I've written a short description of the high lvl
    CSG process. I'll give it to you when we meet on IRC again.

    >> One thing we need to do is to define an inside/outside relation between a point and a sector. In the concentric boxes case, a point inside the small, inner box is in fact within both boxes; there is ambiguity. If we construct a brush hierarchy (i.e. the small box is contained within the larger box) then we can deal with this case by simply pushing points down this forest of brushes.

    right, thats a much more tricky problem than it might seem to most ppl. Basically i do that by using the per sector collision BSP tree for that, because a single brush will usually not define a sector on its own. Then i use a kind of "for each sector(in reverse creation order): test if point is empty space of BSP -> if yes: sector found -> if not: point is not in this sector" algorithm for that. Well, it may not seem very elegant but it's practical because it is simple and i need the BSP anyway :).

    >> One tricky case is when two brushes interpenetrate without one being fully within the other. I guess we could just explicitly disallow such case or introduce e.g. volume-based heuristics for determining the parent/child relationship between the interpenetrating brushes.

    right, also that is a tricky case, which should usually be avoided. in my engine such a setup will generate two sectors, but in at least one sector not all geometry will be connected... (forming two
    sector volumes). I didnt put any special handling for this case in tho. This case works even if everything is threated like all other setups are.


    August 15, 2001, 07:30 AM

    wrt Delphi - I used to be quite a fan of Borland C++ Builder, which is basically Delphi in C++. And yes, as a GUI designer goes, it beats the stuffing out of MSVC++. You can get older version for free on coverdisks and things, without the 'export' licence.

    Shame about the help files though - you want MSDN on hand at the same time ;)


    August 15, 2001, 08:12 AM

    I especially like the GUI, gray is easy on your eyes, especially at night :)


    August 15, 2001, 11:05 AM

    I especially like the GUI, gray is easy on your eyes, especially at night :)

    Ahhh. That's why those quake textures are so dark ;-)


    The Wolf

    August 15, 2001, 12:47 PM

    SOLID, well done. Do you think using VB would make the editor easier to put together?

    Rasmus Christian Kaae

    August 16, 2001, 08:01 AM

    After the first impression of "wow he spend a lot of hard time on this project" the first thought in my mind was "why the heck does he code/comment the code in german?".

    I normally code/comment everything in english.


    August 16, 2001, 12:51 PM

    Hmmm I always thought Borland compilers were way better (faster, more conformant to standards like ANSI C/ISO C++) than Microsoft's. And TASM beats the crap outta MASM any day =)

    I agree with you, Delphi/VC and Pascal/C should be equally efficient when in the hands of an experienced programmer, because although they differ in syntax and libs among other things, they should compile similar code.


    August 16, 2001, 03:36 PM

    Well. The engine sourcecode is completely coded&commented in english. The editor frontend it mostly coded&commented in german. since i thought that i'd probably be the only one who sees the sourcecode of this stuff anyways, i decided to do that it in german. its much more natural to me. probably it might have been a better idea to do everything in english.


    August 21, 2001, 11:05 AM

    Finally someone who appreciates the fine art of Delphi coding! =)

    I write all my visual tools in Borland Dev. suites, too =)

    Anyways, good work and keep us posted! :)


    December 12, 2001, 05:58 PM

    If you're even replying to this thread anymore:

    I'm actually doing some work in Borland C++ Builder right now (close enough I'm assuming to Delphi Builder), and was wondering how you accomplished those 4 viewports? What controls did you use, and what did you do to get the splitters in there?

    I'm finding it really really hard to get it to work, I'm using panels right now, and aligning them just causes havoc, good luck getting a splitter in there...

    Very nice work on your editor, I'm impressed, as I've been trying to write an editor for a long while now, but I restarted very recently as I decided to switch to Borland Builder. I made it up to about the point of implementing CSG, but that gave me a really hard time... :(


    December 12, 2001, 08:45 PM

    Nevermind, after more trying, I got it all to work... yipee!

    This thread contains 48 messages.
    First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.