Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bevelled edges ... at rendertime

Discussion in 'Editor & General Support' started by llavigne, Jan 16, 2008.

  1. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    Mechanical objects always have a bevel to their hard edges, even a hairline, it catches the light very nicely and enhance realism.
    In a real time game engine, adding geometry bevel is too costly and so I was thinking why not let the shader do it.
    Has anyone done such thing, maybe Aras has one such shader in his magic coffer of wonder?
     
  2. MrSweet

    MrSweet

    Joined:
    Jan 19, 2007
    Posts:
    143
    I thought this would be done via texture skill?
     
  3. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    Shaders don't have edge information, hence bevelling becomes a pretty expensive post-process.

    What people normally is to texture their way out of it; add a thin line at hard outward-pointing edges. Usually, you make it a bit more specular to make it look like it's worn.
     
  4. MrSweet

    MrSweet

    Joined:
    Jan 19, 2007
    Posts:
    143
    Sorry for lame reply, give normal mapping try, in XSI I'm using Ultimapper for this.

    Hi-res model with bevels then capture this using ULT/normal mapping which also adds the maps to the low-res cage, doing all the work for you.

    It's can get complex tho

    Cheers

    Andy
     
  5. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
  6. MrSweet

    MrSweet

    Joined:
    Jan 19, 2007
    Posts:
    143
    That's not realtime tho?

    There's a bevel shader for MentalRay, but to be honest I like modeling the edges doing hi-res work, in XSI it's very easy to do, just select edge and bevel.

    I guess a real time shader would be good tho.

    Looking at Call of duty 4 last night and there's no bevels on anything, all texture trickery, looks very good tho, even tho most of the textures are poor!

    Cracking game :)
     
  7. Ricko

    Ricko

    Joined:
    Dec 9, 2007
    Posts:
    169
    Andy,

    Am I understanding correctly that you are using the normal map generated in XSI's Ultimapper feature to bypass the Unity generated normals on imported objects? I wish I'd thought of that sooner.

    Is it safe to say you are using FBX for the transfer from XSI to Unity?

    Thanks,
    Ricko
     
  8. MrSweet

    MrSweet

    Joined:
    Jan 19, 2007
    Posts:
    143
    Hi Ricko

    Yes normal and other maps genrated in XSI using MentalRay as Ult is a powerful tool and works very well as long as the set it up correct, you can even target a group of models and make maps from that which are applied to the low-res, full preview in GL/MR render tree. FBX out but only one UV set which is a pain for Lightmapping, but I get around this :)

    Apart from that it works prefect.

    Thanks

    Andy
     
  9. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
  10. Graph

    Graph

    Joined:
    Jun 8, 2014
    Posts:
    154
    the only thing that could be accomplished is in a post shader; in a manner akin to fxaa or edge detection; the problem is that to make that look halfway decent you need to use an aniso sampler; while for desktop machines with dedicated GPUs that poses no problem, on mobile devices, old consoles and integrated GPUs you'll be running into a wall with that since you have to sample depth, normal and prePass; the only way to do it propperly and with halfway decent performance is deferred ( since you also need the lighting pass ;) and passing the buffers into that; or pluggin it into your "composite" pass
    unfortunately i personally don't know if we have that lowLevel of access in unity..
     
  11. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    Hey Graph, thanks for that insight. I"m thinking, remember this is ONLY for 12-tri box objects; i.e. the one and only purpose of the shader, the only use, would be for rendering the blocks ...

    \

    .. in that sort of scene (i.e., you'd use other ordinary shaders for the rest of the scene). Perhaps that makes no difference and all that you say still applies?

    On a related topic, since you seem to know what you're talking about, would you agree that just using a bump map (i.e., very simply the edges fall off) might be the best approach?? Would that work? I've never seen a bump map bend and meet the edge of the next surface; but maybe it's what is "always done", I don't know. Cheers
     
  12. quizcanners

    quizcanners

    Joined:
    Feb 6, 2015
    Posts:
    109
    Conferno and dj_Ruska like this.