www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started 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
-
Either by tweaking the normals or in your shader?
-
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.