WebGLDeferredRenderer do not support materials with textures
See original GitHub issueDescription of the problem
WebGLDeferredRenderer do not support materials with textures.
Steps to reproduce:
- Create a new scene using the WebGLDeferredRenderer
- Add a Mesh with a material using a texture
To reproduce the issue I have only changed the following lines of the webgldeferred_animation.html
file, loading “crate.gif” texture and using it as texture map for the walls.
function initRoom() {
var loader = new THREE.TextureLoader();
loader.load("./textures/crate.gif", function(map) {
var size = 100;
var geometry = new THREE.PlaneBufferGeometry( size, size );
var material = new THREE.MeshPhongMaterial( { map, color: 0x222222, specular: 0x222222, shininess: 75 } );
// . . .
});
}
Actual behaviour using WebGLDeferredRenderer Walls are black
Expected behaviour using default WebGLRenderer Walls show the “crate.gif” texture
More screenshots of my own project:
Actual behaviour with WebGLDeferredRenderer (only transparent objects are rendered)
Expected behaviour with WebGLRenderer
Note: This does not affect transparent objects since they are drawn with forward rendering
Link to example reproducing the bug:
https://github.com/jhm-ciberman/three.js/commit/5fac6b002650289bfdfdfac039128ee8ca1e49ce#r36622571
Three.js version
- Dev
- r112
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Hardware Requirements (graphics card, VR Device, …)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Performance when handling large number of lights in a city ...
I am looking forward to add lights to the scene but if I add a large number of lights (30+) ... WebGLDeferredRenderer do...
Read more >Troubleshoot material and texture swatches do not appear in ...
In the Preferences window (Windows > Settings/Preferences > Preferences), Display section, ensure that Render swatches (startup) is enabled. You ...
Read more >Materials Best Practices — NVIDIA Omniverse™ SimReady ...
That said, objects, materials, and textures should always be good citizens of the entire ecosystem and not cause performance or resource issues with...
Read more >Underlying geometry shows through materials with t...
Whenever I render an object with a material applied which uses an image texture in it, (not ones with just shaders), the underlying...
Read more >Lit Shader | Universal RP | 8.0.1 - Unity - Manual
This makes rendering faster. URP cannot render Meshes in one batch if they have different Materials or if the hardware does not support...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes — this has been proposed in https://github.com/mrdoob/three.js/issues/5180 and an implementation attempted in https://github.com/mrdoob/three.js/pull/15223. But there are some issues with that PR and it’s stalled. I suspect something simpler (using N nearest lights, or filtering with
light.distance
) would also be possible though much more limited, but I haven’t looked closely at this code.Finally, there are some more advanced ideas like progressive global illumination (https://github.com/mrdoob/three.js/issues/14051) and lightprobe volumes (https://github.com/mrdoob/three.js/issues/16228).
@jhm-ciberman note that even in a production-grade deferred rendering workflow, like Unity’s, deferred rendering comes with significant limitations: no semi-transparency, no antialiasing, and some performance overhead. But Unity has a good light-baking workflow, and might even have ways to do that with procedural scenes… in any case, best of luck!