Skip to content
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

Material rendered black on non-instanced object, correct if object is instanced #300

Closed
Theverat opened this issue Feb 5, 2020 · 4 comments
Assignees
Labels

Comments

@Theverat
Copy link
Member

Theverat commented Feb 5, 2020

Reported by Max from Insertcoin.tv.

LuxCore version: v2.3beta1
Scene: black_material.zip

Steps to reproduce:

  • Start a viewport render. The object will be instanced by BlendLuxCore and everything works fine
  • Start a final render. The object will not be instanced anymore and appear black

I have a feeling there might be NaNs involved here, possibly caused by some of these factors:

  • The object has a negative scale of -0.385706 along the Z axis (when the scale is applied in Blender, the problem vanishes)
  • A bump map is used on the object (when the bump map is removed, the problem vanishes)

Viewport render, object instanced:

viewport_instanced

Final render, object not instanced:

final_render_not_instanced

@Dade916 Dade916 self-assigned this Feb 6, 2020
@Dade916
Copy link
Member

Dade916 commented Feb 6, 2020

The problem may be in BlendLuxCore (or in the LuxCore export process). Try to do this test:

  1. use FILESAVER to export the scene with +Z scale

  2. use FILESAVER to export the scene with -Z scale

  3. now import the 2 mesh .ply files inside Blender and check the normals: they point in the same direction (while they should be flipped in one case).

So the problem may be in the process of exporting normals when Z scale is negative (?)

@Theverat
Copy link
Member Author

Theverat commented Feb 7, 2020

You mean somewhere in here?

static bool Scene_DefineBlenderMesh(luxcore::detail::SceneImpl *scene, const string &name,

Or maybe in

void ExtTriangleMesh::ApplyTransform(const Transform &trans) {

However, even with normals pointing to the wrong side, why would the mesh be black? Wouldn't that be like looking at it from the other side?

@Dade916
Copy link
Member

Dade916 commented Feb 16, 2020

I should have fixed the problem: the transformation was swapping the handiness of reference system.

@Theverat
Copy link
Member Author

Confirmed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants