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

GLTFExporter: Preventing to write null for attenuationDistance. #29035

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

Cold5tar
Copy link
Contributor

@Cold5tar Cold5tar commented Jul 31, 2024

Fixed #29034

Description

Having no material.attenuationDistance set in the material, defaults to +Infitity. +Infitity cannot explicitilly be set in GLTF file and automatically is set to NULL by Three.js. NULL property is not allowed in JSON and makes the file invalid. It then cannot be read by various softwares, for example - Blender 4 - > onwards.

According to KHR_materials_volume in order to convey infinity, the value should be ommited. We propose adding check if the material.attenuationDistance !== Infinity we either send that parameter if its set, or don't send it if its default.

Having no attenuation distance set in the project/code, defaults to infitity. This property then cannot be set in GLTF file and automatically sets to NULL. NULL property cannot be read by various softwares, for example - Blender 4 - > onwards.

By adding check if distance is !== infinity we either send that parameter if its set, or don't send it if its default.
@Cold5tar Cold5tar changed the title Fix GLTFExporter.js by checking if attenuation distance is set Fix GLTFExporter.js by preventing to write Null for material.attenuationDistance Jul 31, 2024
@Mugen87 Mugen87 added this to the r168 milestone Jul 31, 2024
@Mugen87 Mugen87 changed the title Fix GLTFExporter.js by preventing to write Null for material.attenuationDistance GLTFExporter: Preventing to write null for attenuationDistance. Jul 31, 2024
@Mugen87 Mugen87 merged commit 02c1580 into mrdoob:dev Jul 31, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Material Attenuation distance defaults to NULL for GLTF export
2 participants