pac3 icon indicating copy to clipboard operation
pac3 copied to clipboard

[Dev] Tiny UVs on OBJs causes black triangles when bumpmaps are used

Open AeoMayo opened this issue 4 years ago • 7 comments

(Sorry for the huge influx of issues; I was asked by Caps to do this for easier tracking!)

EDIT: THIS IS ACTUALLY CAUSED BY OVERLAPPING UVS. REFER TO THIS COMMENT FOR DETAILS.

The old nasty black triangles bug still has a rare tendency to rear its ugly head: https://cdn.discordapp.com/attachments/463236715453218817/808880615571193866/unknown.png The large black triangle is meant to be blue. Enabling "base map alpha phong mask" fixes this like it did in the past; but disables bumpmaps in the process, also as it did in the past. Seems like what triggers this is super tiny UVs on the model itself. For the above as an example, I discovered every affected face had a one-dimensional UV caused by personal over-reliance on 3ds Max's automatic UV unwrapping set to frankly stupid angles. I know, bad practice generally, but I've come across a few models from games that have super itty bitty UVs otherwise, and can't be fixed without re-UV mapping. All I know otherwise is that this doesn't happen on my ancient copy of PAC.

AeoMayo avatar Feb 20 '21 08:02 AeoMayo

I believe custom textures will always have wrapped uv wrapping so make sure your model isn't using any clamped or mirrored UV wrapping.

thegrb93 avatar Feb 20 '21 09:02 thegrb93

I believe custom textures will always have wrapped uv wrapping so make sure your model isn't using any clamped or mirrored UV wrapping.

so it might be an issue with the way textures load now? (native png instead of from web view)

CapsAdmin avatar Feb 20 '21 09:02 CapsAdmin

Yeah, I talked about this a few years ago, it happens with overlapping uvs. So far the only reliable workaround is to use .mdl models instead of .objs.

Example below (material_3d has a bumpmap). image

Yagira avatar Feb 20 '21 09:02 Yagira

Overlapping UVs? Oh boy... That actually makes sense considering a few other models I have affected by this have exactly that going on. Thankfully on a good chunk of these I can fix them no problem. But anything that shares a bunch of UV space with the same part of the texture to save space is going to be a hassle. Can't wait to have to compile mdls for static objects blasdjajfg (not that I don't know how, just a pain) My question is why it doesn't happen on outdated versions of PAC.

AeoMayo avatar Feb 20 '21 09:02 AeoMayo

I can try to look into this, but I'm thinking I should invest time in making an obj to mdlzip tool.

CapsAdmin avatar Feb 20 '21 10:02 CapsAdmin

While that'd be nice for some things, I'm a weirdo who actually uses the fact that bumpmaps don't actually properly apply to OBJs to my advantage because it affects phong without affecting the lighting on the OBJ otherwise.

I don't know how to replicate this on mdl. Phong mask in material part, both new and legacy, doesn't seem to work.

AeoMayo avatar Feb 20 '21 10:02 AeoMayo

If you can send me an example of mdl vs obj in that case I can try to figure it out.

Either way, I've added obj support to the new model part now in develop, but you have to prefix paths with obj. There is also a tool to upgrade all parts, but this is still a work in progress.

CapsAdmin avatar Feb 20 '21 13:02 CapsAdmin