Author Topic: Inversed lighting  (Read 509 times)

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Inversed lighting
« on: October 26, 2015, 05:39:23 pm »
Hello,

Is it possible for an Object3D to have inversed lighting?
Basically the part that is lit by an light source becomes a shadow and the rest of the Object3D looks lit.

Cheers,
Abiram

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Inversed lighting
« Reply #1 on: October 26, 2015, 06:23:56 pm »
Either by tweaking the normals or in your shader?

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Inversed lighting
« Reply #2 on: October 29, 2015, 02:20:30 am »
Thanks!
Code: [Select]
obj.getMesh().setVertexController(
new GenericVertexController() {

@Override
public void apply() {
for (int c = 0; c < this.getSourceNormals().length; c++) {
final SimpleVector temp = this
.getSourceNormals()[c];
temp.scalarMul(-1f);
this.getDestinationNormals()[c] = temp;
}
}

}, false);
obj.getMesh().applyVertexController();
obj.getMesh().removeVertexController();
worked.