FWGS / xash3d-fwgs

Xash3D FWGS engine
1.56k stars 236 forks source link

Adding CSM model format support #1647

Closed a1batross closed 3 months ago

a1batross commented 7 months ago

It's a new file format for static meshes by Uncle Mike.

Specification: https://hlfx.ru/forum/showthread.php?s=&threadid=6083 csm_format_spec_v.0.1.zip

There isn't so much info about this yet. Unlike static props compiled as HLMDL, this supports proper lighting.

@SNMetamorph do you have any ideas about it?

SNMetamorph commented 7 months ago

So, I'm really unsure about this one. The only thing that prevents us from using lightmapping on studiomodels is that we don't have standard mechanism to store UV for lightmap. But, this can be added to SMD and MDL in backward compatible way. Even, it already exists in SMD specification (SMD supports several UVs per vertex):

Reference from https://developer.valvesoftware.com/wiki/SMD#Syntax_3:

Note:
SMD version 3 supports up to 8 additional UV layers after additional links. Format <int|extra uvs> U1 V1 U2 V2 [...].
Nonetheless, the MDL formats used by both GoldSrc and Source only support a single set of UVs, except for CSGO, which uses a second set for $decaltexture.

Main problem with CSM is that's "thing-in-itself". 3D modeling software, level editors (like J.A.C.K and VHE), and other utilities is unaware about this format (even when we have plugin for Blender, we don't have such things for other software, and in some cases it's impossible to add new formats support). Also, a lot of existing content already exists in SMD/MDL formats - even if it's possible to fast and reliable convert all things to .csm, this anyway a lot of tremendous work.

SNMetamorph commented 3 months ago

I think we can close it?

a1batross commented 3 months ago

So far, I thought of it as a standalone model format, but it just doesn't make sense that way.

CSM is intended to be embedded into the level and have the lightmaps calculated for it. It's an intermediate model format that BSP compiler could theoretically generate from something else, like SMD with no animations or simple OBJ file. This way, it doesn't really need to be supported by the software in the first place.

If some BSP compiler for some promising mod (wink-wink PXST) will implement this format, I don't mind adding support for it. But just implementing it without no real world use feels like yet another way to over-complicate the engine and the renderers.

SNMetamorph commented 3 months ago

If some BSP compiler for some promising mod (wink-wink PXST) will implement this format, I don't mind adding support for it. But just implementing it without no real world use feels like yet another way to over-complicate the engine and the renderers.

Yeah, absolutely. But to be honest I don't see reasons to add this format to compiling tools too. Because nobody uses it, and I doubt that it will change somehow in future.