Closed webprofusion-chrisc closed 7 years ago
I upgraded to a newer version of the gltf-pipeline and this issue seems to be fixed. Once https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/38 is in can you verify?
Thanks! I'll check this out and get back to you.
@webprofusion-chrisc I merged #38. Let us know if this is still an issue.
Tried this out but unfortunately with the models I've tried I now get a shader error (loading using the threejs gltf loader). I can share the .obj privately if that helps. This fails in both firefox and chrome but only chrome reports the error. Obviously this could be a an issue with the threejs glTF loader but I wondered if you'd seen a similar error with anything else?:
Failed to load resource: net::ERR_INVALID_URL data:text/plain;base64,precision highp float;uniform vec4 u_ambient;uniform vec4 u_diffuse;uniform vec4 u_emission;uniform vec4 u_specular;uniform float u_shininess;uniform float u_transparency;varying vec3 v_positionEC;varying vec3 v_normal;void main(void) { vec3 normal = normalize(v_normal); vec4 diffuse = u_diffuse; vec3 diffuseLight = vec3(0.0, 0.0, 0.0); vec3 specular = u_specular.rgb; vec3 specularLight = vec3(0.0, 0.0, 0.0); vec3 emission = u_emission.rgb; vec3 ambient = u_ambient.rgb; vec3 viewDir = -normalize(v_positionEC); vec3 ambientLight = vec3(0.0, 0.0, 0.0); ambientLight += vec3(0.2, 0.2, 0.2); vec3 l = vec3(0.0, 0.0, 1.0); diffuseLight += vec3(1.0, 1.0, 1.0) max(dot(normal,l), 0.); vec3 h = normalize(l + viewDir); float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)); specularLight += vec3(1.0, 1.0, 1.0) specularIntensity; vec3 color = vec3(0.0, 0.0, 0.0); color += diffuse.rgb diffuseLight; color += specular specularLight; color += emission; color += ambient ambientLight; gl_FragColor = vec4(color diffuse.a, diffuse.a * u_transparency);}
It looks like the shader isn't being base64-encoded properly. I thought this was fixed but maybe not - you can send the model to slilley@agi.com.
I found at least one problem here - https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/197. Once that's merged I'll update obj2gltf.
@webprofusion-chrisc obj2gltf is now published with the fix
Thanks! Have tried this out and it's working well. I noticed I had trouble getting UVs to work for files exported from Rhino as .obj with long lines wrapped - wondered if that was a known issue? Unchecking the option to wrap long lines in the rhino export seemed to fix it.
I'm not too surprised that it would fail for wrapped lines since the obj parser reads line by line. Do you have a sample obj that I can look at though?
As an addendum to #32, I've found that obj2gltf (via gltf-pipeline) is discarding my UV's (vt data from .obj), this was why I was struggling to get glTF to render in three.js - I thought the issue was confusion over default materials loaded from the glTF but really it just didn't have an texture coordinates so materials were appearing as solid colour instead of textured. Example source .obj and output gltf attached. I need an option to preserve that information as I am texture mapping based on user choices in the browser.
body-top.zip