Partial Reflection Maps
The technique relies upon cloned meshes and masked textures. When I refer to masked, I mean textures with an alpha channel. I use corel because of its excellent masking tools. Material box setup is essential to making it work.
First things first, make a mesh. Call this mesh 'Base' mesh. Clone the mesh and call this 'Clone'. Naming isn't important, but it helps to identify the right mesh when applying textures.
I'll say at this point that the whole cloned mesh isn't need, just the parts you want to add isolated ref maps to. What is important is that you cloned the whole mesh before deleting portions. You can 'detach as clone', but it is not always reliable.
If at any point you need to alter the mesh, you must select and alter both the base and clone as a multiple selection, otherwise the meshes phase (flicker).
Next up, set up two material boxes - both using Blinn.
Name one box 'Base' (for ease of use) and the other 'Clone'.
In the base material box add your base texture. In this example we'll go for a matte background texture. Now the odd thing with this technique is that both materials must share similar properties for the effect to work, since we are using reflection maps, this material needs a reflection map. We can do one of two things here, apply a different reflect map that give an effect such as silver on gold, or go for a matte colour. To give us a matte colour we insert a tiny black texture into the reflection map box of the base material. Black is transparent. Next up, we make sure that the material opacity is set to 100.
Now we move on to the clone material box. In the diffuse map we add the masked texture. Anything that is in the masked area will show the base meshes texture, anything out of the mask shows the isolated reflection. Now add your reflective map into the reflect map box. Now the important step, set the clone material opacity to 99. It must by 99 or below, not 100.
Apply the base material to the base mesh and the clone material to the cloned mesh. When you export, do not use forced 1 bit alpha. I only have two settings ticked when exporting, these are the two settings on the left of the exporter (cannot remember their names off hand) and that's it.
What you may need to do is play with the ambient/ diffuse settings of the cloned meshes material box. If you are applying a reflect map with a lot of contrast, both ambient and diffuse need to be very dark. If both ambient and diffuse are all black, the reflect map colouration will be exactly the same as the actual texture. The mesh will not respond to ambient light when in game. If you make ambient and diffuse dark grey. You may lose some colouration on the reflect map depending on in game ambient lighting, but it will respond a little to ambient lighting and take on a subtle glow from surrounding light sources.
If viewing the mesh underwater from first person, sometimes the isolated reflect mesh (cloned mesh) can disappear. One workaround is to clone the mesh completely then add the textures and test in game. If the isolated portions disappear in first person, swap the materials around from the base mesh to the clone and vice versa then test. If the isolated areas show, you can start deleting portions of the mesh that are not needed.
One last thing, you can switch the process around and include a main coloured texture in with the mask. In this case, this material would have the 99 opacity. The other material would house the reflect map and have an opacity of 100.
The first technique can use small textures as the base and large masks to create detail. Masks alone can be highly compacted. I have used a detailed 2048 mask to make very crisp details and it crunched down to KB.
Some of my textures will appear to be all black but be quite large. These are the masks!
Updated ~ Nov. 21, 06 4:08 p.m. e.s.t.
*****************************************************************************************************************
Self Sheathing Swords
First things first create the relevant models for the game.
You need the following;
- 1 Sword
- 2 Sword in sheathed state, positioned as regular sword - no blade (cuts polys) - this is used as the ground mesh or 'activator'
- 3 Positioned sheathed sword
- 4 Positioned empty sheathe (if the sword is to be used both 1 and 2 handed you'll need to create two unsheathed positions - see my included scene <----(Max 4.2 scene)
You now need to set the meshes to the relevant bodyparts in the construction set. I'll use a back sheather as an example that is set to take up a pauldron slot.
Create one new neck bodypart - set it as an armor piece. This will be the sword sheathed mesh so name it something appropriate like 1sword_shvd_body. Direct the art file to the fully sheathed and positioned mesh.
Create another neck bodypart - set it as an armor piece. This will be the sword unsheathed mesh - name it something like 1sword_UNshvd_body
Now create the armor pieces.
Use the left or right pauldron slot and in the biped object select neck and choose the fully sheathed mesh. Give the mesh 0 weight so as to reduce chance of the encumbrance bug. The ID that you give this object will be the one used in the sheathing script use somethin like 1sword_shvd. The ground art mesh can be the same sheathed mesh as it is not going to be processed in game. This mesh is going to be disabled if dropped. Set the 1sword_disable item script to this item.
We now copy this armor piece and redirect the neck biped object to the unsheathed mesh. We are applying the same information to this item including the disable script, this item will also be disabled if dropped. Use something like 1sword_UNshvd as the ID. This will be used in the sheathing script.
Save the item as a new item.
Create an activator. Give the activator display name the name of your sword. Direct the art file to your sheathed sword which uses the regular sword position. Add the sword_activate script to this item. The ID you use for this object will be the one we use in the sheathing script. This is the 'placeatme' object.
Create your sword in the CS. Apply the sheathing script to the sword. The ID you use on this weapon will be the ID used on the activate script and also in the sheathing script.
That's all that's needed!
When placing the sword in game we actually place the activator. This stops the sheathing script from 'calling' from the start and limits item replication which can occur in a cell when a scripted item is placed in game. When you activate or pick up the activator, it deletes itself but not before adding the sword with sheathing script to your inventory. When you drop the sword it deletes all scabbard meshes from the inventory then deletes itself after dropping the activator.
By creating two sheathing scripts, two swords and two activators, you can actually create a sword that is wielded both one and two handed. The one handed sword drops the two handed activator and vice versa dropping the sword then cycles between one and two hand. The problem with two handed swords is that they need a different scabbard position for the unsheathed sword as regular positioning of the sheathe will cause clipping to the back when the sword is wielded in the chop position. If you want to create a weapon that works in the described way, you must create a further neck bodypart and armor part with a different ID. The second sheathe script will use the second sword ID and will use the second unsheathed sword ID. The sheathed sword ID can remain the same.
One last point, although we are using the pauldron/ clavicle slot we are not actually assigning an object to this slot. The pauldron slot we are not using can be used to add pauldrons to both the left and right clavicle. Both meshes will be seen in game, but will act as one slot.