kvark / vange-rs

Rusty Vangers clone
https://vange.rs
Apache License 2.0
432 stars 21 forks source link

Materials in exported OBJ #237

Closed kvark closed 9 months ago

kvark commented 9 months ago

For levels, OBJ export will now create an associated MTL automatically. It looks like this:

newmtl t0
    Kd 0.5176471 0.5647059 0.65882355
newmtl t1
    Kd 0.5803922 0.6431373 0.47058824
newmtl t2
    Kd 0.5176471 0.4392157 0.34509805
newmtl t3
    Kd 0.3764706 0.4392157 0.3764706
newmtl t4
    Kd 0.53333336 0.4392157 0.17254902
newmtl t5
    Kd 0.8 0 0.047058824
newmtl t6
    Kd 0.7529412 0.78431374 0
newmtl t7
    Kd 0.26666668 0.3764706 0.26666668

material-export-level

For objects, all objects are expected to have the same MTL file. It can be generated like this:

cargo run --bin convert -- c:\data\Games\Vangers\data\resource\pal\objects.pal c:\data\Assets\Vangers\game\object.mtl

Then generating an object OBJ and just placing the "object.mtl" near it will make the materials show up: material-export

I believe this is quite cool, because in any use of these assets having the colors/materials is immediately helpful.