fix: ceiling transparent by default when no material is set

The ceiling renderer was falling back to DEFAULT_CEILING_MATERIAL (an
opaque MeshStandardMaterial) when no material was set on the node.
This made ceilings fully opaque instead of using the intended
transparent grid pattern for scenes created before v0.3.2.

Now uses resolveMaterial() to extract the color from whatever material
config exists (preset, custom, or default white), then always creates
the proper transparent ceiling materials for both faces.
This commit is contained in:
Pascal
2026-03-31 19:31:46 +00:00
parent e84e870248
commit b6636c179b
@@ -1,9 +1,8 @@
import { type CeilingNode, useRegistry } from '@pascal-app/core'
import { type CeilingNode, resolveMaterial, useRegistry } from '@pascal-app/core'
import { useMemo, useRef } from 'react'
import { float, mix, positionWorld, smoothstep } from 'three/tsl'
import { BackSide, FrontSide, type Mesh, MeshBasicNodeMaterial } from 'three/webgpu'
import { useNodeEvents } from '../../../hooks/use-node-events'
import { DEFAULT_CEILING_MATERIAL } from '../../../lib/materials'
import { NodeRenderer } from '../node-renderer'
const gridScale = 5
@@ -40,16 +39,9 @@ export const CeilingRenderer = ({ node }: { node: CeilingNode }) => {
const handlers = useNodeEvents(node, 'ceiling')
const materials = useMemo(() => {
const mat = node.material
if (mat) {
const props = mat.properties
const color = props?.color || '#999999'
const props = resolveMaterial(node.material)
const color = props.color || '#999999'
return createCeilingMaterials(color)
}
return {
topMaterial: createCeilingMaterials().topMaterial,
bottomMaterial: DEFAULT_CEILING_MATERIAL,
}
}, [node.material, node.material?.preset, node.material?.properties, node.material?.texture])
return (