-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering an Obj file with implicit face normals #1837
Comments
There are many special cases as you observe if it's currently unsupported. And we may choose to utilize time to support more modern file formats with the resources we have. I'd say the fastest way to resolve this is to convert the models so there are no implicit normals via Blender for example |
@itanbp we use assimp (assimp.org) for loading in many file formats, including obj. @NolaDonato will assimp support what he is looking for? and fwiw, we have our own parser for x3d that will generate normals if they are not provided in the file. if it would be possible to export to x3d (read the file in blender, export to x3d), that may do what you need. |
@itanbp Assimp doesn't generate the normals for us when using the model you referenced (tells us there are no normals). You can still load the model and view it but there will be no lighting effects. |
@bohuang3d @thomasflynn @liaxim thank you all for your quick answers! I'm intending to work with Poly project, which is a large, free to use, 3D virtual objects library. Poly is also accessible via an API. Using Blender (as a solution for the implicit normals) isn't relevant as I'm building an Android app that fetches 3D models, and displays them to the user. What do you suggest? What is the effort of calculating the normals and changing this files to explicitly declare the face normals? |
there appears to be a 'GenNormals' post process flag for assimp (http://assimp.sourceforge.net/lib_html/postprocess_8h.html). let us investigate that and see if we can enable it. |
Our vertex format requires there be a normal for each position. The best we can do is to generate the same normal for each position. This means that many vertices will have more than one normal and will have to be duplicated. Your mesh will get bigger. If you render it with one of our shaders, it will have a faceted look. Is this what you want? Or do you just want us to generate vertex normals if you don't have them? |
@thomasflynn the
@NolaDonato I'm not sure I fully understand the difference between the two options you mentioned, but this 3D model and many similar ones with the same issue are exported without normal vectors at all. If it helps, my goal is to render the model the same way they are in Poly, see how the object renderer here |
@itanbp take a look at GVRImportSettings and then try using the variation of loadModel() (in GVRAssetImporter) that takes the import settings. It looks like you should be able to set that flag in the import settings and it'll get passed to assimp. |
|
Try this. It looks lit and faceted for me: public class SampleActivity extends GVRActivity {
} |
Works for me too. The mistake I made was not to use GVRImportSettings.getRecommendedSettingsWith so I was missing required import flags. GVRImportSettings.getRecommendedSettingsWith should be at least mentioned in the javadoc if not automatically used. TRIANGULATE is already in the recommended settings. |
thank you all for your help! |
Hi,
I'm trying to render a submarine object from poly.
In this specific submarine object the vertex normal indices are implicit.
You can see it when looking at the "faces" lines, for example
f 40/91 41/90 37/89 36/88
I previously tried to use rajawali to render the object, but I got a runtime exception
there are no normals specified for this model.
It looks like rajawali expect for explicit declaration of face normals, although:
In the documentation stated that
and also:
My question is, does
GVRMesh
intended to parse and render an Obj file with implicit face normals?Thanks!
The text was updated successfully, but these errors were encountered: