Create .bsp models from within maps

Discuss the creation of various model formats for Quake engines, and related matters to modeling.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Create .bsp models from within maps

Post by Cobalt »

So we have bsp models in the health and ammo boxes and the exploboxes which are dynamic and can be spawned on any map.

Doors, plats and func_walls use models referenced in the map with an asterisk prefix, IE: model *69

While these ents have an absmax and an absmin that points to their upper and lower bbox coordinates, their .origin is world or '0 0 0' ...according to my tests within QC.

Would it be possible with a map editor to extrace these models, and save them as seperate bsp type models like the ammo boxes , healths etc?

I ask because there are these items for example....one is a teleport which has (5) seperate models embedded in E1m3, and the various telepads on the maps for example:

http://imgur.com/o1XK3tY


http://imgur.com/XbDGAkA
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Create .bsp models from within maps

Post by ceriux »

why not just remake them yourself?
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Create .bsp models from within maps

Post by Spike »

you could use an external bsp object, sure... except that your lighting would be as terrible as mdl is. and probably worse than that.
full rtlights could help solve that, but they're not exactly cheap.
you'd also need a new progs.dat
whats wrong with using prefabs?
some engines will have issues despite this.

actually, I believe inline models were an afterthought. its easier to design your map and light it properly when each thing is part of a single whole, instead of editing it and affecting lots of other maps too. plus there would be obvious lighting discontinuities.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Create .bsp models from within maps

Post by Cobalt »

Not an adept modeler yet.
ceriux wrote:why not just remake them yourself?
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Create .bsp models from within maps

Post by Cobalt »

Hrm, well there is a util MH wrote that will make a .lit for any bsp map, and it will also lit a bsp model , I found that out inadvertently one day. So thats one possibility.

Not sure why a new progs.dat is needed? In case you misunderstood, the idea is to create a new bsp model using the dats for the embedded model in the map. SO in the end , we use spawn () like we would any other model such as the health and ammo boxes...though the engine is "quaking" map items without the spawn function, I am guessing theres nothing special going on spawning a bsp type model vs a regular .mdl ....

Dont know what a prefab is, but I like the idea of a teleporter like shown that you can spawn on a map, same with the telepads...though for the telepads, they are really part of the BPS and not a model, so I guess extracting the "brush" coordinates would be what to do there, but I am not sure.

I guess you are saying you have to "bake" the BSP with light just like any other map ?

Spike wrote:you could use an external bsp object, sure... except that your lighting would be as terrible as mdl is. and probably worse than that.
full rtlights could help solve that, but they're not exactly cheap.
you'd also need a new progs.dat
whats wrong with using prefabs?
some engines will have issues despite this.

actually, I believe inline models were an afterthought. its easier to design your map and light it properly when each thing is part of a single whole, instead of editing it and affecting lots of other maps too. plus there would be obvious lighting discontinuities.
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Create .bsp models from within maps

Post by mankrip »

External BSP models have their own lightmap, which is not lit by world lights.
Put ammo boxes in a dark area of the map, and they'll look terribly out of place, because they will still be lit as if they were in a bright area. That's worse than MDL lighting.

Makaqu 1.6 fixes that by using the lightpoint value of the world to change the lightmaps of the external BSP models; I don't know of any other engines that does this. However, that solution isn't as accurate as making those models part of the world's BSP.
For some of the other engines, as Spike said, you can use full real time lighting, which is slower and doesn't look the same.

Teleporters and telepads usually don't move, so there's no point in separating them from the world. And in an ideal scenario, there would probably be no external BSP models; exploboxes, ammo, health, etc would all be prefabs compiled within the map. Too bad the default progs.dat doesn't support that.

By the way, the .origin of inline BSP models being '0 0 0' is atrocious, because it ruins things when we want to make an inline rotating BSP model that's properly lit, since afaik BSP models only rotates around their .origin.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Create .bsp models from within maps

Post by Spike »

there are ways to avoid an origin at '0 0 0'. Different ways... many of them awkward but used anyway... depends which tool you use... my favourite is the origin brush method, but most q1 tools seem to prefer targetting some point entity instead.
hexen2 actually has an abslight field, allowing the mapper to explicitly set the single light value used on the bsp object. its a lazy way around dodgy lighting, and results in flat-looking movers that makes it obvious that it moves. it solves the imediate problem, anyway. its also used on transparent teleporters, giving them a slightly etherial look, so hurrah for that.

a prefab is basically a collection of brushes that can be inserted and moved into place, but compiled as part of the map instead of being a separate entity. most map editors support some sort of prefab, some even provide a few!
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Create .bsp models from within maps

Post by Cobalt »

No they dont move but like I say, it would be a neat feature if they were able to be spawned like any other model from within QC. From a modding perspective....lets see. Take the models that are the glass windows for example like on e4m3 (elder god). Lets say you wanted to make breakable glass windows on other ID maps that dont have them. So you recompile those maps with those stained glass window textures to be left out, and you spawn the new window model where that texture was on the map. GIve it some takedamage , health and a .th_die and you have real windows. True, you probably would have to make new brushed behind them like sky textuyres or whatever, but the general idea is the same.

Well if the health and ammo boxes etc were all static as part of the map, you could not re-arrainge them differently in coop vs deathmatch for example. Unless by prefab you mean that you can spawn them in different locations, just that their movetype = 0 ?
mankrip wrote: Teleporters and telepads usually don't move, so there's no point in separating them from the world. And in an ideal scenario, there would probably be no external BSP models; exploboxes, ammo, health, etc would all be prefabs compiled within the map. Too bad the default progs.dat doesn't support that.

By the way, the .origin of inline BSP models being '0 0 0' is atrocious, because it ruins things when we want to make an inline rotating BSP model that's properly lit, since afaik BSP models only rotates around their .origin.
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Create .bsp models from within maps

Post by mankrip »

Inline models are the solution you're looking for. They are not static, but they're compiled within the world.

Prefabs and inline models are different things. Prefabs are just brushes, and you can use them on either the world model or inline models. Prefabs used on the world model becomes a static part of it.

Inline models are individual entities. They are not part of the world, but their models are compiled within the world. Doors, platforms and buttons are inline models.

Inline models are also called "submodels" in the engine code.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Create .bsp models from within maps

Post by r00k »

I would think using an alias model would be easier for a broken window; using an animation for all the broken pieces.
also a vanilla engine only has 256 submodels...
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Create .bsp models from within maps

Post by mankrip »

Oriented SPR sprites would be more accurate than MDL models. Their texture UV mapping algorithm is mostly the same as the BSP surface UV mapping. You'd only need an engine with lit sprites support.

And for the window on the wall (either the intact one or the remaining portion of it after it's broken), an inline BSP submodel does the job.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Create .bsp models from within maps

Post by Cobalt »

Well the trouble with inline seems to be they are "baked" into the map and you cant spawn them dynamicly regardless if the map has them or not. Im not a mapper but from QC I can see they have an absmin and absmax value with respect to them which is also in correct to the map coordinates they appear in, in regars to their top and lower box corers of course. Their .origin is always world origin or ' 0 0 0 ' , and yea, I have seen QC that adds absmin and absmax then divides it in half to determine the center of that model, but from a "self" perspective (self being the actual model ent) , its .origin is world and in its traditional format all the ID maps with these kind of models use that system. My question was how to , if possible - make them into real .bsp models like the other bsp models are.

Regarding sprites, I think they are only 2 dimensional, at least last I checked, so I dont think they are an option here......
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Create .bsp models from within maps

Post by mankrip »

I don't see why glass shards would have to be "tridimensional". SPR sprites are flat, but they can be freely rotated in 3D space like any other model.

Also, why exactly would you need to spawn such BSP entities at custom locations? That's only really needed if you don't have the source of the map. If you have the source, you can create those entities anywhere you want.

And if you don't have the source, there's no way to remove the current windows of the map, so you can't really replace them.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Create .bsp models from within maps

Post by Cobalt »

Ok for the glass shrapnels sure could be sprites. But that was really just an example to illustrate the question better. Im more interested in making the models I linked photos to, but my question is, can a map editor go in and find the "inline" models that compose that teleporter, then somehow make it into one seperate bsp model? Same for the telepad, but I know its not a seperate model, and is permanently part of the BSP, but I was curious if its merely as simple as copying the brush es for that area into an editor and trimming off the excess under to make a spawnable telepad for example.
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Create .bsp models from within maps

Post by mankrip »

That's not possible, because they are part of the world model, and not inline submodels. The BSP compiler cuts out any part of them that isn't in an open space, so, for example, that telepad's brush doesn't have a bottom face anymore.

As for inline submodels, such as doors, that's technically possible, but I don't think there's any tool that does that.

However, there's a BSP "decompiler" somewhere, that can get a BSP map and try to create an appropriate .map source for it. I remember someone using it to convert Hexen II maps to Quake, and saying that the .map files had to be adjusted because the "decompiling" wasn't perfect.

Personally, I'd just open the BSP file in Quark and use it as a guide to manually create identical BSP models of the desired parts.
That's what I did to create the BSP sky models of the original ID1 maps for JoyMenu (which used those to make the skies non-solid, in a workaround for the "solid skies" bug of the original maps).
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
Post Reply