I was wondering how I could take a transparent object in the bge and give it a borderlands style edge outline so that the object is still transparent but has a black edge. Right now Im using a solidify modifier to add the outline but i cant get it to cooperate with the object transparency. Im thinking that this will probably involve some code which im totally fine with. Although i would prefer a solution without code. thanx for all your answers!
- You need 2 object, one with a wire transparent material the other with solid material.
- You can adjust the alpha in Transparency.
3 And can control with a script, also control the scale.
from bge import logic class ObjectsList(): def __init__(self, controller): self.obj = [obj for obj in logic.getCurrentScene().objectsInactive if not obj.name[-1].isdigit()] self.objLiner = [obj for obj in logic.getCurrentScene().objectsInactive if obj.name[-1].isdigit()] def main(self): print(self.obj) if len(self.obj) > 0: obj = self.obj.pop(0) outliner = self.objLiner.pop(0) ##creating a solid obj mainObj = logic.getCurrentScene().addObject(obj.name) ##creating outliner outlinerObj = logic.getCurrentScene().addObject(outliner.name) ##scaling up outlinerObj.localScale = [1.04]*3 ##changing alpha outlinerObj.meshes.materials.alpha = 0.3 outlinerObj.suspendDynamics(True) outlinerObj.setParent(mainObj) print('obj created...') def main(controller ): if not 'init' in controller.owner.getPropertyNames(): controller.owner['objHandler'] = ObjectsList(controller) controller.owner['init'] = True return controller.owner['objHandler'].main()
I couldnt found relate documentation about change material type: wire
You can do this in post processing, but it is not easy. Here's an image with a "grainy" effect on an outline:
And here's one with a more normal outline:
As you can see here, the outline is not blocked by other objects. This is just how I have it set up currently. With some more tweaking you can make it so that other objects block the outline.
How is this done? I create a renderpass of just the chair (by setting everything else invisible temporarily). Then I run an edge-detect on that and overlay it on the scene. This is done through render to texture to get the image into a texture, and a node shader. This is not trivial to explain how to set up, so here's a blend file for you to play with: