www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: AeroShark333 on October 26, 2015, 05:39:23 pm

Title: Inversed lighting
Post by: AeroShark333 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
Title: Re: Inversed lighting
Post by: EgonOlsen on October 26, 2015, 06:23:56 pm
Either by tweaking the normals or in your shader?
Title: Re: Inversed lighting
Post by: AeroShark333 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.