# Webgpu flatshading + DoubleSide broken

**URL:** <https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198>\
**Category:** Questions\
**Tags:** flatshading, materials, webgpu\
**Created:** [March 27, 2025, 11:35am UTC](https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198 "2025-03-27T11:35:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vegarringdal](https://avatars.discourse-cdn.com/v4/letter/v/c37758/32.png) [@vegarringdal](https://discourse.threejs.org/u/vegarringdal)\
**Post date:** [March 27, 2025, 11:35am UTC](https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198/1 "2025-03-27T11:35:12Z")

</div>

Hi

Is flatshading broken in webgpu or Im I doing something wrong ?

Tried to make a sample here

[https://codesandbox.io/p/devbox/exciting-rumple-kml4zq?workspaceId=ws\_NBvaWSN3citb5pTWdHXKW9](https://codesandbox.io/p/devbox/exciting-rumple-kml4zq?workspaceId=ws_NBvaWSN3citb5pTWdHXKW9)

Images from sample

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/0/5/05535c223b3ed80ff86a937d3a87ae7caafd0f0f.png)  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/7/27e5ad256cf9feaeeb04d4513ead7e1cf6b972d0.png)

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [March 28, 2025, 9:40am UTC](https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198/2 "2025-03-28T09:40:40Z")

</div>

Flat shading is implemented a bit different in both renderers. The root cause of the issue is an invalid geometry that you generate with `SphereGeometry`. Unlike `WebGLRenderer`, `WebGPURenderer` exhibits this issue.

`thetaStart` is set to `2` and `thetaLength` is set to the default `Math.PI` which means you create an inverted geometry which is not supported. The valid range of `theta` must be `[0,Math.PI]`. In your case it ends up `[2, 2 + Math.PI]`.

If you just want to create the lower half of a sphere, do it like in: [three.js dev template - module - JSFiddle - Code Playground](https://jsfiddle.net/yL4sodpe/2/)

```js
const sphere = new THREE.SphereGeometry(1.5, 15, 15, 0, Math.PI * 2, Math.PI * 0.5, Math.PI * 0.5 );

```

---

<div class="post-metadata">

**Author:** ![vegarringdal](https://avatars.discourse-cdn.com/v4/letter/v/c37758/32.png) [@vegarringdal](https://discourse.threejs.org/u/vegarringdal)\
**Post date:** [March 28, 2025, 11:44am UTC](https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198/3 "2025-03-28T11:44:01Z")

</div>

@Mugen87  
Thank you for fixing my weird sphere 👍

Updated my sample to show better the issue.  
added toggle button for switching between lights  
maybe Im doing someting wrong again 🤣

left = webgl and light up like expected  
right = webgpu, does not light up like it should

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/d/a/da26a2341c440e3c5b7c72059d17bd3f83d97c19.png)

right = webgpu, light is lighting up the inside when it should not

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/3/a/3a1afed268e7529fba83c56624f4dc2d3b082753.png)

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [March 30, 2025, 9:03am UTC](https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198/4 "2025-03-30T09:03:13Z")

</div>

Now that is indeed a bug. The new materials system flips the normals although that is not required when using flat shading. I’ll file a PR with a fix:

> <https://github.com/mrdoob/three.js/pull/30823>
>
> Related issue: https://discourse.threejs.org/t/webgpu-flatshading-doubleside-bro…ken/80198
> 
> \*\*Description\*\*
> 
> The PR ensures normals are not flipped when using flat shading.

---

<div class="post-metadata">

**Author:** ![vegarringdal](https://avatars.discourse-cdn.com/v4/letter/v/c37758/32.png) [@vegarringdal](https://discourse.threejs.org/u/vegarringdal)\
**Post date:** [March 30, 2025, 10:08am UTC](https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198/5 "2025-03-30T10:08:45Z")

</div>

@Mugen87 Thank you 🥇
