project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding > Modding Tutorials
22 Nov 2019, 00:00:00 (PRT)
Register Developer Blogs Project Reality Members List Search Today's Posts Mark Forums Read
Modding Tutorials Information and tutorials related to modding BF2.

Reply
 
Thread Tools Display Modes
Old 2015-08-27, 11:06   #1
[R-DEV]​Outlawz7
PR:BF2 Developer

Outlawz7's Avatar
Default Static object texture variants with BFMeshView

Have you ever thought one of the following:
  • this building is nice, but I'd like it in a different color scheme
  • I'd like to use this Middle East building in my woodland map, but it would load Middle East texture palettes that nothing else on the map uses
  • I want a pink fortress

For this tutorial you'll need:
So let's make our pink fortress!

First, run BFMeshView and open muttrah_fort's static mesh from your pr_edit directory (ie. "C:\Program Files (x86)\Project Reality\Project Reality BF2\mods\pr_edit\objects\staticobjects\pr\citybuil dings\muttrah_fort\meshes\muttrah_fort.staticmesh" ).

You should now have this (click on lod0 and materials to expand subtree):


As you can see, muttrah_fort uses its own unique textures. To make our pink fortress, we'll need a texture that contains the color. Let's change the color texture used.

Expand lod0 and material 0 (if you haven't yet) then right-click on the color texture used in the material and select Edit:


You'll see an Edit Material window. Click on the three dots at the end of the Texture 1 line and you'll now have a Browse window:


Navigate to \objects\staticobjects\_middle-east\city\textures and select mecity_01_c.dds. Your Edit material window should now look like this:


Click Apply. Congrats, your fort now looks like a mess.


But hold on, we'll get there, you can see the pink already!

With lod0 selected, go to Tools > UV Editor.

BFMeshView UV Editor explained


Zoom/Move In/Out - Hold right-click and drag in/out to zoom in/out to the position the mouse pointer is at - this is your basic movement around the UV Editor window.

"UV 1 Base" - select which channel to edit (leave the Lightmap channel alone for this)

"Material 0" - corresponds with the material in the subtree (see red arrow)

Toolbar (from left to right):
  • Select tool - before you can do anything you need to select the UV vertices (white dots)
  • Move tool - move selected vertices
  • Scale tool - scale selected vertices
  • Left/Right/Up/Down arrows - move vertices one bitmap lenght - useful when trying to move overlapping UVs apart for editing while keeping them in the same position on the texture
  • Rotate - rotates UV
  • Scale - scales selected UV but with a dialog (use number higher than 1 to scale up, fractions of 1 to scale down)
  • Collapse - collapses UV (don't use in this case!)

One thing to keep in mind that the model is UV'd according to the original texture and you'll likely need to do a lot of repositioning/rescaling to get the UVs to fit the new texture unless you use a similar texture. Some objects are also UV'd to a single tileable texture instead of a palette (several textures in one).

For the purposes of our mission, I'll scale and move the UVs to fit the pink section of our texture.


Our fort is now colored pink, but the detail and dirt textures are keeping it somewhat dark.


We can repeat this process for the other three channels (detail, dirt and crack) and adjust/change the textures better. You may also need to do this for each material unless one material covers most of the object (as in this case). You will also need to repeat this process for all the lods so your static looks the same from distance.

For now let's skip to getting this in game.

Go to File > Save As and save the static mesh in the same folder (this is required) as the original with a new name.


That's it for BFMeshView. Close it and now open the folder where you just saved the mesh (\objects\staticobjects\pr\citybuildings\muttrah_f ort). You should see two files, muttrah_fort.con and muttrah_fort.tweak. Copy them and rename them to muttrah_fort_pink.con and muttrah_fort_pink.tweak respectively.


In the .con file, edit the lines highlighted blue, leave rest as it:

Quote:
GeometryTemplate.create StaticMesh muttrah_fort_pink
CollisionManager.createTemplate muttrah_fort_pink

ObjectTemplate.create SimpleObject muttrah_fort_pink
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.creator EDMUND:Edmund_Fovargue
ObjectTemplate.collisionMesh muttrah_fort
ObjectTemplate.mapMaterial 0 concrete 0
ObjectTemplate.mapMaterial 1 metal 0
ObjectTemplate.mapMaterial 2 Base 0
ObjectTemplate.mapMaterial 3 stairs 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType 3
ObjectTemplate.geometry muttrah_fort_pink

include muttrah_fort_pink.tweak
Same in .tweak:

Quote:
rem *** Generated with Bf2Editor.exe [created: 2006/5/15 12:52]
GeometryTemplate.setSubGeometryLodDistance 0 0 100
GeometryTemplate.setSubGeometryLodDistance 0 1 150
GeometryTemplate.setSubGeometryLodDistance 0 2 300
GeometryTemplate.doNotGenerateLightmaps 0
GeometryTemplate.lightmapOverride 0
GeometryTemplate.compressVertexData 1
GeometryTemplate.maxTextureRepeat 16
GeometryTemplate.glowing 0
GeometryTemplate.noLighting 0
ObjectTemplate.activeSafe SimpleObject muttrah_fort_pink
ObjectTemplate.creator TJENS:Tom
ObjectTemplate.modifiedByUser "Edmund Fovargue"
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.geometry muttrah_fort_pink
ObjectTemplate.setCollisionMesh muttrah_fort
ObjectTemplate.mapMaterial 0 concrete 12
ObjectTemplate.mapMaterial 1 metal 21
ObjectTemplate.mapMaterial 2 Base 12
ObjectTemplate.mapMaterial 3 stairs 34
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh
Save and close.

What we've done here is make a copy of the original static using the new static mesh we've created in BFMeshView and the original collision mesh.

Fire up your BFEditor, your pink fortress is ready!


On a more serious note, here's what you can also do with this:


Enjoy.

Outlawz7 is offline
Last edited by [R-DEV]Outlawz7; 2015-08-27 at 11:14..
Reply With Quote
Old 2018-01-18, 16:58   #2
Rabbit

Rabbit's Avatar
Default Re: Static object texture variants with BFMeshView

Been playing with this door and cannot get it to work.



The original only has 3 texture spots, and I tried adding a 4th so it could use a bump map. I tried replacing spec with the bump map, tried moving the spec to the 4th spot and adding the bump to the 3rd spot but not matter what I try I get "invalid texture slot" when placing it in the editor. Any way to fix this or am I stuck not having a bump map on it.

Rabbit is offline Reply With Quote
Old 2018-01-18, 17:18   #3
[R-DEV]Mineral
PR:BF2 Lead Designer
Supporting Member
PR Server License Administrator

Mineral's Avatar
Default Re: Static object texture variants with BFMeshView

First of all will need to change technique to something that supports the bump map (Ndetail). So change it to 'BaseDetailNDetail'. Then you should be able to do :
1:color (base)
2:detail (detail)
3:bump of detail (ndetail)
4:specLUT

Not sure the exact textures it uses, but from the screens it also looks like color and detail are switched? Not sure if that's intended but looks ok looking at the mesh.

Mineral is online now Reply With Quote
Old 2018-01-18, 17:26   #4
Rabbit

Rabbit's Avatar
Default Re: Static object texture variants with BFMeshView

Awesome that worked, thanks!

Rabbit is offline Reply With Quote
Reply


Tags
bfmeshview, object, static, texture, variants
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 09:59.