skip to Main Content

I’m playing around with lighting a cube. I’m not really sure what I want yet so I’m just throwing this out there. This is what I’ve got…

…but I don’t like the sharp edges. Removing the lighting obviously means you can’t see the edges any more….

…which is no good as you still need to be able to identify the faces of the cube.

I guess I’m looking for some kind of lighting that smoothly transitions between the faces, doesn’t look too harsh yet still enables you to identify the object as a cube. Tessellating the edges is not really an option at the moment. Anyone done anything similar?

UPDATE: Alas my comment reply to @Jherico was too long so adding an update here instead.

I don’t really have a shader at the moment as I’ve just started on this. I was playing around in photoshop to see what blurring the edge would look like or adding a thin highlight to somehow extenuate it. I guess what I’m really looking for is just to get away from the harsh edge look.

I was researching if there were any tricks from the film industry or even what techniques high quality renders use to soften edges. Or maybe look at using something like rim lighting to take your focus away from the sharp angles. I would image tessellation could help a lot but ideally I’d like a cheaper technique that could be used on lower spec hardware.

2

Answers


  1. It mostly depends on the implementation of your lighting shader. If you increase the ambient light factor, while reducing the directional light factor, the edges will become less prominent. ‘No lighting’ is basically equivalent to 100% ambient light.

    Without seeing the implementation of your shaders though, it’s impossible to suggest how you’d actually go about doing this. Taking as an example a lighting shader I’ve worked with… the ambient and directional lights are all passed in as uniform values. My implementation starts the ambient light out as a gray value of 0.2. If you were to increase that value then the transition between face and edge should have less contrast.

    Login or Signup to reply.
  2. Here are three ideas that may fit your desire :

    1. Try using deferred shading and blurring the normal buffer. I do fear for the objects borders between others and background.

    2. Create a normal map that fake soften edges.

    3. In the tessellation, I do believe you have access to the surrounding primitives. With them you can send the normals of the other faces to the fragment shader. When close to an edge, blend the normal of your face with the one of the closest.

    Pick one.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search