Markemp/Cryengine-Converter

Star citizen 3.14 UV issues

snowboundmage2 opened this issue · 3 comments

Describe the bug
Using the cgf converter as is on the latest star citizen .cga/.cgam gets the model just fine, but the UV's seem out of scale

** Sample Model with the issue
Exterior.zip

Just pop it into 3ds max and add an unwrap UV modifier. Some parts are too big, some are stretched on the y axis too high, some are rotated etc

vmxeo commented

UVs can be out of scale, and there's additional UV manipulation in the shaders to scale properly as well. This also might be a UDIM workflow (some textures seem to reference this), so in either case this behavior is expected.

@vmxeo are you saying that the material file contains some scaling info for UVs that modifies the data in the model files?

vmxeo commented

@Markemp Almost - the material file contains textures, some of which contain a TexMod tag. Here's one from anvl_carrack_ext.mtl

    <Material Name="internal_pom" MtlFlags="50331776" MatTemplate="" MatSubTemplate="" Shader="Illum" StringGenMask="%NORMAL_MAP%SPECULAR_MAP%PARALLAX_OCCLUSION_MAPPING" SurfaceType="" Diffuse="0.10946172,0.10946172,0.10946172" Specular="1,1,1" Emissive="0,0,0" Opacity="1" Shininess="234" vertModifType="0">
      <Textures>
        <Texture Map="TexSlot1" File="objects/spaceships/ships/misc/razor/textures/razor_damage_internals_diff.tif" TexType="0" Used="1">
          <TexMod TexMod_RotateType="0" TileU="0.75" TileV="0.75" />

The important bit is this modifies the texture, not the geometry or UV data. You'd need to use a UV transform on that texture in whatever material you end up making and applying to the model. This is what we're doing in our SCDV material generation script. If I can get a specific model and material, I can demonstrate how this should be done (at least in Blender).

In short, this isn't a cfg-converter issue, and UVs are working as expected.