UPDATE: The demo is finally live! Check it out here: . Use the dropdown menu to switch between torus models and see the issue in action. Please note that WebGL MRT extensions are required for this demo.
I have been working on developing my own WebGL deferred rendering engine for some time now, and I have successfully created a prototype using GBuffers and MRT extensions that effectively renders teapots. This project was started from scratch as a way for me to learn WebGL thoroughly without relying on any frameworks, while gaining a deep understanding of deferred rendering. For those interested, the source code can be found on GitHub at: https://github.com/bharling/webgl-defer
After getting tired of only seeing teapots, I attempted to implement a loader for models in THREE.js JSON format. While I managed to load meshes with accurate vertices and index buffers, the normals did not render correctly. I chose to support indexed geometry with vertex UVs, vertex normals, and a single material for now (with plans to move towards PBR). Any other data in the JSON file is ignored, and only supported data is written directly to Float32Arrays, among others. Below is the code snippet for importing the model, along with a screenshot showing the abnormal normals being encountered:
// Importing a ThreeJS model
parseThreeJSModel: (data) => {
// Parsing logic goes here...
}
The screenshot above showcases the world-space normals gbuffer which displays the issue.
One major divergence in my engine is that I do not store face information in classes like `THREE.Face3`, but instead write the data directly into buffer attributes, similar to `THREE.BufferGeometry`.
So far, I had been using the Utah Teapot model from the 'Learning WebGL' course, specifically from this link: . This model works perfectly fine in my engine and supposedly follows an early version of the THREE JSON format. However, even a simple cube exported from the latest Blender exporter does not perform as expected.
Any suggestions or insights would be greatly appreciated. Thank you!
UPDATE: Here is a screenshot showing the normal pass using the teapot model from the WebGL tutorials. Note: I am not implying that the THREE.js exporter is faulty; rather, it seems there might be an issue with my parsing code. After extensively reviewing the GBuffer implementation in this engine over the past year, I am confident it is correct now. I just seem to be struggling with understanding the THREE.js JSON model format.