Forum

[SOLVED] common/weapclip on models

Discuss the construction of maps and the tools to create maps for 3D games.

Moderator: InsideQC Admins

[SOLVED] common/weapclip on models

Postby toneddu2000 » Mon Aug 25, 2014 12:18 pm

Hi guys, last night I(tought I) had a great idea. Let's face it: someone loves Radiant, someone hates it. I'm one of the haters, together with Adobe InDesign is my less favourite software! :D So yesterday I tought: "What if, I export an obj model from Blender with 2 objects, for example a column and a box surrounding it with shader common/weapclip I will solve my mapping problems, because the surrounding box will be the collision model of the column, as I always do with UDK: a model(s) and a collision model. That's it" But I was wrong. Darkplaces sees the 2 distinct shaders (the column and the weaplip one) but the player penetrates it.
So, weapclip is usable only for bsp brushes? There would be a way to added support even to misc_model? I still didn't try with FTE. Tonight I'll do it, but I think it's a quake limit. Let me know if one of you have found a way! :D
cheers
Last edited by toneddu2000 on Fri Aug 29, 2014 5:00 pm, edited 1 time in total.
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby toneddu2000 » Mon Aug 25, 2014 6:00 pm

Looking at my own previous post with a more "professional" eye, I undestand only now how stupid was my question: weapclip is just a transparent shader, nothing more. Is just the application to a bsp brush that makes it invisible AND collidable. Of course on obj models, that are not collidable on their own, it's completely useless. Sorry to have spoiled a forum entry. Anyway, my question remains (only modified a little): does anyone knows how to create a "collision hull" for obj models?
Thanks again
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby Spike » Mon Aug 25, 2014 7:42 pm

with vanilla quake3 tools, you can't. trianglesoup is strictly non-solid. only brushes+patches are solid.

with fte, you need to hack q3map2 to create a custom surfaceparm to set flag 0x80000000, and then add that to your shader. add 'surfaceparm nodraw2' as well, so its not visible. this avoids dedicated servers needing to parse shaders.
there's some file you can edit, I don't remember the details now, gb will know.
what? I don't make maps! I'm too lame for that! pff, don't look at me like that.

with dp, there's some special meshcollision flag that the engine parses specially.

if you add nodraw to your shader, q3map2 will delete those surfaces completely, so try to avoid using that (I have no idea how this is meant to then work with dp). this is why fte has a nodraw2 surfaceparm - engine behaves the same, but q3map2 doesn't see it.
Spike
 
Posts: 2883
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: common/weapclip on models

Postby toneddu2000 » Mon Aug 25, 2014 8:17 pm

with fte, you need to hack q3map2 to create a custom surfaceparm to set flag 0x80000000, and then add that to your shader. add 'surfaceparm nodraw2' as well, so its not visible. this avoids dedicated servers needing to parse shaders.
Thanks Spike, very helpful as always!I understood the nodraw2 part but I didn't grasp the Q3map2 hack part, Do you mean, by code? Should I have to hack Q3map2 source or do you mean to add in Radiant a flag 0x80000000. If so, what would be the key?

with dp, there's some special meshcollision flag that the engine parses specially.
Yeah,it's like this
Code: Select all
textures/common/objcollision
{
   qer_trans 0.4
   surfaceparm trans
   dpmeshcollisions
   {
      map textures/common/collision.tga
   }
}

if you add nodraw to your shader, q3map2 will delete those surfaces completely, so try to avoid using that (I have no idea how this is meant to then work with dp).
Exactly what I'm trying to understand! :D

this is why fte has a nodraw2 surfaceparm - engine behaves the same, but q3map2 doesn't see it.
Supercool! I want to test it imediately!
I'll make some other tests, I'll let you know. Thanks again Spike
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby toneddu2000 » Mon Aug 25, 2014 9:20 pm

ok with Darkplaces the problem is solved, I'll add it in my guide later but for now just settle with these 2 lines!
1) Create 2 objects in Blender (for other 3d apps I'm 100% sure it works), the real object with its material and the hull collision object with the material textures/common/objcollision. Figure1
2) Select the two objects and export to obj with these settings: Figure2. Important is the check"Objects as OBJs Groups" instead of "Objects as OBJs Objects". This will do the trick to group 2 objects in one obj and be recognized by NetRadiant. If your model has caps (like a cylinder) check also "Triangulate faces" or you model will be rendered "uncapped"
3) add this shader in the common shader file
Code: Select all
textures/common/objcollision
{
   qer_trans 0.4 //transparency only in editor

   dpmeshcollisions
   surfaceparm trans
   {
      map textures/common/collision.tga
      blendfunc add
      rgbgen identity
   }
}

create a 16x16 pixel tga image file with a simple black channel alpha named collision.tga and place it in textures/common.
4) compile the map and now the model should be surrounded by its collision model! I tested on NetRadiant on Linux.
NetRadiant on Windows seems not to like 2 objects together (PICOMODEL error). And GTKRadiant on Windows doesn't even display obj models (PICOMODEL error again).
If Spike can tell me more about that 0x80000000 flag on FTE, I'll try tomorrow to describe same technique on FTEQW
Thanks for the hint about special meshcollision flag on dp, Spike!
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby toneddu2000 » Tue Aug 26, 2014 10:04 pm

Little update: on Windows, with NetRadiant binary found here, this trick works too.
Just a side note to the mini recipe I wrote yesterday. When you create the shader texture, be sure the texture has an alpha channel, it has background BLACK and it's saved with 32 bit.

Please Spike, enlighten me with the FTE custom surfaceparm trick, so I can write it up! :D
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby Spike » Tue Aug 26, 2014 10:42 pm

Spike
 
Posts: 2883
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: common/weapclip on models

Postby toneddu2000 » Wed Aug 27, 2014 10:27 pm

Thanks Spike and thanks gb that helped from his blog, but it doesn't work.
Here what I've done
1) created in scripts folder a file named custinfoparms.txt and edited like this (I found this file on the net and commented things that now I don't understand but maybe, in future, I'll do!)
Code: Select all
//custom surfaceParms file (for 'q3map2 -custinfoparms')

//custom CONTENTS_ flags
{

}

//custom SURF_ flags
{
  //dirt          0x80000
  //grass         0x100000
  //wood          0x200000
  //stone         0x400000
  //metal         0x1000
  //sparks        0x800000
  //glass         0x1000000
  meshcollide    0x80000000
}



2) created a shader
Code: Select all
textures/common/objcollision
{
   qer_trans 0.4 //transparency only in editor
   
   surfaceparm meshcollide
   surfaceparm nodraw2
   {
      map textures/common/collision.tga
      blendfunc add
      rgbgen identity
   }
}


3)imported in NetRadiant the model and reflushed the shaders

4)Create a model with 2 objects: 1 with normal shader and 1 with textures/common/objcollision shader exported in obj and ase (same unsuccesfully results)

5) open fte but model is still non solid!

Where do I fail? Should I add custinfoparms.txt in the shaderlist.txt?
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby goldenboy » Thu Aug 28, 2014 2:43 am

Code: Select all
textures/common/meshcollide
{
   qer_trans 0.5
   surfaceparm nodraw2
   surfaceparm nolightmap
   surfaceparm nodlight
   surfaceparm trans
   surfaceparm meshcollide
}



Try this shader.

Your custinfoparms.txt looks ok.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: common/weapclip on models

Postby toneddu2000 » Thu Aug 28, 2014 3:06 pm

thanks gb but unfortunately it doesn't work :(
I tried objs and ase (I had to use ase model files since Blender Institute seems to abandon development of ASE model exporter - the only one I found is this but it's broken . some triangles not seen)
I used FTEQW 1.03 stable 32bit and last svn trunk (32bit I presume) - fteglqw.exe-

@Spike: did you know that stable version and svn one are completely different?
On stable
- fmf text file for proper game structure works
- realtime ligths with csaddon works
- console commands like r_wireframe exist
on svn version
- no
. illumination (created with stable version with csaddon) is completely scrambled
- not present
How's that possible?

Thanks both for your help
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby goldenboy » Thu Aug 28, 2014 5:03 pm

The stable version of FTE is basically from the stone age. It#s no wonder that stuff created by the stable version might not work with the latest version. It's labeled "Old Stable" for a reason.

The current SVN version is very stable too, there has been a huge amount of testing and bugfixing recently. If you spot a bug in the recent version, just report it. Comparisons with "Old Stable" make little sense.

The ASE exporter you linked is the recommended one; I use it all the time. If there are triangles missing, take a look at the face normals in Blender and flip them where necessary. Another possibility is that you need to flip some edges around the problem zones.

I have tried the meshcollide shader I posted with ASE models including both the textured mesh and the collision hull; it works for me and I use it all the time. You can try to make the collision hull a seperate file, perhaps that will work for you (so you have an xyz_collision.ase as well as an xyz.ase) but it should not be necessary.

Perhaps your ASE model does not contain the correct paths? Try and open it in a text editor (ASE is a plaintext format) and adjust the file paths to match your installation. This is a common problem; you need to pay attention to what you name your materials in Blender to avoid this.

r_wireframe works for me in FTE SVN 4734 with q3bsp.

rtlight editor also works.

Edit: You might also need to remove any stale glsl folder from your installation - newer builds sometimes also have new glsl.

Edit 2: You are adding -custinfoparms to your q3map2 BSP command line, right?
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: common/weapclip on models

Postby toneddu2000 » Thu Aug 28, 2014 11:20 pm

Ok I made 3 big errors.. ooh too much! :D
1° big error: I confused on FTEQW's site, the dowload stable downloads with the latest ones. So every time I said I was using latest one I was using the old stable one. What a mess
2° big error: I compiled on Win(MinGW + MSys) and Linux using this guide and retrieving last source with
Code: Select all
svn co https://fteqw.svn.sourceforge.net/svnroot/fteqw/branches/wip/
//and then
make gl-rel

This led, on Linux, an error:
Code: Select all
/usr/bin/ld: ./release/gl_linux/fs_zip.o: undefined reference to symbol 'inflateInit2_'
//lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line

which I fixed editing makefile section:
Code: Select all
BASELDFLAGS ?= -lm -ldl -lpthread

with:
Code: Select all
BASELDFLAGS ?= -lm -ldl -lpthread -lz

But both Linux and Windows had no commands like r_wireframe and most of all, collisions didn't work!
So I found out that correct command is:
Code: Select all
svn checkout svn://svn.code.sf.net/p/fteqw/code/trunk fteqw-code

and as usual
Code: Select all
make gl-rel

Now both compile with commands like r_wireframe and collisions DO WORK!
3°big error:
Edit 2: You are adding -custinfoparms to your q3map2 BSP command line, right?

No. :lol: But, honestly, this is my least error because no one told me to add it! :D

I used objs because ase didn't work.

You can try to make the collision hull a seperate file, perhaps that will work for you (so you have an xyz_collision.ase as well as an xyz.ase) but it should not be necessary.
Really? Would it work? Radiant can recognize _collision object or should I put the _collision model precisely at the same position of the object model?

The ASE exporter you linked is the recommended one; I use it all the time. If there are triangles missing, take a look at the face normals in Blender and flip them where necessary
No, I used a simple box created by Blender and then simply unwrapped. I use Blender 2.7, maybe this is the problem, I dunno

Thanks a lot gb, your help has been definitive!

EDIT: anyway, on latest releases, light is messed up (completely bright maps, like there was ambient to 100 even if is set to 0)
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: common/weapclip on models

Postby goldenboy » Fri Aug 29, 2014 12:13 am

Really? Would it work? Radiant can recognize _collision object or should I put the _collision model precisely at the same position of the object model?


Just putting it in the same place.

No idea why your ASE models aren't working, it's a little harder to get them right compared to OBJ anyway.

Edit: To find out what version of FTE you are actually running, you can enter "version" in the console and it will show the revision number. The current versions are something like 47xx.

Edit2: No idea about your lightmaps, my lighting seems to work. Perhaps you put no light entity in the map.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: common/weapclip on models

Postby toneddu2000 » Fri Aug 29, 2014 5:00 pm

No idea why your ASE models aren't working, it's a little harder to get them right compared to OBJ anyway.
Well now that objs work I'm happy! :D

Edit: To find out what version of FTE you are actually running, you can enter "version" in the console and it will show the revision number. The current versions are something like 47xx.
Yeah, mine is 4728, even if I downloaded the 4734 trunk. :?:
Edit2: No idea about your lightmaps, my lighting seems to work. Perhaps you put no light entity in the map.
Well on Windows, it works ok. If there's no light it's black, as it should be. On Linux I'll investigate in the future

Thanks again gb for your precious help
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [SOLVED] common/weapclip on models

Postby toneddu2000 » Thu Jan 15, 2015 10:05 pm

Thanks to gb and Spike, I'd like to post a mini tutorial with images, from start to finish, on how to use mesh collision in FTEQW engine.
This guide is for Blender users but I think that any 3d apps with a decent Wavefront OBJ's exporting plugin should be fine. A dilemma would be, of course, materials naming, model axis orientation and exporting options.

1) Create 1 or more models which will be our visible model(s) and a surrounding object which will be our collision model.
Image
For Blender users, visible object(s) material(s) name should be
Code: Select all
textures/materialfolder/materialname

for example:
Code: Select all
textures/simple/green

Multiple materials on same objects and multiple materials on multiple separated objects are both valid in Blender.
!IMPORTANT: remember to unwrap both visible and collision meshes, even if applied material doesn't need UVs. Otherwise models could not be displayed!
Image
The material name of the collision mesh will be:
Code: Select all
textures/common/objcollision

Image
If you need smoothed objects you need to detail mesh near borders with edge loops or weird light / shadows artifacts will occur in FTEQW. In Blender Crtl + R command.
Image

For Blender users I shared this example file.

2) Select both visible object(s) and collision mesh and export it.
For Blender users, these are correct exporting values. Important values are Selection Only (to avoid to export unnecessary objects) and Apply modifiers (so a Subdivion surface modifier don't need to be applied to the mesh before exporting)
Vital values are:
- Include UVs (without texture UV's, collision meshes could not work)
- Write Materials (without this, shaders won't be applied ingame)
- Objects as OBJs Groups (Important! With multiple objects / materials THIS is the one to check, instead of Objects as OBJ Objects)
Image
IMPORTANT: For Blender users remember to switch
Code: Select all
Forward: -Y Forward
Up: Z Up
Otherwise your model will be rotated ingame

3) Create in yourgamename/yourdatafolder/scripts a text file named custinfoparms.txt edited like this
Image

4) Edit yourgamename/yourdatafolder/scripts/common.shader (If you don't have it search for common-spog.pk3 on the net) adding this shader for collision mesh
Image

5) Add -custinfoparms in your map editor build xml file. For example, this is default_build_menu.xml in NetRadiant mygame.game folder:
Code: Select all
<build name="q3map 32bit with collisions and no light">
<command>[q3map2_32bit] -custinfoparms -meta -v &quot;[MapFile]&quot;</command>
<command>[q3map2_32bit] -vis -saveprt &quot;[MapFile]&quot;</command>
</build>


Add in your editor a misc_model entity and select your obj file previously exported.
IMPORTANT! NetRadiant 32bit (64bit version I don't know, didn't test it) imports and displays flawlessy objs exported as earlier explained. GTKRadiant (1.6.4) yells this error.
Code: Select all
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName

And visible and collision model are not seen ingame.
This image is from NetRadiant
Image
I hope this mini tutorial will be helpful to someone, cheers!
toneddu2000
 
Posts: 1320
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest