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

Add X-Plane 11 OBJ directives - NORMAL_METALNESS, BLEND_GLASS #260

Closed
tngreene opened this Issue Jun 9, 2017 · 13 comments

Comments

Projects
None yet
2 participants
@tngreene
Copy link
Collaborator

tngreene commented Jun 9, 2017

Blender should take advantage of the new OBJ header directives in Blender!

What is needed:

  • Edit OBJ spec to include new material from the X-Plane 11 new material model article
  • Create Blender UI to enable and opt-in to this
  • Tie it into the existing exporter model
  • Make validations for it
    1. BLEND_GLASS only legal on aircraft/cockpit/panel objects
    2. NORMAL_METALNESS flag must match in all the cases where normal TEXTURE choice must match
    3. NORMAL_METALNESS flag must meet additional requirerments
    4. Like others: 2 materials used for the same purpose must match having their textures
    5. The scene settings must be >= X-Plane 11
  • Make unit tests for BLEND_GLASS (see here)
  • Make unit tests for NORMAL_METALNESS (see here and here)
@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jun 14, 2017

Created UI features for this. c3091a5

Re-created original BLEND_GLASS UI 6110c94

@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jun 20, 2017

Exporter tie in for BLEND_GLASS: c3091a5

@bsupnik

This comment has been minimized.

Copy link
Collaborator

bsupnik commented Jun 20, 2017

Per our discussion on Skype: when NORMAL_METALNESS is in use.

  • The header should contain GLOBAL_specular 1.0
  • NO ATTR_shiny_rat or GLOBAL_specular should be written at all based on user set material shininess.
  • Illegal differences in user material shininess should be ignored.
@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jun 20, 2017

Exporter tie for NORMAL_METALNESS: b5325c9

@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jun 21, 2017

Validation for BLEND_GLASS 56513e2

Final unit test for BLEND_GLASS 845be16

@bsupnik

This comment has been minimized.

Copy link
Collaborator

bsupnik commented Jun 21, 2017

TEST CASES FOR BLEND_GLASS:

  • Export cockpit object with blend glass enabled on the material, confirm BLEND_GLASS is in the OBJ header of the fixture.
  • Export cockpit object with blend glass object NOT enabled, confirm BLEND_GLASS is NOT present in the fixture.
  • Export cockpit-panel object with blend glass enabled on the material, confirm BLEND_GLASS is in the OBJ header of the fixture.
  • Export cockpit-panel object with blend glass object NOT enabled, confirm BLEND_GLASS is NOT present in the fixture.
  • Export aircraft object with blend glass enabled on the material, confirm BLEND_GLASS is in the OBJ header of the fixture.
  • Export aircraft object with blend glass object NOT enabled on the material, confirm BLEND_GLASS is NOT present in the OBJ header of the fixture.
  • Export aircraft object with two materials, one BLEND_GLASS and one not. Confirm validation failure (conflict of blend glass status on materials).
  • Export scenery object with BLEND_GLASS enabled, confirm validation fails (BLEND_GLASS illegal for scenery).
  • Export instanced scenery object with BLEND_GLASS enabled, confirm validation fails (BLEND_GLASS illegal for instanced scenery).
@bsupnik

This comment has been minimized.

Copy link
Collaborator

bsupnik commented Jun 22, 2017

TEST CASES FOR NORMAL_METALNESS (basic usage):
Matrix 1 (directive present):

  • Normal metalness on vs off
  • Draped material present vs not.
  • Non-draped material present vs not.
    This represents 9 test cases (3x3). Note that for no draped and no non-draped material present, this can be done with an OBJect that contains only one lamp. This matrix is:
  • Draped metal vs draped not metal vs no draped x
  • 3-d metal vs 3-d not metal vs no 3-d.

In this case, the NORMAL_METALNESS needs to appear after the TEXTURE directive for each of the draped and non-draped materials.

Matrix 2 (specularity):

  • NORMAL_METALNESS present vs not - when present specularity is controlled by a single GLOBAL_specular 1.0 directive in the header and the model is ignored. When it is not, we get legacy behavior
  • export scenery instanced vs scenery
  • export with one material (with a shiny ratio) vs two

This forms another 8-way test case (2x2x2). Note that ONE case should fail: scenery instanced with two specularity-materials and NO normal-metalness should fail validation due to conflicting specular in a scenery-instanced object. This is the ONLY case that should fail to export of the 8.

@bsupnik

This comment has been minimized.

Copy link
Collaborator

bsupnik commented Jun 22, 2017

MATRIX 3: DRAPED specularity (scenery export type)

  • Normal metalness vs not
  • One draped material vs two (each has its OWN specularity)
    In this case the non-metal two material draped export is the only failing case.
@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jun 22, 2017

Thought of another test: Create a blend file, set version to XP11, enable new features, switch it back to XP10, make sure that they don't show up in the OBJ. Ensuring everything is guarded by if version >= 1100.

@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jul 5, 2017

Matrix 1 table (in ASCII Table)

type = [none|non_metal|metal]
D_[type]_NON_D_[type]
                                            Non-Draped
                              None  |         Non-Metal          | Metal
D             ---------------------------------------------------------------------------
r  None      |D_none_NON_D_none     |D_none_NON_D_non_metal      |D_none_NON_D_metal     |
a            |----------------------|----------------------------|-----------------------|
p  Non-Metal |D_non_metal_NON_D_none|D_non_metal_NON_D_non_metal |D_non_metal_NON_D_metal|
e            |----------------------|----------------------------|-----------------------|
d  Metal     |D_metal_NON_D_none    |D_metal_NON_D_non_metal     |D_metal_NON_D_metal    |
             ---------------------------------------------------------------------------
Recommended order
1. D_none_NON_D_non_metal
2. D_none_NON_D_metal
3. D_non_metal_NON_D_non_metal
4. D_non_metal_NON_D_metal
5. Anything from row 3, column 1 or 2
6. Anything after that

@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jul 7, 2017

Matrix 1 committed and pushed! 659845b

@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Jul 11, 2017

Every test case created, debugged, passing, unbroken, broken, rebroken properly, thrown over the fence, dragged through a lake, and all round finished or I'll throw my hat into a volcano, closed!

956ca75

@tngreene tngreene closed this Jul 11, 2017

@tngreene

This comment has been minimized.

Copy link
Collaborator

tngreene commented Aug 10, 2018

So..... it turns out that this wasn't well and truely finished. Blend Glass was supposed to be a boolean, not another options for Blend Mode, blend_v1100 was a bad idea, Normal Metaless had its own problems with not enough validations.

See commits between 7/15/2018-8/1/2018. Also see #353, #357, #363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment