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

Edges and Outlines behaving unexpectedly in version 9.111.3 #2072

Open
bruno-teruel opened this issue Aug 23, 2024 · 2 comments
Open

Edges and Outlines behaving unexpectedly in version 9.111.3 #2072

bruno-teruel opened this issue Aug 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@bruno-teruel
Copy link

bruno-teruel commented Aug 23, 2024

  • three version: 0.160.1
  • @react-three/fiber version: 8.17.5
  • @react-three/drei version: 9.111.3
  • node version: 20.10.0
  • npm (or yarn) version: 10.2.3

Problem description:

I have simple geometries which use Edges and Outlines from drei. They were working perfectly until I updated Drei from version 9.93.0 to version 9.111.3. At which point the Edges disappeared (in most cases, on some isolated geometries they exist on some edges but not others). Whereas the Outlines still work, but they no longer follow the screenspace property, even though i have it set to true.

Relevant code:

export const ExtrusionMesh = (props) => {
    const {
        color,
        drawEdges = true,
        drawOutlines = true,
        edgeColor,
        outlineThickness = 2,
        outlineOffsetFactor = 20,
        polygon, 
        height
    } = props

    const shape = useMemo(() => new THREE.Shape(polygon), [polygon])

    return (
        <>
        {(polygon !== undefined || shape !== undefined) &&
            <>
            <mesh
                position={[0, 0, 0]}
                scale={[1, 1, -1]}
                rotation={[Math.PI/2, 0, 0]}  
                castShadow
                receiveShadow
            >
                <extrudeGeometry 
                    args={[
                        shape, 
                        {depth: height, steps: 3, bevelEnabled: false}
                    ]}
                />
                <meshStandardMaterial
                    flatShading
                    side={THREE.DoubleSide}
                    color={color}
                />
                {drawEdges && 
                    <Edges color={edgeColor}/>
                }
                {drawOutlines &&
                    <Outlines   
                        screenspace
                        polygonOffset={true}
                        polygonOffsetFactor={outlineOffsetFactor}
                        thickness={outlineThickness}
                        color={edgeColor || 'gray'}
                    />
                }
            </mesh>
            </>
        }
        </>
    )
}

Suggested solution:

@bruno-teruel bruno-teruel added the bug Something isn't working label Aug 23, 2024
@TK009
Copy link

TK009 commented Aug 26, 2024

Might be duplicate of #2031

@bruno-teruel
Copy link
Author

Right, my bad. But I also mention the outlines. Should I create a new bug report for that and delete this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants