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.

TypeError: Cannot read property 'transparent' of undefined (renderObjects)

See original GitHub issue

Describe the bug Bug appears when I use EffectComposer. More precisely in the RenderPass. To Reproduce In my scene I use (from 131.3)

import * as THREE from 'three';
import { EffectComposer } from '../vendor/postprocessing/EffectComposer.js';
import { RenderPass } from '../vendor/postprocessing/RenderPass.js';
...
var renderer = new THREE.WebGLRenderer();
var composer = new EffectComposer(renderer);
...
composer.addPass(renderPass);
composer.addPass(copyPass);
...
composer.render(delta);

Code above worked without any issues on an older version of Three.

I was able to find and fix the issue. In function renderObjects(renderList, scene, camera) you can find an assignment const material = overrideMaterial === null ? renderItem.material : overrideMaterial; If overrideMaterial material is undefined, then it will assign undefined to the material and crash later in renderObject function. Probably, it’s better to use “==” instead of “===”. It fixes the problem.

Platform:

  • Device: desktop
  • OS: [Windows, MacOS]
  • Browser: [Chrome]
  • Three.js version: [dev, r131.3]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
WestLangleycommented, Aug 5, 2021

Maybe this is would be a safer pattern:

const material = overrideMaterial ? overrideMaterial : renderItem.material;
0reactions
total3dxcommented, Aug 6, 2021

switch to Babel you already will see an issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'transparent' of undefined #26
Hi, I'm using Gatsby and if I use "bg-", it throws the following error: const NuForm = styled(Form)` ${tw`bg-transparent uppercase ...
Read more >
Uncaught TypeError: Cannot read property 'opacity' of undefined
Try this. $(document).ready(function(){ $("#addtask").click( function() { var opacity = $("#taskinput").css("opacity"); ...
Read more >
Object3D – three.js docs
Object3D. This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in...
Read more >
TypeError: Cannot read properties of undefined (reading 'filter')
Im trying to make a search bar to search in an array of fruits but I keep getting the following error: TypeError: Cannot...
Read more >
CIQ.ChartEngine - ChartIQ Documentation
You can also set the main htmlControls object to null to disable all controls ... panels no longer dependent on this property and...
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