Jump to content
Official BF Editor Forums

New Tool: Bfmeshview


Remdul

Recommended Posts

  • 5 weeks later...
  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

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
Link to comment
Share on other sites

  • 1 month later...

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
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
Share on other sites

  • 3 weeks later...

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
Link to comment
Share on other sites

  • 4 weeks later...

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

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

Link to comment
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
Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • 2 months later...

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
Link to comment
Share on other sites

  • 2 weeks later...

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
Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

I'm confused wrt occlusion meshes. When I took a look at BF2 occ files in bfmeshview, I'm pretty sure the position of the mesh differed from the staticmesh, for example the occ for the Karkand hotel building looks a lot slimmer than the actual building mesh. Most meshes seem to be just boxes in approximate positions to the static mesh.

I exported an occ mesh for one of the PR statics by importing the static mesh into 3ds max and modeling the occ mesh along its boundaries and exporting it from the same position. I added the occ into the objects_client, then placed that static on a map along with its double that had no occ and identical objects behind both statics to compare FPS, but due the above I'm not sure if it actually worked, though there was a difference in FPS when looking at the object with occ and no occ. Am I doing this right or wrong?

Edited by Outlawz
Link to comment
Share on other sites

  • 3 weeks later...

Hey Remdul I have a request.

Is it possible to add support to BFmeshview to be able to generate samples for dest objects? Currently if you try to generate samples for even gemo0 it gives you an error saying it can't generate for objects with multiple gemos.

Also one other really useful feature would be when you select the next lod down when doing the samples, it would 1/2 the size of the lightmap you had before as default since 90% of the time that's what you want :D

This would make my life a lot easier if you could do this :)

Cheers!

Link to comment
Share on other sites

  • 11 months later...

I just released a new version (BfMeshView 2.2.0)! I didn't realize last release was over a year ago!

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

UPDATE: the contents of the v220 archive was borked, if you downloaded before the time of this edit, please re-download!

The highlights:

* full BF2 shader emulation

* support for suffixed textures

* added vehicle component positioning (loads .CON)

* added CollisionMesh color legend

* experimental SkinnedMesh vertex weight tools

* much improved UV editor

* integrated animation player with main window

* lots of bug fixes, performance tweaks and improved compatibility

Feedback welcome. Please report regressions and new bugs.

PS: I will try to address your questions if I find the time. Some of the bug fixes may solve the problems mentioned.

Edited by Remdul
Link to comment
Share on other sites

@Outlawz: I will see if I can write a BF2 occlusion mesh tutorial. Short answer: if you place your ready-for-export static in 3dsmax at the origin (root node is at 0/0/0), then the occlusion mesh will line up properly. An occlusion mesh should generally be entirely inside the visible mesh.

Occlusion testing ensures that any objects behind the occlusion mesh are never rendered to the framebuffer, which improves framerate. An occlusion mesh has no effect on the model itself however. Big objects such as highrises tend to occlude large number of objects, so they are good occluders.

You can test this in BF2 by moving the camera inside the visible mesh, but outside the occluder. You should see objects disappear.

@Rhino: lightmapped destroyable objects are so rare, I didn't bother adding support. But I think there is a workaround: export the destroyed model seperately as regular static, generate the samples for it with BfMeshView, then rename the samples and put them along the destroyable version.

The report about "bad faces" means there are some errors in your model. Most likely these are degenerate (infinitely thin) triangles. These cause all sorts of mathematical problems. You can detect them using this MaxScript: http://www.bytehazard.com/bfstuff/meshcheck.ms. The source of these thin triangles tends to come from CSG modeling techniques, and poor triangulation with Editable Poly in 3dsmax. Since I'm old-skool, I always re-triangulate my models as Editable Mesh ('Edge' mode > 'Turn' tool) before UV-ing.

@[sFaith]neko: I believe this bug is addressed in the latest BfMeshView version.

Edited by Remdul
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

Announcements




×
×
  • Create New...