Jump to content
Official BF Editor Forums
Remdul

New Tool: Bfmeshview

Recommended Posts

I cannot guarantee it works with other versions

it worked for me in max v7. you'll have to re-do all your material IDs, but hey it worked! thanks Remdul, that is very cool indeed.

Share this post


Link to post
Share on other sites

Hey Remdul,

I'm loving the sample generation feature of the latest version of BFMeshView :D

But I have some suggestions on how it could be slightly improved. As many of the samples I'm generating off it are not "square textures", ie, sample sizes like 256x64 pixels etc, I'm using the custom sample sizes boxes a lot rather than the drop down list which btw, is an awesome feature you can put in custom sizes for LM samples sizes. But with it, I would like it so that when you select the box, preferably also when pressing tab to get to the box from another box, it has the value in there fully selected so you can type strait over it, rather than deleting the value that's already in there then putting a value in, as that would just save that little bit of extra time if you know what I mean :D

Other than that, really loving it :D

Also in your tut here: http://www.buijs-leur.nl/bfstuff/lightmaptutorial/

In step 2 where you say you need to UV to channel 5, I've found it only works if you UV the custom LMs to channel 9 (although in BFMeshView you still need to have it saying channel 5) otherwise it doesn't work for me.

Cheers and keep up the awesome work! :D

EDIT: Also I've found out that the minimum lightmap size size the BF2 editor can generate is a 4x4px texture. If you try to make it generate a 2x2px or even a 8x2px texture, it will crash the BF2 editor when it tries to generate the lightmap so you might want to make the minimum custom size be 4px instead of 2px that it is currently :)

Edited by Rhino

Share this post


Link to post
Share on other sites

I can't download any files from www.buijs-leur.nl..

Can somebody upload the colmeshimp.ms to some file hosting server (rapidshare, etc)?

Share this post


Link to post
Share on other sites

My apologies for the downtime. My webhost is terribly unresponsive, but I expect my page to be back up sometime before the heat-death of the universe.

Once back on-line I will also post the latest BfMeshView, which now includes animation playback. Great for verifying player model animations.

Edited by Remdul

Share this post


Link to post
Share on other sites

Ok, as promised, here it is:

http://www.bytehazard.com/bfstuff/bfmeshview/'>http://www.bytehazard.com/bfstuff/bfmeshview/

BfMeshView 2.0.0!

Although the version number has hit 2.0, as always it remains an experimental program. Many new features, the highlights:

* BF2 animation playback!

* added texture mass-rename tool (proven to be very popular among FH devs)

* added browse buttons to material editor

* improved display of UV channel info (should help to clear up confusion when troubleshooting bad lightmap UVs)

* added BF1942 StandardMesh shader/texture loading

Many thanks for the suggestions and bug reports!

One other thing I should also note, the file extension binding has been changed, so that files can be sorted by file type properly in Explorer and Winzip again. You might have to open the Options > Preferences window, and click Apply for this to take effect.

If there are any regressions, I'd like to hear about it.

Webpage and screenshots updated. Other good news, most Battlefield Play 4 Free files also work in BfMeshView. Some files do not load properly, I may or may not improve that.

MaxScripts updated as well: http://www.bytehazard.com/bfstuff/

My webhost erroneously restored an old backup a while ago without my knowledge, so some users may have downloaded outdated scripts. Re-download if you're having trouble.

My webpage has now been moved to http://www.bytehazard.com, which is where it will stay for time being, so update your bookmarks.

Edited by Remdul

Share this post


Link to post
Share on other sites

Awesome work as always Remdul!

Did you take into account the points I made above? Also what the hell is a "occlusion mesh"? I know what a ambient occlusion is but never head the term occlusion mesh?

Cheers! :D

Share this post


Link to post
Share on other sites

Sorry, I was going to answer your questions but forgot about it.

But with it, I would like it so that when you select the box, preferably also when pressing tab to get to the box from another box, it has the value in there fully selected so you can type strait over it, rather than deleting the value that's already in there then putting a value in, as that would just save that little bit of extra time if you know what I mean

I will consider this.

In step 2 where you say you need to UV to channel 5, I've found it only works if you UV the custom LMs to channel 9 (although in BFMeshView you still need to have it saying channel 5) otherwise it doesn't work for me.

This should now be solved, or at least much less confusing. The vertex attributes (including UV channels) are now properly displayed in treeview, and on the UV editor only the UV channels present in the file are listed in the dropdown. The exporter seems to only export channels if they are filled in, that is, you can add a UV channel in 3dsmax, but it can be empty and hold no data. These are skipped by the exporter. It's possible that POE exporter handles UV9 in a different way.

Also I've found out that the minimum lightmap size size the BF2 editor can generate is a 4x4px texture. If you try to make it generate a 2x2px or even a 8x2px texture, it will crash the BF2 editor when it tries to generate the lightmap so you might want to make the minimum custom size be 4px instead of 2px that it is currently

DDS images support sizes down to 1x1 pixels. However, DXT compressed images have a minimum size of 4x4, since the compression algorithm works on block of 4x4 pixels. That's probably why the editor crashes as it saves the lightmaps as DXT compressed.

I know that DICE uses some of my tools, I figured they may be working with uncompressed lightmaps on BF2 based titles like BFH and BFP4F, and perhaps someday someone might find a way to make BF2Editor output non-DXT compressed lightmaps. So I decided to keep <4x4 support for completeness.

Also what the hell is a "occlusion mesh"? I know what a ambient occlusion is but never head the term occlusion mesh?

BF2 supports hardware occlusion culling. Occlusion culling works like this: before rendering the world, you first render a bunch of boxes in place of large object (such as buildings). These are the occlusion meshes, they are highly simplified models that fit tightly inside the visible model. Once this is all rendered, you have a simple scene. It is only rendered to the z-buffer, since this is all we need to do occlusion tests.

Then before rendering all full detailed meshes (which we call the 'occludee' as opposed to 'occluder'), we take the bounding box (a box that completely encompasses the visible mesh) and render this to the scene, with occlusion testing mode enabled. When occlusion testing mode is enabled, the GPU doesn't actually draw anything, it only counts the number of pixels that would have been visible if it were rendered. This number is then passed back, and the game can then determine whether the object will be visible and needs to be rendered or not. If zero pixels were counted, it means it is fully obscured by one or more occluders. If a number of pixels are counted, then the object is partially or fully visible, and we must render the full detail mesh.

It seems a bit counter-intuitive at first, since we are now rendering more stuff, but typically, there's at least a few objects obscured (thus drawcalls are skipped), and because we only render very simple occlusion models the added overhead is negated.

I have tested this in FH2 in dense urban levels such as Anctoville and Ramelle, and it improves the framerate in some areas considerably. For example, if one stands up to the wall of a building with an occluder, the framerate goes up and maxes out, while it would normally stay very low. Do keep in mind though, that in open areas, e.g. looking down from a tower over a dense city, occlusion culling may not be effective enough to cull away large buildings. Overhead seems negligible, so I can only recommend it if your mod has performance issues in these situations.

Keep in mind that occlusion meshes should only be created for large closed structures. It will not help for objects smaller than 3x3x3 meters, these rarely obscure other objects and only add overhead. For open buildings, it depends on the model whether it is worth creating an occluder for.

Take for example a typical parking garage. The walls are open and you can look through. The pillars are thin and bad occluders, however the floors and ramps make good occluders. In this case you can add a quad in inside the floors, so that cars above and below the player's level are entirely culled away.

If an open house has at least one closed wall, stick a polygon in there as well.

I suggest taking a look at the BF2 .occ files for good examples.

I think I will add an example scene so you can see how it fits into the export hierarchy.

Edited by Remdul

Share this post


Link to post
Share on other sites

Excellent tool, very good for loading one mesh, instead of the content-heavy bfeditor. Though, could you please make it when you Open a file it defaults to "all formats/all files" instead of "Static Mesh (*.staticmesh)". And another suggestion that would make this program absoluelty perfect is making it so that if you double click on collisionmesh, skinned mesh, and all the filetypes ect., they open up through file association like how bundlemesh does, instead of getting the message box "Unknown File Type". Could be my OS though (WIN7 64 Bit).

Share this post


Link to post
Share on other sites
Though, could you please make it when you Open a file it defaults to "all formats/all files" instead of "Static Mesh (*.staticmesh)".

It does so on Windows XP, and it is specifically programmed to do this. However, Microsoft keeps changing the behavior of the common dialog API, that's why it may be broken.

And another suggestion that would make this program absoluelty perfect is making it so that if you double click on collisionmesh, skinned mesh, and all the filetypes ect., they open up through file association like how bundlemesh does

This too works properly on Windows XP. This problem may also be due another bug/sillyness introduced in Win7. You might want to try this: open the Options > Preferences dialog, uncheck all bindings, click "Apply", then close the app. Then run it again and check the bindings again, hit "Apply". Then close the app and see if it works.

I don't have a Win7 machine at home, but I will verify these two issues at work next week.

Edited by Remdul

Share this post


Link to post
Share on other sites

Ok, I had a look at this. I was able to reproduce the issue, it worked on some extensions and failed for others. This is especially silly because it's the same code that is called repeatedly in a loop, just different file extensions. I suspect Win7 may block some registry operations due to security. Windows security behaves like a randomizer sometimes, so that might explain the random failures.

Try this beta build:

http://www.bytehazard.com/bfstuff/bfmeshview/bfmeshview201.zip

If the file associations still do not work, go to View > Debug Console, copy the output and please post it here.

I also made those improvements suggested, and the "All Files" is now selected by default. This wasn't a bug after all, I forgot to check in some code.

Edited by Remdul

Share this post


Link to post
Share on other sites

Ok, i just tested skinnedmesh, bundlemesh and collisionmesh. Bundlemesh only opens if i double click it still. However, if i open up collisionmesh or skinned mesh i get the same error. So the problem is, double clicking or Rightclick>Open With.. gives "Unknown File Type" message box. Bear in mind, going File>Open and choosing collisionmesh/bundlemesh and skinnedmesh works as it should, just double clicking produces the message box. The good news is that it remembers the filepath so if i double click a collisionmesh/skinnedmesh, then go file>open its located in the correct path. After i click OK and then open the debug log i get something like this.



File: "C:\PROGRA~2\EAGAME~1\BATTLE~2\mods\MOD_OB~1\Objects\Vehicles\civilian\truck2\Meshes\TRUCK2~1.COL"



One the positive side, the new one fixed the half of my problems :D, but opening a vehicle in meshview still aligns all child parts to 0/0/0

Edited by rhysm_08

Share this post


Link to post
Share on other sites

Ok, I took another look today at work, and it looks like it indeed has to do with security. For reasons unknown, Win7 decides that some of the associations may be created, but not others. I lowered the security demands for the registry operations in 2.0.1, but Windows security still doesn't grant the rights needed for basic registry operations.

However it seems to me it all should work with administrator privileges. You can try granting BfMeshView admin access, you can do this by right clicking on the executable, click "Properties" and go to the "Security" tab. There should be something there you can check.

Another solution that worked for me is to set the compatibility mode to "Windows XP".

Anyway, BfMeshView is, to my knowledge (MSDN is greatly lacking in recent years), doing everything by the book, so I'm guessing this is probably a Windows 7 problem.

Share this post


Link to post
Share on other sites

Kevin notified me today that .skinnedmesh output is borked, I have fixed the bug. Will wait to see if any other bugs surface, will do a bugfix release later. For now, here's a beta build:

http://www.bytehazard.com/bfstuff/bfmeshview/bfmeshview202.zip

*Edit: rhysm_08 could you please edit your post and remove the debug blurb? It's kind of spammy. Thanks.

Edited by Remdul

Share this post


Link to post
Share on other sites

Lol sorry, tried 'codebox' instead of 'code' but it doesn't work anymore. Ah well i'll follow your suggestions and post results.

WORKS!! :rolleyes:

Edited by rhysm_08

Share this post


Link to post
Share on other sites

Just a minor heads-up: I've added a few small tools on my page. Nothing fancy, but it might help that tiny bit.

http://www.bytehazard.com/bfstuff/

BF2MeshChecker and DDScheck in particular may come in handy.

Tip: if you come across NaNs with Bf2MeshChecker on statics, these objects may have lighting bugs. You can usually fix the samples files of these with the BfMeshView "Fix Samples" tool. While on the subject, I would not recommend to use the BfMeshView "Fix Mesh" or "Fix Samples" tool if there is no visible issue.

Edited by Remdul

Share this post


Link to post
Share on other sites

I keep getting this overflow error when I generate samples with Bfmeshview, however it only occurs on lod0 and lod1, maybe lod2.

---------------------------

BfMeshView

---------------------------

GenBF2Samples Error Code: 2

Overflow

---------------------------

Share this post


Link to post
Share on other sites

That usually happens if there is an glitch in the exported mesh. If you check "Ignore Errors" it should usually work. If it doesn't, better fix that glitch. It's usually a very thin triangle. You can use this MaxScript (meshcheck.ms) to locate it.

Edited by Remdul

Share this post


Link to post
Share on other sites

New release (2.1.0). Mostly bugfixes, and this version brings full BFP4F support.

http://www.bytehazard.com/bfstuff/bfmeshview/

* fixed skinnedmesh corruption when saving (mayor bug!)

* fixed error when selecting some geoms with BF2 skinnedmesh and skeleton loaded

* fixed viewport redraw after startup on Windows 7

* fixed viewport redraw after changing viewport background color

* added support for Battlefield Play4Free meshes

* added some form of application state recovery if errors occured during rendering of BF2 meshes

* lowered registry security priveliges in futile attempt to please Vista/Win7

* minor GUI workflow tweaks

Share this post


Link to post
Share on other sites

I was generating some samples for some new statics I was making today and ran into this error when generating samples for my lod1, any idea what it means? I can't see anything wrong with my mesh or the LM UV?

---------------------------
BfMeshView
---------------------------
Warning, bad 835 faces encountered!
---------------------------
OK   
---------------------------

Also it seems the lightmap its generated for that lod is pretty much all blank other than one corner...

Oh and cheers for your continues work on this btw :D

EDIT: also another issue, when I try to load a ".samp_04" file, it gives me the following error:

---------------------------
BfMeshView
---------------------------
Unknown file type.
---------------------------
OK   
---------------------------

.same_01 to 03 load fine, but 04 it dosen't like for some reason :P

Edited by Rhino

Share this post


Link to post
Share on other sites

Hey, I really like this tool, thanks for making it.

I just have one suggestion:

If you release another version of this tool could you please fix the .OBJ export function so that it creates separate meshes for each sub-object (wheels for instance)? As it is now, everything is one mesh per LOD. I know this would be very simple to fix, especially considering you're already exporting multiple-mesh-OBJs. Thanks in advance.

EDIT: actually the whole program seems to be lacking this feature. If it's too much that's okay. On the other hand, if you would like a little help I could find some time to decipher that part of the file format if you need it. Anyway, thanks again for the tool.

Edited by Chael

Share this post


Link to post
Share on other sites

Hmm. I recently reinstalled Windows 7 and set up my BF2 modding environment again. But now whenever I try to open a mesh (bundled, collision, static, whatever) I get this error message.

bfmeshviewerror.png

If I click OK the mesh still seems to load fine, but the viewport is empty. If I then click on a LOD it shows up. Collisionmeshes however do not show up at all, even if I selected a specific sub-mesh collision.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×