CesiumGS / CesiumGS/obj2gltf

[suggestion] In obj2gltf, create a flag --doubleSidedMaterial to allow materials to be doubleSided regardless of transparency

Open
#293 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.9k
Forks
311
PR merge metrics
No merged PRs in 30d

Description

Currently, in the `obj2gltf` repo, a `gltf` output file will have the `doubleSided` property of its `material` tag set to `true` or `false` depending of the [d](https://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html) or [Tr](https://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html) parameters found in the `mtl` file of the `obj` model.

This is problematic because there are some `obj` models that have an `alpha` value of `1.0` but where not all faces of the model have been properly scanned.

One scenario that I am investigating right now is where a person did a 3D scan of a bridge by standing at the foot of the bridge and generated an `obj` file. The `obj` model renders fine but when converted to `gltf`, the top of the bridge is transparent because:

1. that part of the bridge was never scanned
2. at the top of the bridge, the normals are all facing downwards
3. the model has an alpha value of 1.0

I have tested the model by setting the `d` value in the `mtl` file to `0.99`. Things are marginally better but then when the model is rotated, at any given time, all faces of the model are visible even when they're not supposed to. (Eg. the foot of the bridge is visible when it's not supposed to while the camera is placed at a birds' eye view)

I would like to suggest adding an extra parameter named `--doubleSidedMaterial` to the list of command line arguments to toggle the material `doubleSided` property of the resulting `gltf` file. By default, this parameter will be false thus preserving the current behaviour of the converter.

Please give me your thoughts.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the obj2gltf command-line entry point and the MTL-to-glTF material conversion path. Check how existing arguments control material properties, then run the current OBJ/MTL conversion tests or examples. Done means the new flag can force doubleSided materials while its default preserves current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.