Inversed lighting

Started by AeroShark333, October 26, 2015, 05:39:23 PM

Previous topic - Next topic

AeroShark333

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

EgonOlsen

Either by tweaking the normals or in your shader?

AeroShark333

Thanks!
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.