wfowler1 / Unity3D-BSP-Importer

A lightweight plugin for importing BSP maps into Unity3D as meshes.
Other
112 stars 17 forks source link

Imported map has some missing faces #14

Closed bordaadam closed 3 years ago

bordaadam commented 3 years ago

As I'm importing my custom .bsp into Unity, I'm getting the following result: image

This maps looks like this in Hammer editor: image

So my problem is that some of the faces are not imported into Unity (as you can see it on the image).

Am I missing something or is it a known issue?

bordaadam commented 3 years ago

Actually, I was able to find out(?) what the problem was and fixed the issue (it may be just a temporary fix). Firstly I created just a unit cube in Hammer Editor then imported it to Unity. The problem why I opened this ticket was still there like in the picture. So I decided to put logs into the code. I found it found 6 faces for the cube (which is expected), however, it was still missing 2 faces. So overall, I found out that 2 of 6 faces had 0 TextureInfoIndex and that's why it returned -1 in BSPExtensions.cs:140. So I temporary rewrite if (face.TextureInfoIndex > 0) --> if (face.TextureInfoIndex >= 0). So I just let the equality, too. it seems it fixed the problem for me, but I think it's just a temporary fix, I'm not sure.

wfowler1 commented 3 years ago

Huh, thanks for looking into this. I haven't had much time to look into things lately, things are kinda crazy at work right now, plus I got a new computer and haven't put all my tools and things on it yet. It looks like you might have found a mistake!

I'll look into why it wasn't a >= comparison. I probably just had a brain fart.

bordaadam commented 3 years ago

Well, I didn't dig very deeply into this problem, so as I said, it may be just a temporary fix. To be honest, I didn't look any further into this problem, so I might be wrong with this solution. But thanks if you'll have a look at it.

The reason why I tell you I might be wrong because some months ago I imported Half Life 1 maps and there was no errors like this at all. Maybe there is a difference between my custom map .bsp and .bsps in half life. (Maybe because these .bsps generated with two different hammer editors?)

wfowler1 commented 3 years ago

Yep, you're completely right, this was the issue. Closed by 173d0c439a7bb3a305be4c755ad8c3977da6e918