Author Topic: Light source every direction?  (Read 2249 times)

Offline Kumaraswamy

  • byte
  • *
  • Posts: 15
    • View Profile
Light source every direction?
« on: October 24, 2021, 12:51:12 pm »
Hi, I would like to know how can I make the light visible from every direction?
I don't want it to be dark on one side and not the other.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12297
    • View Profile
    • http://www.jpct.net
Re: Light source every direction?
« Reply #1 on: October 24, 2021, 03:20:05 pm »
You can't, because that's the way in which lighting works as it takes the angle between a vertex normal and the vector from the light source to that point. In case of backfaces, this angle is larger 90° hance the darkness. Would it be otherwise, then there would be no lighting at all, because it would never get darker.

Offline Kumaraswamy

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Light source every direction?
« Reply #2 on: October 24, 2021, 04:53:12 pm »
I don't want the shadow or the part where the light isn't reached to be dark.

Offline AeroShark333

  • float
  • ****
  • Posts: 320
    • View Profile
Re: Light source every direction?
« Reply #3 on: October 25, 2021, 04:35:15 am »
Maybe you could have 0 light sources and use https://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#setAdditionalColor-com.threed.jpct.RGBColor- to 'add' your own lighting...
But I'm not sure if this would give the desired result...
I believe the best way to work yourself around the default lighting system of jPCT is to write your own shaders which take care of the lighting themselves... Could be tricky however

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12297
    • View Profile
    • http://www.jpct.net
Re: Light source every direction?
« Reply #4 on: October 25, 2021, 04:31:00 pm »
I don't want the shadow or the part where the light isn't reached to be dark.
I'm not sure if I understand, what you want. Without shadows, there's no light. If you want something to be uniformly "lit", you can adjust the ambient light's intensity and/or color. You can also give an object an additional color: https://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#setAdditionalColor-com.threed.jpct.RGBColor-

Maybe that helps? In general, all parts that aren't lit directly by a light source still have the ambient color and the additional color.

Offline Kumaraswamy

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Light source every direction?
« Reply #5 on: October 25, 2021, 05:30:51 pm »
i'll try that, thanks!

Offline AeroShark333

  • float
  • ****
  • Posts: 320
    • View Profile
Re: Light source every direction?
« Reply #6 on: October 31, 2021, 10:31:56 pm »
I just realized there's also:
Code: [Select]
World#setAmbientLight(255,255,255);... Might be useful