Last resort logo

SWAT 3 - LAST RESORT GAME MODIFICATION


Spam Prevention - PLEASE READ !! (23 Apr 2021)

Due to a problem with spammers the rules for posting in the forums have changed for new users.

Newly registered users won't have their posts published until a moderator approves them.

Static Mesh shadows and bullet impacts

More
3 years 2 weeks ago - 3 years 2 weeks ago #2228 by Slippery Jim
I have been working on a high resolution remake of the Import Store map (mission L) for the Last Resort mod.   One thing that I always hated was the extremely low polygon car out on the street.   In Worldcraft if you make complex shapes you are left with a texture nightmare.   The only option to improve the car is replace it with Swat 3's version of Static Mesh.

After a short search on the internet I came across an existing low-polygon model of a destroyed car.   Copy-cat was very kind and used his skills to convert the 3D model into something Swat 3 can use.  It was a lot of work to do this so huge thanks to him.

As you can see in this "work in progress" photo below the car is in the game now.  One negative side effect of this technique is that the car doesn't actually casts shadows and doesn't take bullet impacts.   It doesn't interact with the game environment at all.  The shadows you see in the photo below and on the sidewalk are tricked into the game by additional invisible geometry.




Below you can what the map looks like in the mission editor.   The tall purple checkerboard box is the car static mesh entity.   I had to add 3 invisible boxes to help make the car appear real in the environment

Side Shadow box: You take a 1 unit wide piece of geometry and tie it to a func_solidref entity and set it to a "solid".   I applied the "1_transparent" texture to the whole box (the clip texture would probably work too). This box is roughly the same height as the main body of the car.  In the properties you set the the "cast shadows" option to yes and "receive shadows" to no.   You turn on all the flags "weaker clip", "no skybox cull", and "no player clip".

Bottom Shadow box: You take a 1 unit tall piece of geometry and tie it to a func_solidref entity just like the other shadow box except this piece is at the bottom and is the width of the car.  I placed it just above the blocks that the car sit on.

Bullet impact box: If the player shoots at the car static mesh the bullets would go right through it and not render an impact.   You can also place an invisible box just to register the bullet hits.  You make a piece of geometry and tie it to a func_solidref entity but set it to "shootable railing".   I applied the "1_transparent" texture to the whole box (the clip texture would probably work too).  This box is roughly the same height as the main body of the car. In the properties you set the the "cast shadows" option to no and "receive shadows" to no. You turn on all the flags "weaker clip", "no skybox cull", and "no player clip".

The size of the bullet impact box needs a lot of tweaking.   If you make it too high it will "overwrite" the car static mesh and the car won't display at all.   I decided the bullet impacts on the main body was good enough.   Again I had to tweak the width and length of the box so that I would see the bullet impacts on all of the car body.   You know you have the right size when you see the bullet impacts but they don't appear to hover in mid-air.   This isn't as hard as it sounds believe it or not.

I probably could add some extra geometry to display bullet hits on the roof but I don't think it is necessary.






Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago - 3 years 1 week ago #2229 by Copy-Cat
To get the correct bullet impact decal and effects.

Create a 64 x 64 texture for each of the different materials used in swat ie: SHEETMETAL and add it to your wad file.  This texture should just have [SHEETMETAL] in the middle of the texture or which ever of the materials you are adding. The name of the bmp file has to be 15 characters or less and has to contain at least 5 of the letters of the material name, not including the square brackets. You can get fancy and add any color you want to the background for viewing purposes in WC.(I like white). The best examples of this type of texture are the clip_invis, trigger, ramp, origin, portal and trigger textures.

Then create a targa with that texture, with a 255 alpha channel (background color:black), place that texture into your textures folder.

Inside WC apply that texture to all hitboxes that contain that texture material.

When you get ready to build the materials.dat, (only need to do this once) the game will automatically place this texture in the appropriate section. If it doesn't, manually cut and paste the name into the appropriate section, save file and proceed.

Then do a full build, and test.

There are several entities this static mesh will interact with. The Mover entity, thus making it seem the car is moving. Similar to the tank in one of the OE missions, and the guy in the fishing boat on the bluemoon map. Other entities that affect this static mesh are lights and ambient lighting.
While working on this we found a problem with part of the mesh rendering dark. This was caused by lights and ambient lighting. When I rotated the car 180 degrees the problem disappeared. Light entities will cause this static mesh to either be fully lit or not lit at all.

In addition to casting the shadows using the technique above, you might want to bake in the received shadows on the static mesh itself. This can be done by hand in photoshop or using maya to bake shadows to a file that you can then use in photoshop as a multiply layer to apply the shadows to texture.

More on creating textures can be found in my HELP_textures.txt file.
More on the materials.dat can be found in my HELP_materialsdat.txt file.
More on baking shadows to textures for static meshes using Maya 6.0 (1 of 2 versions supporting the gsm export plugins) refer to this video:



To add this texture to WC so that it is semi invisible in 3d view, it has to be added to the entitiy list in the swat.cfg not yet explored.


 

Please Log in or Create an account to join the conversation.

More
3 years 1 week ago #2231 by Slippery Jim
Ya, the proper bullet hits for the car was something I would fix later on. Just want to get the basics going before worrying about fine details.

The video/screenshots is an old version too since I have worked on the baked in texture shadows. The only problem is I don't know where the UV map is for the passenger side door handles. They stand out like a sore thumb now in terms of brightness.

Please Log in or Create an account to join the conversation.

More
3 years 1 week ago - 3 years 1 week ago #2232 by Copy-Cat

Please Log in or Create an account to join the conversation.

More
3 years 1 week ago - 3 years 1 week ago #2233 by Slippery Jim
Thanks my man!

Very detailed post.

Will come see you on TS regarding the shopping car.

Tempted to also replace the couch too on the street (and again used in the basement).   Which do you find more annoying?

Please Log in or Create an account to join the conversation.

More
3 years 1 week ago #2236 by Copy-Cat
I managed to get the shopping cart down to 8000 polys.

Was thinking of separating the mesh into 3 parts.
  1. Basket
  2. UpperFrame
  3. LowerFrame

Getting ready to separate the shopping cart mesh into parts. I need some feedback on the mesh separation so that you can bake shadows in the right spots. First I have to resize the cart, and then I can run some tests.

Please Log in or Create an account to join the conversation.

Moderators: DarkSynopsis
Time to create page: 0.852 seconds
Powered by Kunena Forum