-
Notifications
You must be signed in to change notification settings - Fork 271
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
support KHR_lights_punctual, KHR_materials_emissive_strength, EXT_meshopt_compression, EXT_texture_webp #1259
Comments
https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual/README.md directional -> DirectionalLight
attenuation = max( min( 1.0 - ( current_distance / range )^4, 1 ), 0 ) / current_distance^2 -> |
Distance AttenuationglTF and x3d treat attenuation with distance somewhat differently. Both have an absolute cutoff and both have inverse square falloff. But glTF additionally has additionally a smoother transition close the absolute cutoff. A parabola shifted by -b/2a in x (distance) and c/a - b^2/(4a^2) in y (1/attenuation). It is not possible to approximate the additional gltf falloff near the range in x3d. Therefore x3d attenuation factors should be 0,0,1. So at 10m distance the attenuation is already 0.01. The intensity has be high for spotlights and pointlights. glTF has effectively fixed attenuation. So for a large scene, it is necessary to have high intensity lights. |
Angular AttenuationX3D:
glTF: interpolation of cosines
In short, X3D interpolates uses angle difference ratios which glTF uses ratio of the differences of the cosines, then squared for sharper falloff. |
pointlight.zip by threejs editor |
spotlight.zip |
The Khronos gltf viewer uses a slightly modified version of the recommendation in the glTF spec. for angular attenuation: float getSpotAttenuation(vec3 pointToLight, vec3 spotDirection, float outerConeCos, float innerConeCos) {
float actualCos = dot(normalize(spotDirection), normalize(-pointToLight));
if (actualCos > outerConeCos) {
if (actualCos < innerConeCos) {
return smoothstep(outerConeCos, innerConeCos, actualCos);
}
return 1.0;
}
return 0.0;
} |
PR #1292 |
PR #1293 |
Wondering if there are corresponding changes in rendering hardware and APIs. When ready, we should be prepared to propose potential additions for X3D 4.1. Once fully ready for ISO with multiple implementations and corresponding examples, mature capabilities can be designated as an X3D Suggested Practice or Web3D Recommended Practice. If possible, a single simple parameter for appropriate nodes and node types might be useful. For example, with backwards compatibility:
|
I believe you are referring to the light attenuation changes of glTF relative to X3D. |
Or (preferred) Decompress views in Loader, and reassemble buffer and bufferviews. |
These glTF extensions are fairly straightforward to implement:
The text was updated successfully, but these errors were encountered: