diff --git a/relight-cli/rtibuilder.cpp b/relight-cli/rtibuilder.cpp index 25b779b3..aacb4a2c 100644 --- a/relight-cli/rtibuilder.cpp +++ b/relight-cli/rtibuilder.cpp @@ -936,8 +936,8 @@ size_t RtiBuilder::savePTM(const std::string &output) { for(size_t i = 0; i < gbias.size(); i++) { int j = coeffRemap[i]; - gbias[i] = static_cast(bias[j*3]*255.0); - gscale[i] = scale[j*3]; + gbias[i] = static_cast(bias[j+3]*255.0); + gscale[i] = scale[j+3]; } for(float s: gscale) stream << s << " "; diff --git a/src/legacy_rti.cpp b/src/legacy_rti.cpp index 399bc02c..6d92246d 100644 --- a/src/legacy_rti.cpp +++ b/src/legacy_rti.cpp @@ -65,8 +65,10 @@ bool getFloats(FILE *file, vector &a, unsigned int expected = 0) { buffer[255] = 0; QString str = buffer; + //some rtis have a space after the last float, other a \n directly. + str = str.trimmed(); QStringList parts = str.split(' '); - parts.pop_back(); //remove \n + for(int i = 0; i < parts.size(); i++) { bool ok; float s = parts[i].toDouble(&ok);