Code Monkey home page Code Monkey logo

Comments (8)

mmp avatar mmp commented on July 16, 2024 1

No worries. Merged just now. Thanks!

from pbrt-v4.

povmaniaco avatar povmaniaco commented on July 16, 2024

Hi @mmp I can review this issue. I am using a derived version of this code for my own project.
Cheers..

from pbrt-v4.

povmaniaco avatar povmaniaco commented on July 16, 2024

Ths first fix is simple change from 'point2 st' to 'point2 uv'..

diff --git "a/src/pbrt/cmd/obj2pbrt.cpp" "b/src/pbrt/cmd/obj2pbrt.cpp"
index 39cd283..f508626 100644
--- "a/src/pbrt/cmd/obj2pbrt.cpp"
+++ "b/src/pbrt/cmd/obj2pbrt.cpp"
@@ -1591,7 +1591,7 @@ int main(int argc, char *argv[]) {
                 fprintf(f, "]\n");
             }
             if (!st.empty()) {
-                fprintf(f, "  \"point2 st\" [ \n");
+                fprintf(f, "  \"point2 uv\" [ \n");
                 for (Point2f tex : st)
                     fprintf(f, "\t%.10g %.10g\n", tex.x, tex.y);
                 fprintf(f, "]\n");

from pbrt-v4.

povmaniaco avatar povmaniaco commented on July 16, 2024

The other fix are related with the default material use in obj2pbrt ( uber) that are is deprecated.. @mmp what do you think is the best candidate to use now?
Edit: I think CoatedDiffuseMaterial is the best.. but it's just my opinion.
Cheers..

from pbrt-v4.

mmp avatar mmp commented on July 16, 2024

Generally speaking I agree that coated diffuse covers a lot of it. The full OBJ material model has all sorts of non-physical functionality (https://en.wikipedia.org/wiki/Wavefront_.obj_file#Material_template_library), which makes it tricky.

e.g. illum model 3 definitely sounds like coated diffuse. 4 is probably a dielectric interface with 0 roughness, 5 is probably coated diffuse again. 6,7 again a dielectric interface. I guess it boils down to either coated diffuse if it's reflective and a dielectric interface if it's transmissive. pbrt's dielectric interface BxDF no longer allows specifying a color, so that stuff will be lost..

from pbrt-v4.

povmaniaco avatar povmaniaco commented on July 16, 2024

@mmp I'm sorry.. I have some issues to isolate only the fix code for create pull request. Meanwhile, better drop here the .diff

 diff --git "a/src/pbrt/cmd/obj2pbrt.cpp" "b/src/pbrt/cmd/obj2pbrt.cpp"
index f508626..db1a6ef 100644
--- "a/src/pbrt/cmd/obj2pbrt.cpp"
+++ "b/src/pbrt/cmd/obj2pbrt.cpp"
@@ -1366,7 +1366,7 @@ int main(int argc, char *argv[]) {
             if (mtl.diffuse[0] != 0 || mtl.diffuse[1] != 0 || mtl.diffuse[2] != 0) {
                 fprintf(f,
                         "Texture \"%s-kd-img\" \"spectrum\" \"imagemap\" "
-                        "\"string imagefile\" [\"%s\"]\n",
+                        "\"string filename\" [\"%s\"]\n",
                         mtl.name.c_str(), mtl.diffuse_texname.c_str());
                 float scale = (mtl.diffuse[0] + mtl.diffuse[1] + mtl.diffuse[2]) / 3;
                 if (mtl.diffuse[0] != mtl.diffuse[1] || mtl.diffuse[1] != mtl.diffuse[2])
@@ -1382,7 +1382,7 @@ int main(int argc, char *argv[]) {
             } else {
                 fprintf(f,
                         "Texture \"%s-kd\" \"spectrum\" \"imagemap\" "
-                        "\"string imagefile\" [\"%s\"]\n",
+                        "\"string filename\" [\"%s\"]\n",
                         mtl.name.c_str(), mtl.diffuse_texname.c_str());
             }
         }
@@ -1392,7 +1392,7 @@ int main(int argc, char *argv[]) {
             if (mtl.specular[0] != 0 || mtl.specular[1] != 0 || mtl.specular[2] != 0) {
                 fprintf(f,
                         "Texture \"%s-ks-img\" \"spectrum\" \"imagemap\" "
-                        "\"string imagefile\" [\"%s\"]\n",
+                        "\"string filename\" [\"%s\"]\n",
                         mtl.name.c_str(), mtl.specular_texname.c_str());
                 float scale = (mtl.specular[0] + mtl.specular[1] + mtl.specular[2]) / 3;
                 if (mtl.specular[0] != mtl.specular[1] ||
@@ -1409,7 +1409,7 @@ int main(int argc, char *argv[]) {
             } else {
                 fprintf(f,
                         "Texture \"%s-ks\" \"spectrum\" \"imagemap\" "
-                        "\"string imagefile\" [\"%s\"]\n",
+                        "\"string filename\" [\"%s\"]\n",
                         mtl.name.c_str(), mtl.specular_texname.c_str());
             }
         }
@@ -1417,12 +1417,12 @@ int main(int argc, char *argv[]) {
         if (!mtl.bump_texname.empty()) {
             fprintf(f,
                     "Texture \"%s-bump\" \"float\" \"imagemap\" "
-                    "\"string imagefile\" [\"%s\"]\n",
+                    "\"string filename\" [\"%s\"]\n",
                     mtl.name.c_str(), mtl.bump_texname.c_str());
         }
 
         float roughness = (mtl.shininess == 0) ? 0. : (1.f / mtl.shininess);
-        fprintf(f, R"(MakeNamedMaterial "%s" "string type" "uber" )", mtl.name.c_str());
+        fprintf(f, R"(MakeNamedMaterial "%s" "string type" "coateddiffuse" )", mtl.name.c_str());
 
         if (hasDiffuseTex)
             fprintf(f, R"("texture reflectance" "%s-kd" )", mtl.name.c_str());

from pbrt-v4.

povmaniaco avatar povmaniaco commented on July 16, 2024

Nice.. I hope to find a bit time this weekend to continue fixing some more things.

from pbrt-v4.

mmp avatar mmp commented on July 16, 2024

This is now moot, given cd47b40.

from pbrt-v4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.