hrgdavor / jscadui

MIT License
30 stars 9 forks source link

jscad.app brightness problem #83

Closed Hermann-SW closed 9 months ago

Hermann-SW commented 9 months ago

Please open this jscad.app 24250 byte data uri script

Click on "FRONT", and you see model bright. Click on "BACK" and model is a bit darker. Click on "BOTTOM" and model is darkest.

Open just https://jscad.app and turn default model, it is equally bright from all sides.

What do I do wrong in my face colored C20 fullerene model?

Hermann-SW commented 9 months ago

Correction, now default model is darker from bottom for jscad.app as well :-(

Please open below model in https://openjscad.xyz, regardles how you turn it, it has same brightness. Only difference is that the FRONT/.../BOTTOM cube from jscad.app is missing. How can I change my script to have same brightness from all sides? Is there an API call?

const jscad = require('@jscad/modeling')
const { intersect, subtract } = jscad.booleans
const { colorize } = jscad.colors
const { cube, sphere } = jscad.primitives

module.exports = () => {
  const outer = subtract(
    cube({ size: 10 }),
    sphere({ radius: 6.8 })
  )
  const inner = intersect(
    sphere({ radius: 4 }),
    cube({ size: 7 })
  )
  return [
    colorize([0.65, 0.25, 0.8], outer),
    colorize([0.7, 0.7, 0.1], inner),
  ]
} 
hrgdavor commented 9 months ago

@Hermann-SW that is a difference in 3d scene setup. jscad.app has the spotlight in a fixed postition, while xyz moves the spotlight relative to the camera movement.

This could be an option for the view, and we did consider implementing it as it has advantages for inspecting models, and is not unusual for CAD.

Hermann-SW commented 9 months ago

@hrgdavor Thanks for he explanation. And +1 from me for this as enhancement request.

hrgdavor commented 9 months ago

I played with it a bit .

left if current jscad.app, mid is xyz .. and right is jscad.app with light following camera. xyz has two lights, so it looks more interesting.

image

image

image

image

hrgdavor commented 9 months ago

this will soon be on jscad.app

Hermann-SW commented 9 months ago

Thank you. I just tested https://jscad.app, and all sides inclusive bottom now show equally bright !