Page 1 of 3 123 LastLast
Results 1 to 20 of 58
  1. #1

    Quake (1996 game) bsp import script

    I'm not sure how many people here will want to import level geometry and textures from a 17 year old game, even if it is pretty much the best game ever, but I thought I would upload it just because there might be someone, or it might be useful for someone who wants to write their own mesh importer for some other game etc.


    The script takes any valid Quake 1 BSP file and loads each model as a separate mesh. Quake stored textures in each .bsp file, so the textures are also loaded as materials and applied to the meshes. There are a couple of simple import options to disable creation of materials, load only the main level geometry and also a scale parameter.


    Download it here:
    http://www.quaketastic.com/upload/files/misc/blender-quake_bsp_importer-v0.0.4.zip


    Pics:
    http://i.imgur.com/Xt8UkAN.jpg
    http://i.imgur.com/G4pKc8k.jpg
    http://i.imgur.com/kZ8F6WR.jpg


    Readme:
    Code:
    -- Quake 1 BSP Importer for Blender --
    by Andrew Palmer 2013.06 (Quake was released in 1996.06, so I'm a bit late)
    
    
    Usage -------------------------------------------------------------------------
    1. Extract to blender scripts/addons/
    2. In user settings go to addons and enable 'Import-Export: Import Quake BSP format'
    3. from the File menu, select import>Quake BSP (.bsp)
    4. Choose a valid Quake 1 .bsp file
    5. Assuming everything worked, your scene should contain all the models in the bsp,
       though you may need to move/rotate the camera to see them.
    
    
    There are several options available when importing:
    + Scale - scale down the level on import (default 0.05)
    	Quake units are 64units ~ 2m (assuming Quake guy is short and stocky)
    + Create materials - enable/disable creation of materials (default on)
    + Worldspawn only - when enabled, only the first model (the worldspawn entity,
    	or main level geometry) is loaded. (default off)
    
    
    Tips --------------------------------------------------------------------------
    You might not be able to see textures, even if the viewport is in textured mode.
    To fix this, press 'n' with the cursor in the viewport to open an options panel
    on the right. In here, expand the display options and set shading to 'GLSL'.
    
    
    It's easier to view the level with backface culling enabled. To do this, open
    the display options (see above description) and check 'Backface Culling'.
    
    
    Everything might be black if there is no Lamp object in the scene. To fix this,
    either set the existing lamp to Hemi, or add a new hemisphere lamp (Add>Lamp>Hemi).
    
    
    The textures will probably look like hell since they are very small by modern
    standards and filtering destroys them. To see the map with nearest (non-filtered)
    texturing, open the 'System' tab in Blender User Preferences (ctrl+alt+u) and
    uncheck 'Mipmaps'. 
    
    
    All vertices can be welded to create a seemless mesh, but this script does not
    weld them. If you want to weld the vertices, the easiest way is to enable auto
    snapping of vertices moved to the same location, select a mesh, enter edit mode,
    then move it. Blender will snap all the vertices. Note that this has been observed
    to cause texture alignment problems in some maps.
    
    
    History -----------------------------------------------------------------------
    0.0.4
    + fixed crash bug caused by texture names not being 0 padded in many older bsps
    + prints bsp version on import (only to terminal, most users won't even see this)
    0.0.3
    + added scale option (scale geometry on import)
    + added create materials option (use textures from the bsp to create and assign materials)
    + added worldspawn only option (import just the main map geometry, not doors, triggers etc.)
    0.0.2
    + now imports textures from the bsp as materials
    + uvs and materials are applied to faces
    0.0.1
    + import bsp imports all models in a bsp file as objects in a blender scene
    
    
    Suggestions For Improvements --------------------------------------------------
    + improve import speed
    + bsp import from pak file (by name would be fine)
    + import light map data
    + filter based on entity type model is attached to
      - don't import triggers
      - name objects by entity type
    + optionally weld model vertices on import
    + optionally use external textures (can do this by exporting to another format)
    
    
    Known bugs --------------------------------------------------------------------
    + import speed is very slow on large maps (can take several minutes on very large maps)
    + might not work on Mac?
    
    
    Thanks ------------------------------------------------------------------------
    + John 'Metlslime' Fitzgibbons for the uv conversion code
    + People in #blendercoders and on blender.stackexchange.com for help
    + The people who wrote http://wiki.xentax.com/index.php?title=Blender_Import_Guide
    + The people who responded to my thread on BlenderArtists and pointed out bugs
    + The authors of http://www.gamers.org/dEngine/quake/spec
    + Everyone involved in making Quake and the Quake community
    Last edited by Mr_Flamey; 21-Jun-13 at 08:43. Reason: updated script to fix bug and updated text file area



  2. #2
    I forgot to mention that if anyone actually wants to try this script, you can find level bsp files on this site: http://www.quaddicted.com/ in the maps section. The original levels are contained in Quake/ID1/pak0.pak and pak1.pak, and although extracting them is fairly trivial, I did not add any tool to do this in the importer. There are tools available to extract the files from .pak files for Windows, though I'm not sure if such a tool exists for Linux. There are lots of tools available here: https://www.quaddicted.com/files/tools/ (hint: try pakscape, pak explorer, qped2 etc.)



  3. #3
    Member laune's Avatar
    Join Date
    Dec 2008
    Location
    germany
    Posts
    93
    not sure what to do with it, but I think it's great. Thanks a lot for your contribution! Quake1 was also my favourite fps game ever.



  4. #4
    Member PyroGXPilot's Avatar
    Join Date
    Jul 2011
    Location
    TILLAMOOK, OR
    Posts
    718
    Man this is one of the coolest thing ive seen in Blender



  5. #5
    I totally love it! I'll "play" with it surely... just one question: it would not work with Quake 3 BSPs, doesn't it?

    Thanks!!



  6. #6
    Member
    Join Date
    Jul 2005
    Location
    Southwest Texas
    Posts
    3,674
    @Mr_Flamey: Nice!

    Would you be able to fix Quake 3 map exporter by chance?
    Kot-in-Action Creative Artel - a factory of the awesome games! http://www.kot-in-action.com
    Steel Storm series - brilliant action/shooter/adventure games ! http://www.steel-storm.com



  7. #7
    Sorry, it only works with Quake 1 bsps. I played, but was not a big fan of Quake 3 to be honest, since I really enjoyed the single player modes in the first two games, and played Quake 2 multiplayer, rocket arena and ctf way more than I played Q3. Despite many people complaining that Q2 was too slow, I enjoyed it a lot.

    motorstep: Sorry, I just wanted to write a script that would import Quake bsps and don't have any plans to expand it. I think there already is a Q3 map export script though, so have a look and see if it still exists and works.



  8. #8
    Member
    Join Date
    Jul 2005
    Location
    Southwest Texas
    Posts
    3,674
    Quake 3 .map exporter is bundled with Blender and works, but it doesn't work correctly (order of brush faces is screwed up in the output, wrong strings are being written, etc.)

    http://projects.blender.org/tracker/..._id=9&atid=498
    Kot-in-Action Creative Artel - a factory of the awesome games! http://www.kot-in-action.com
    Steel Storm series - brilliant action/shooter/adventure games ! http://www.steel-storm.com



  9. #9
    Member PyroGXPilot's Avatar
    Join Date
    Jul 2011
    Location
    TILLAMOOK, OR
    Posts
    718
    i notice it fails on Aerowalk/pkeg



  10. #10
    Member Mahalin's Avatar
    Join Date
    Feb 2013
    Location
    Greater Los Angeles Area
    Posts
    558
    I'm getting an error on importing ns maps:

    Read new prefs: C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.67\co
    nfig\userpref.blend
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.67\python
    -- IMPORTING BSP --
    Source file: D:\Program Files (x86)\Steam\SteamApps\common\Half-Life\ns\maps\co_
    core.bsp
    bsp contains 113 models. (faces = 8194, edges = 19911, verts = 11202)
    -- LOADING TEXTURES --
    [0] 'door_yellgrey02' (128x128 16384bytes)
    [1] 'flr_grey02 ents' (128x128 16384bytes)
    [2] 'fx_damage07 g..' (128x256 32768bytes)
    [3] 'fx_elevator2 ..' (256x128 32768bytes)
    [4] 'fx_lgt_panel02' (128x32 4096bytes)
    [5] 'light_panel02 s' (128x32 4096bytes)
    [6] 'misc_damage01 s' (64x64 4096bytes)
    [7] 'misc_damage07 s' (128x256 32768bytes)
    [8] 'misc_doortrack' (32x128 4096bytes)
    [9] 'misc_pipes03 ts' (128x128 16384bytes)
    [10] 'misc_pipes05 ts' (128x128 16384bytes)
    [11] 'wall_grey08 nts' (128x128 16384bytes)
    [12] 'wall_panel01 ts' (256x256 65536bytes)
    [13] 'wall_panel05 ..' (256x256 65536bytes)
    [14] 'wall_panel08 ts' (256x256 65536bytes)
    [15] 'wall_panel11 ts' (256x256 65536bytes)
    [16] 'wall_panel14 ts' (256x256 65536bytes)
    [17] '{floor_panel02' (128x128 16384bytes)
    [18] '!r25_stagnant' (128x128 16384bytes)
    [19] '+0nos_ind ant' (16x16 256bytes)
    [20] '+1nos_ind tor r' (16x16 256bytes)
    [21] '+2nos_ind tor r' (16x16 256bytes)
    [22] '+3nos_ind tor r' (16x16 256bytes)
    [23] '+4nos_ind tor r' (16x16 256bytes)
    [24] '+5nos_ind tor r' (16x16 256bytes)
    [25] '+6nos_ind tor r' (16x16 256bytes)
    [26] '+7nos_ind tor r' (16x16 256bytes)
    [27] 'hint walllights' (16x16 256bytes)
    [28] 'joinaliens-b ts' (256x64 16384bytes)
    [29] 'nos_pipe2 nel 2' (48x16 768bytes)
    [30] 'observe-b 11' (256x64 16384bytes)
    [31] 'r25_monitorbox2' (128x64 8192bytes)
    [32] 'skip lights3 2' (16x16 256bytes)
    [33] 'wall_lab2 e3' (256x256 65536bytes)
    [34] 'black 26 a 03' (32x32 1024bytes)
    [35] 'clip ebar 2' (16x16 256bytes)
    [36] 'origin l h r' (16x16 256bytes)
    [37] 'sky litedawn' (16x16 256bytes)
    [38] '{blue d e' (16x16 256bytes)
    [39] '{fence lr 1 e' (256x192 49152bytes)
    [40] '+0~nos_wklt' (64x48 3072bytes)
    Traceback (most recent call last):
    File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_mesh_
    bsp\__init__.py", line 75, in execute
    bsp_importer.import_bsp(context, self.filepath, options)
    File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_mesh_
    bsp\bsp_importer.py", line 263, in import_bsp
    texture_data = load_textures(context, filepath)
    File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_mesh_
    bsp\bsp_importer.py", line 125, in load_textures
    miptex_name = miptex.name.decode('ascii').rstrip('\0')
    UnicodeDecodeError: 'ascii' codec can't decode byte 0x8d in position 12: ordinal
    not in range(128)

    location: <unknown location>:-1

    location: <unknown location>:-1
    And on a different map:
    Read new prefs: C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.67\co
    nfig\userpref.blend
    found bundled python: C:\Program Files\Blender Foundation\Blender\2.67\python
    -- IMPORTING BSP --
    Source file: D:\Program Files (x86)\Steam\SteamApps\common\Half-Life\ns\maps\co_
    faceoff.bsp
    bsp contains 99 models. (faces = 6087, edges = 14594, verts = 8376)
    -- LOADING TEXTURES --
    [0] 'miptext_name1' (16x16 256bytes)
    [1] 'miptext_name2' (16x16 256bytes)
    [2] 'miptext_name3' (64x64 4096bytes)
    Traceback (most recent call last):
    File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_mesh_
    bsp\__init__.py", line 75, in execute
    bsp_importer.import_bsp(context, self.filepath, options)
    File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_mesh_
    bsp\bsp_importer.py", line 265, in import_bsp
    texture_data = load_textures(context, filepath)
    File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_mesh_
    bsp\bsp_importer.py", line 132, in load_textures
    pixels_pal = struct.unpack('<%dB' % miptex_size, file.read(miptex_size))
    struct.error: unpack requires a bytes object of length 4096

    location: <unknown location>:-1

    location: <unknown location>:-1
    If I replace line 125 with a different name format, it works.

    BTW, this plugin came just in time. TY!
    Last edited by Mahalin; 20-Jun-13 at 14:32.



  11. #11
    PyroGXPilot: Wow, thanks for spotting that; I didn't exactly test it very thoroughly to be honest. I knew that because the texture names contained special characters that can't be used in windows filenames I couldn't save the textures out, but the generally work in the blend file. I will have a look at that bug and see if I can fix it.
    Last edited by Mr_Flamey; 21-Jun-13 at 08:58.



  12. #12
    Mahalin: Are you trying to import half-life bsps? I think that would require a different importer since although the bsp format used by Half-life is similar to Quake, I doubt they are the same. However, if you managed to get a half-life bsp loading just by changing one line of code, I'd love to see a pic of the level you loaded. If it works I can add half-life maps as an officially supported option I guess.

    Still, I'll check out Aerowalk and Powder Keg.
    Last edited by Mr_Flamey; 21-Jun-13 at 08:54.



  13. #13
    Ok, the bug is fixed. Turned out is was simply caused by texture names not being 0 padded (only 0 terminated) in bsps compiled with older compilers and all the maps I was testing were recent.

    New version here:
    http://www.quaketastic.com/upload/fi...ter-v0.0.4.zip

    Aerowalk: http://i.imgur.com/CQ1iRgQ.jpg
    Powder Keg: http://i.imgur.com/230kPmm.jpg
    Death by the Dozen: http://i.imgur.com/SYzciYz.jpg



  14. #14
    I have made some additions to Mr_Flamey's cool importer script as v0.0.5. Blender 2.68a must have changed bmesh enough so that a change was needed in the way UV coords are mapped. Version 0.0.5 adds options to use cycles shader nodes and an option to create lights based on the entities list.

    Here is a cycles rendered map with water (glass shader)
    q1e1m2mitsubaTonmap.jpg

    Here is a blender internal rendered map with lights
    q1startBlenderRender.jpg



  15. #15
    Thanks for that importer and the update delivering that nostalgia from the past

    http://i.imgur.com/fn6wBoZ.png



  16. #16
    Originally Posted by slight View Post
    I have made some additions to Mr_Flamey's cool importer script as v0.0.5....
    Wow, great work! It's unreal how close the renders look to Quake screenshots. I'd love to see how stuff looks with ambient occlusion and no textures, but most Quake maps look pretty crap, so I doubt it would be so great. Originally I made it with the intention of adding details to some Quake maps I made and doing a couple of nice renders, but I got distracted by other things



  17. #17
    Member Safetyman's Avatar
    Join Date
    Mar 2010
    Location
    Maryland, USA
    Posts
    1,213
    Does this script also import the character models (the monsters and such)?
    Quicksand has no sense of humor



  18. #18
    Member Atom's Avatar
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    11,632
    I brought in a BSP map, added a remesh modifier in block mode and followed that with a bevel.
    Attached Images Attached Images
    I rarely use Blender anymore.
    Houdini Indie is only $200.00 and Apprentice is free!
    Atom's Links Page



  19. #19
    Member
    Join Date
    Jul 2005
    Location
    Southwest Texas
    Posts
    3,674
    Has anyone tried the add-on with Blender 2.75+ ?
    Kot-in-Action Creative Artel - a factory of the awesome games! http://www.kot-in-action.com
    Steel Storm series - brilliant action/shooter/adventure games ! http://www.steel-storm.com



  20. #20
    Member eppo's Avatar
    Join Date
    Jul 2011
    Location
    Jurmala, Latvia
    Posts
    5,310
    Did try. Script needs 2 lines more and it just works.
    http://www.pasteall.org/pic/show.php?id=92335

    ... and this marvel..Too bad, looks like it's not a single player mod.
    Last edited by eppo; 26-Aug-15 at 15:14.



Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •