question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebGLDeferredRenderer do not support materials with textures

See original GitHub issue
Description 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 image

Expected behaviour using default WebGLRenderer Walls show the “crate.gif” texture image

More screenshots of my own project:

Actual behaviour with WebGLDeferredRenderer (only transparent objects are rendered) image

Expected behaviour with WebGLRenderer image

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:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
donmccurdycommented, Jan 2, 2020

Maybe is there some way to implement this type of smart light selection in Three.js forward renderer?

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).

2reactions
donmccurdycommented, Jan 1, 2020

@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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found