Skip to content
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

Bug WebGPURenderer set scene.environment break NodeMaterial #28857

Closed
Makio64 opened this issue Jul 12, 2024 · 3 comments
Closed

Bug WebGPURenderer set scene.environment break NodeMaterial #28857

Makio64 opened this issue Jul 12, 2024 · 3 comments
Labels
Milestone

Comments

@Makio64
Copy link
Contributor

Makio64 commented Jul 12, 2024

Description

I have a scene with a mix of StandardMeshNodeMaterial and custom NodeMaterial. I get an error message only when i set the scene.environment, If I use MeshBasicNodeMaterial instead of NodeMaterial it works.

// error when using NodeMaterial
Uncaught TypeError: properties.nodes is not iterable
    at Proxy.analyze (chunk-OPBR7TQE.js?v=ac4c42a7:4013:35)
    at Proxy.build (chunk-OPBR7TQE.js?v=ac4c42a7:411:12)

Reproduction steps

Create a scene with an hdr set to scene.environment, add a mesh with a NodeMaterial into the scene.

Code

import { BackSide, Color, IcosahedronGeometry, Mesh } from 'three'
import { NodeMaterial, uniform, uv, mul, add, vec4, mix, sub, clamp } from 'three/examples/jsm/nodes/Nodes.js'
import { MeshBasicNodeMaterial } from 'three/addons/nodes/Nodes'

//...
		const topColor = uniform(new Color(0x020f56))
		const bottomColor = uniform(new Color(0x41b883))
		const opacity = uniform(0)
		const UV = add(mul(sub(uv().y, .5), 4), 0)
		const skyColor = mix(bottomColor, topColor, clamp(UV, 0., 1.))

		const material = new NodeMaterial() // BUG : if NodeMaterial no problem except if scene.environment!=null, work with MeshBasicNodeMaterial.
		material.colorNode = vec4(skyColor, opacity)
		material.side = BackSide
		material.depthWrite = false
		material.depthTest = true
		material.transparent = true

Live example

Is there a fiddle. with hdr used on latest ?

Screenshots

No response

Version

r166.1

Device

No response

Browser

No response

OS

No response

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 12, 2024

Is there a fiddle. with hdr used on latest ?

Try it with: https://jsfiddle.net/y41zsgq7/1/

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 20, 2024

Create a scene with an hdr set to scene.environment, add a mesh with a NodeMaterial into the scene.

I've done that in the following fiddle but I'm unable to reproduce. Do you mind updating the code so the error pops up?

https://jsfiddle.net/gpq1nmez/2/.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 23, 2024

Closing for now. Feel free to reopen the issue when a live example for reproduction can be provided.

@Mugen87 Mugen87 closed this as completed Jul 23, 2024
@Mugen87 Mugen87 removed the Bug label Jul 23, 2024
@Mugen87 Mugen87 added this to the r167 milestone Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants