4
$\begingroup$

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!

$\endgroup$
3
  • $\begingroup$ is the object round and organic or blocky and geometrical? $\endgroup$
    – ruckus
    Commented Oct 12, 2015 at 14:05
  • $\begingroup$ well id prefer any solution to work on any kind of object, anything from cubes to humans but in this case organic and round $\endgroup$ Commented Oct 13, 2015 at 2:31
  • $\begingroup$ still looking for an answer thank you to the people who have taken the time to look over my question $\endgroup$ Commented Oct 27, 2015 at 1:07

2 Answers 2

1
$\begingroup$

enter image description here

  1. You need 2 object, one with a wire transparent material the other with solid material.

enter image description here

  1. You can adjust the alpha in Transparency.

enter image description here

enter image description here

3 And can control with a script, also control the scale.

script.py (example)

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[0].materials[0].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()

Related

Python API (bge object material)

bge.types.KX_BlenderMaterial.alpha

I couldnt found relate documentation about change material type: wire

$\endgroup$
0
$\begingroup$

You can do this in post processing, but it is not easy. Here's an image with a "grainy" effect on an outline:

enter image description here

And here's one with a more normal outline:

enter image description here

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:

$\endgroup$
3
  • $\begingroup$ Does this apply to the game engine? Do we have game engine shading nodes? $\endgroup$
    – Leander
    Commented May 9, 2017 at 8:40
  • $\begingroup$ This is in the game engine. You can convert the image from a not-currently-used camera into a texture. And then you can use that texture with the material nodes. $\endgroup$
    – sdfgeoff
    Commented May 9, 2017 at 19:01
  • $\begingroup$ Added example blend file. $\endgroup$
    – sdfgeoff
    Commented May 9, 2017 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .