Jump to content
  • entries
    941
  • comments
    5,894
  • views
    867,976

Another Design Puzzle


Josh

4,915 views

 Share

I have the basis of CSG editing written into the engine. It was a bit challenging to figure out just how to structure the Brush class. We have a lightweight ConvexHull entity, which is used for the camera frustum. This is an invisible volume that changes frequently, and is used to test whether objects intersect the camera's field of view. I didn't want to bloat this class with a lot of renderable surfaces, texture coordinates, vertex normals, etc. I initially thought I would derive the Brush class from the ConvexHull class, and make brushes a more complex renderable "thing" in the world.

 

I didn't want to create multiple rendering pathways in the octree system, so it made sense to derive the Brush class from the Entity class, so all the entity rendering pathways could be used to tell whether a brush should be drawn. However, both the Entity and ConvexHull classes are derived from the base class in Leadwerks3D, the Object class. This creates the diamond inheritance problem, where there are two Objects a Brush is derived from:

blogentry-1-0-41735200-1331610762.png

 

In the end, I derived the Brush class from the Entity class, and just gave it a ConvexHull for a member. This meets the needs of the system and is simple:

class Brush : public Entity
{
  ConvexHull* convexhull;
  ...
};

 

So with that out of the way, it's on to editing. There are three types of objects you can create in the Leadwerks3D editor. You can drag a model into the scene from the asset browser. You can create and modify brushes like in 3D World Studio. You can also create special entities like lights, particle emitters, sound emitters, and other items.

 

I'm ready to start CSG editing, but the thing that strikes me right away is I have no idea how object creation should work. You can drag models into the scene right now, from the Asset Browser. However, CSG brushes work better when they are drawn like architecture drafting:

blogentry-1-0-69024100-1331611212_thumb.jpg

 

For "point entities" 3D World Studio lets you position a crosshair, then hit enter to create the current object:

blogentry-1-0-24751800-1331611241_thumb.jpg

 

I'm not sure how we should handle brush and model editing in here. Usually when I run into a problem and am not sure how to proceed, I struggle with it a few days, but when I'm done, I am certain the approach I chose was best. Here's another one of those situations. Feel free to discuss and explore ideas with me in the comments below. Here's what the editor looks like at the moment:

blogentry-1-0-25060900-1331610377_thumb.jpg

 

--Edit--

 

Here's something I am playing with. The "Objects" menu contains a lot of brushes and special entities you can create:

blogentry-1-0-71641100-1331613420_thumb.jpg

 

This idea actually goes back to the old Quake 3 Arena editor, Radiant (which was otherwise a pretty difficult tool to use!):

blogentry-1-0-14723900-1331614013_thumb.jpg

 

You would still be able to drag a model into the scene from the Asset Browser at any time, but the brush and entity creation would be more like 3D World Studio. Of course, we also want the ability to move, rotate, and scale things in the 3D viewport as well! I generally don't like having multiple ways to do a thing, but the editing choices here make good sense. I'll keep playing with ideas and see what I come up with. Feel free to chime in, in the comments below.

 Share

17 Comments


Recommended Comments

Not sure why dragging a brush would not work directly, because if you have selected brush mode, dragging should do nothing else than create a brush. You could also use the tab key to quickly switch between brush mode and entity mode, like in Blender: vertex edit mode vs model mode.

Link to comment

I'm not sure if I understand what is a problem. In my view, method of drawing and modifying brushes, faces and vertices exactly like in 3DWS (click and drag) is close to perfection, very intuitive and allowing for really quick "sketch" of geometry.

If this interferes with the default editing principles in LE3D editor, you may want to consider two switchable modes: standard and editing of CSG (as Metatron already say). It seems to me that it would be a good option. In any case, I would be little disappointed if the way of CSG editing will be significantly different than in 3DWS.

Link to comment

Can I ask a silly question, who is this for? I might be missing something (quite probable in my deteriorating age).

 

I can't imagine if you were making a game that you would be creating assets in anything other than some dedicated package to get decent results. This is fine for throw away programmer art I guess.

 

But looking at it from a practical "I want to do this in my game..." I want to punch a hole in some object (a logical operation) or morph it in some way.

 

Beyond that I find it hard to see an artist wanting to do much with it. Gluing multiple objects together (combining meshs) is something an artist and programmer might want to do at run-time. That has a ton of uses. Blowing a hole in the side of a mesh is another (breakable walls with specified extent).

 

I just come at it from the point of view of "how does this enable me to create a game." And the artist I work with use Max to create content. If I want houses there's a ton of nice ones from Dexsoft or Arteria etc. that look professional for minimal cost.

 

Again apologies if I've missed the point.

Link to comment

@Flexman, as I'm sure you are aware 10 some years ago games like Half-Life use CSG for a decent amount of their level design. That can still be used today to make quality games that people will buy. Ideally you want level designers to make your levels not full blown artists (because they are 2 different talents) and level designers can work with CSG much easier than any 3D modelling program.

Link to comment

Flexman, the usefulness of CSG tools depends on the adopted methodology for the scene design.

For example: this is especially handy if we build a prototypes (method of successive approximations). You don't need to work constantly with the artist(s) or using the Max to make improvements on an ongoing basis in scene geometry. Treat CSG geometry as visible representation of a collision meshes. Only when you are sure the scene is well designed (by extensive gameplay testing) - you may give "CSG sketch" as base for implementation of detailed models by the artist in Max or other dedicated tool.

 

The reverse order (I have some nice models and now think of the game for them) rarely leads to success - at least in games where the level design is important for gameplay.

 

But, for example, for flight simulators CSG probably are not useful :(

Link to comment

Unreal Engine has CSG also. As good practice , CSG is great to make Level base , and once you made it ,we can add details, we can add meshes . It is much easier to construct levels ,to get proper sizes and make placeholders , test game play and then change it with models.Some parts of CSG level we can leave as it is, especially floors, walls etc. , combine them with other models to get great results .

CSG Lavel base:

 

www.gigantgames.com/images/CSG.jpg

 

Add mesh to get detailed level:

 

www.gigantgames.com/images/Mesh.jpg

Link to comment

Ahhh, I see, that makes sense. I remember seeing early QUAKE level editors which it reminded me of. I didn't realise there was still a demand for it. So it's good for creating rapid prototypes of level geometry.

 

OK I can appreciate that. Basic canyons decorated with Pure3D rocks come to mind as well as implementing colliders which are a pain. I learn something everyday smile.png Thanks for all the replies.

 

< gets it now

Link to comment
Guest Red Ocktober

Posted

i found csg level creation a real pain in the UDK... especially when creating expansive outdoor levels...

 

--Mike

Link to comment

CSG editors are additive or subtractive. I think UDK was subtractive which I have a really hard time with myself. I would rather build the structures like in the real world vs carve things from a block, but some people prefer carving from a block.

 

 

So it's good for creating rapid prototypes of level geometry.

 

Although this is one use, it can be used in the final production of the game as well as most every FPS game 10 years ago did, and a good number today still to. UDK is a good example as most games made with it will use csg in some fashion most likely. Of course as stated you can still add models to help with the realism. Artists aren't level designers and most likely don't understand the flow and all the details that go into making levels (it's a science from what I've been reading). They also change often during play testing so going back to an artist to do that would be costly and time consuming vs having some lower paid level designer to do it via csg.

Link to comment
Guest Red Ocktober

Posted

udk has both (for a while now)... additive and subtractive csg... and i'm sure, if i knew what i was doing, i can get around any perceived problems i'm imagining... but, while great for shooters, i don't see myself making a flight sim or a wide ranging naval sim with it...

 

don't get me wrong... it's a great dev platform... and it does what it's designed to to exceptionally well... the csg approach is the only thing i had issues with...

 

--Mike

Link to comment

It might actually work really well for flight sims, if you are low enough to see buildings, but yeah not sure where it would work with a naval sim.

 

I would think it would work well for Flexman where you have some basic buildings on the ground.

 

I'm hoping we can do prefabs with all of this too where we can save off our CSG creations to be loaded in other maps.

Link to comment
Guest Red Ocktober

Posted

It might actually work really well for flight sims, if you are low enough to see buildings, but yeah not sure where it would work with a naval sim.

 

if you've ever tried a flight sim you might have a lil more insight to what i'm talking about... the view out to the horizon would be the first issue you'd have to deal with... even if you're only a few feet above the tallest building in a scene...

 

try it in udk rick...

Link to comment

I'm not overly interested in flight sims myself, was just thinking that at first glance it would seem doable to use csg for buildings but if you've given it a try and have seen issues I'll take your word for it. Any details on the issues just for some knowledge transfer?

Link to comment

We spent a lot of time refining simple compound structures which I think could have been built VERY quickly in this manner, they are simple walls and buildings joined together in various combinations. What's the term for that, greeble or something? We sacrificed the ability to blow down walls and inflict local structural damage for performance. I have no regrets about that.

 

I totally get it now and see a use, indeed would have had a use for it but just didn't know it.

 

As for editing of objects, I think (taking some experience from watching my kids play LittleBigPlanet) you can get away with an awful lot by drawing an outline with various shaped brushes, then extruding it along an axis. And doing the same thing with a different shape and joining the two parts together. Repeat.

 

It's easy enough to do with a joypad and child's play.

Link to comment

Of course Flexman, we have to learn every day :( There is great tutorials made ​​by Zak from 3dBuzz where you can see all about how to use CSG and combine it with 3d models to get great looking level.

http://www.3dbuzz.com/vbforum/sv_showvideo.php?v=3743

 

I have learn a lot from those Tutorials .

 

Also in Unreal CSG boxes are used for defining special volumes for ambient sound zones, post processing zones , Light mass etc.

Link to comment

I assume we will be able to use all that CSG goodness in real-time with code?

Yes the API will be available and documented. Bear in mind this is pretty low-level stuff and is a little harder to use than the simple surface commands. It's not really meant to be something the end user needs, but I'm sure someone will come up with something cool from it.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...