-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
[feature request] Support lights defined in glTF #3
Comments
KHR_lights_punctual, KHR_TEXTURE_TRANSFORM and KBR_materials_sheen are supported by the PasGLTF example viewer now (see https://github.com/BeRo1985/pasgltf/blob/dc27732d961a5886fde8989172fddc44a09db6c7/src/viewer/UnitGLTFOpenGL.pas and https://github.com/BeRo1985/pasgltf/blob/dc27732d961a5886fde8989172fddc44a09db6c7/src/viewer/UnitOpenGLShadingShader.pas ). KBR_materials_clearcoat and EXT_lights_image_based are in the work and on my todo-list. |
Thank you very much! I'll look over it during the weekend. One comment I would have is that I see you implement them by extending CGE is using |
In my opinion, the PasGLTF unit itself should remain independent from extensions by simply passing all extras and extensions 1 to 1 as JSON objects, so that the whole PasGLTF unit remains flexible and easier to maintain, so that it parses only the whole stablized/fixed core GLTF 2.0 spec itself, but not the extensions nor the extras . Because if one reads through the commits in the Khronos-GLTF-Spec-Repo, one sees that extensions can change very quickly. For example KHR_lights_punctal was previously KHR_lights with different definitions etc. The same applies to other rather non-stable/non-fixed extensions like KHR_marterials_clearcoat, KHR_marterials_sheen, KHR_marterials_specular and so on. In a nutshell and in my observation, GLTF is too much in a state of constant evolution and constant change for this with regard to the extensions. |
OK, I see your point. How about adding a unit like For each extension (like
So the TGLTFKhrLightsPunctual constructor would read light information from already-loaded glTF document (very similar to how This way other units (like the viewer in My reasons for this is that I would very much like to use your code in Castle Game Engine, for glTF handling :) Currently I can happily use the unit |
Well, what would be wrong with copying and adapting the KHR_lights_punctal parsing and loading code from |
I'm going to do that then :) The reason I instead proposed In any case, you gave me a great headstart, since I can look and see how you did everything in |
I am restructuring the whole PasGLTF viewer example also in the moment, for modern newer OpenGL features, as such as for example for the usage of bindless textures, so that the fragment shader will have direct access to all loaded textures at every time point then, without oldschool glBindTexture calls on CPU-side just per a |
Okay, three to four draw calls, when transparent and alpha-tested materials are also existent then. 😀 |
There are glTF 2.0 extensions to define lights inside glTF file. It would be very useful for me (and Castle Game Engine :) ) if PasGLTF supported reading such lights.
Punctual lights (point, spot, directional) are defined in
https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual .
Blender can export such lights. I made example in CGE demo-models, https://github.com/castle-engine/demo-models/tree/master/gltf/punctual_lights . The test_lights.gltf inside defines 3 lights (point, spot, directional).
Image-based lighting is defined in
https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_lights_image_based .
Example of it is in
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/EnvironmentTest .
The text was updated successfully, but these errors were encountered: