Black Mesa import missing some materials/props

Started by orangeduck, June 13, 2016, 04:55:00 PM

Previous topic - Next topic

orangeduck

Hey,

First of all thanks for your awesome tools!

At the moment I'm trying to set up importing of Black Mesa using WWMT. I'm about 90% of the way there and at the moment I can successfully import maps with most of the props and materials but there are just a handful of props and materials which don't appear (prop or material is missing). For example some window textures are missing and some terrain textures, as well as models for items like health kits etc. My suspicion is that these props and materials coorespond to props and materials from vanilla hl2 but it is a bit hard to work this out.

So first of all is there any way to check exactly why these props or materials are missing? Secondly, if these really are from vanilla hl2, is there any way to set up wallworm so that it can import these too?

I also have a second question - I'm exporting these scenes as ".fbx" so I can load them into Maya. Again - most of the time this works perfectly but some of the materials created by wallworm - such as those assigned to props - don't seem to be getting exported properly. I suspect these are the materials which are doing some complex blending or the multi-materials. Can you shed any light on this and do you know of any process I can use to bake these materials into some simpler form, so I can at least get the materials on the props imported into Maya (complex blended materials on terrains are less important).

Again many thanks for these incredible tools!

wallworm

I'm glad to hear you are getting along so well. Most of the emails I get on the asset importing involves people not getting anywhere as far.

You are very likely correct about the extra assets missing if from HL2. You should be able to get extra materials if you have the hl2 folder extracted and point to it in the Extra Paths field in WW global settings. You can enter extra paths for file system lookups. Separate each absolute path with a semicolon. For example, I have this in mine: C:/xen/hl2;

Note that it is using that path for VMT/VTF lookups (or TGA if not using WW Pro). For props, you may have to extract them into the same folders are the BMS modelsrc folders.

As for exporting to FBX, I cannot think of why they might not work in FBX. The only materials I can think that might fail are the Displacements, but most models are using standard materials. I'll look into it later this week.

orangeduck

Cheers for the quick reply.

Haha - yeah setting things up was a little ticky as I had practically zero experience with anything HL2 related, but a bit of intuition got me a long way.

I've verified that the missing props/textures/materials are from the hl2 resources. I extracted all of the hl2 resources (which are bundled with Black Mesa) and put them into their own folders. I added these folders to the extra paths section but seems it wasn't quite working so instead I just copied over all of the hl2 models and materials into the black mesa folders. There were a few naming conflicts but I just took the Black Mesa ones to be the updated version. Now it is working perfectly, thanks!

For the FBX export this is the error I get:


Some materials in this scene may not be supported by certain applications and will import as standard gray materials instead. The following materials are affected:
    -prop_physics015
    -prop_physics_override010
    -prop_static251
    -prop_static450
    -WallWormProxyReference001
    -prop_static342
    -prop_static323
    -prop_dynamic_override011
    -prop_dynamic_override035
    -prop_dynamic_override040
    -prop_physics021
    -prop_physics019
    -prop_static087
    -prop_physics010
    -prop_dynamic_override037
    -prop_static336
...


This affects 76 of the objects.

I took a look and it seems all of the materials that don't export are the XRef materials/textures E.G all of them end in an XRef "Override Material". This would explain why it seems mainly it is the props which are not having their textures exported. Perhaps there is some way to load in these references directly to the scene? Sorry it has been a long time since I've used 3dsmax so I'm not so familiar with these things. Any ideas?

Thanks again for the help.

wallworm

If you click File > Reference > Xref Objects, you can see all the files used in the map as references (WW uses Xref objects for props when available). Select a file, then click the Type column header at bottom to sort by type. Select all that are  XRef Material, right click and click Merge. You'll need to for that for all the xref files (one per prop). It's possible there is a script to automate it.

orangeduck

Thanks - that worked great. In fact you can group select all the materials and merge them at once so it was quite easy.

Now the only remaining issues with the fbx export are the blend textures and the displacement textures (such as on terrains). Both get exported as a hlsl material referencing a shader built for 3dsmax (which doesn't work in Maya). Also the textures they reference aren't linked when you load into Maya. So I guess I'll write a little script on the 3dsmax side of things to mess around with the blend/displacement materials and convert them into something more simple which can be exported through fbx and loaded in Maya.

If you have any ideas/suggestions I'd be happy to hear - otherwise I'll just keep fiddling around until I get it.

Hopefully once this is all done I can show off some nice renders since this is partially why I'm interested in exporting these levels :).

Thanks again.

wallworm

Seems odd that the materials aren't showing in Max. If you go to the global settings, check the Materials tab and see what Displacement shader is used. If it's set to the Black Mesa shader, it's best that you download latest version of WW, because that was updated this week.

If it's set to Native, then it may mean the file is missing from your install of Max, as it uses a standard FX file that comes with Max. Another possibility is if you have your display driver set to the legacy DX driver... the shaders will likely only work with Nitrous.

The render material of the DX shader is a standard Blend material that should translate. So you'll need to swap each object's material with the material's render material on the objects. I'm assuming Blend will translate to FBX (although I half remember that not being the case). The render material will need some tweaking because it generally has just a Vertex Color map OR a bitmap for blendmodulate... and doesn't account for how they should interact.

orangeduck

#6
Sorry should have been clear - the materials are showing fine in Max - everything is working perfectly in Max now :) - now the challenge is just transfering to Maya.

That was my first idea too - switching out the Render Material with the Object Material, but unfortunately it looks like blend materials wont transfer over fbx (http://forums.cgsociety.org/archive/index.php?t-1250080.html) - I got the same error as with the Xref materials, saying the material type is unsupported. A bit annoying but oh well. I don't need the viewport to be accurate in Maya so just having the render material transfered is enough.

The materials may not need to be an exact match so perhaps just a standard blend will be enough for my purposes. I think I will try to write a maxscript that dumps out all the material details I need, and then a maya mel script that reconstructs them on the other side. Hopefully it will all be fairly straight foward with a bit of trial and error and I can see if the render material blend is okay or if it looks too wacky without fully emulating the vertex color / bitmap interaction.

orangeduck

I've made some good progress importing things into Maya. Thanks for all the help. Here are some renders from Dear Esther and Black Mesa:







I had some trouble exporting the vertex colors via FBX. It turns out that FBX won't include the Vertex Alpha channel unless there are Vertex Color channels too. So I had to write a Maxscript that copied over the alpha channel to the color channels before export.

Now I'm reconstructing the materials in Maya and it is all looking good. For the displacement brushes - I was wondering - do you know the exact equation used for the texture blending in the displacement brushes? What I've got now looks roughly right - I am just subtracting the green channel of the blend texture from the vertex color to get the final blend amount - but it is somewhat hard to tell if this is completely correct.

Also you probably know already (since I saw a button to fix it in the import map layout), but WallWorm occasionally rotates props incorrectly when they are imported into the scene. Is there any idea what causes this or how to fix it?

Thanks,

- Dan

wallworm

Nice renders. I'm wondering why go through the hassle to render in Maya when you could just render in Max? Which renderer are you using?

In terms of prop rotations... honestly, it's really hard to track down why some of the props seem to be incorrect. They are 99% correct... but some are wrong. Because it's so limited and I haven't seen the logic of why, I've just left it as is.

As for blendmodulate, I've planned on adding the tree for the shader in Max for rendering, but I haven't done it yet. But the rules for it are here.

orangeduck

I am using mental ray so I guess I could potentially do the renders in Max, but I need the objects in Maya for some other reasons too - essentially I'm doing some Machine Learning research and using the Black Mesa resources as a dataset. Most of my code is written in Python/MEL so having everything accessible from Maya makes my life a lot easier.

For the prop rotations, I've observed that they seem to get flipped the wrong way when the euler angles are close to 90 degrees or 180 degrees. My suspicion is that this is to do with Euler Angle to Transform Matrix conversion singularities. There are some details about this on this page (and also a potential fix): http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/ I wonder if that helps? I might try to see if I can help and track down this bug myself. Where might be a good place to start in the Maxscripts if I want to see how prop rotations are set?

For blendmodulate I implemented the final blend weight as something like:

weight = mix(clamp(vertexcolor.a + (blend.g - 0.5), 0.0, 1.0), vertexcolor.a, blend.r)

This is what I could interprit from that page on blendmodule but I wasn't really sure what the exact equation was meant to be.

Thanks

wallworm

"Machine Learning" and the link on matrixToEuler make it quite clear that we have a very different brains :)

I originally attacked the prop imports with creating matrices, but it failed most of the time.

Then during some testing, I came up with a brute-force solution that works in almost all cases:


in coordsys world (
rotate entNode (AngleAxis (fstr[3] as Float) [1, 0, 0])
rotate entNode (AngleAxis (fstr[2] as Float) [0, 0, 1])
rotate entNode (AngleAxis (fstr[1] as Float) [0, -1, 0])
)


Where fstr is an array from the Angles parameter of an entity.

It's not pretty, but it works (mostly).

SMF spam blocked by CleanTalk