How to find the edge

Hi all,

I have been pondering an idea for creating a "halo" effect which surrounds the player/object for a couple of days now, but it relies on me knowing the edge where the light stops at and becomes a shadow.



e.g.


            /                               <--
          /                                 <--  Light coming this way
        /                                   <--
      /           



The top most vertex is what im interested in. Anyone know how?

Thx, DP

you can easily find edges by checking the dot product of the face normals to the light vector on either side. if one is positive and the other negative, then you have an edge.



why do you want the verticies and not the edges though?

so I can construct a trimesh around the model, the vertices closest to the model given a yellow colour, while the vertices outside are given a transperant colour, thus a halo emerges.



Thx zenic

btw, by “halo” i mean “bloom”. Like so:







Mojo mentiond that this is a perpixel operation, but I think I can do it on a per vertex operation using meshes…



DP

The effect in the image is “bloom” or High Dynamic Range Images (which tries to simulate how light scatters in your eye when it’s particularly bright). They are also post-process effects, meaning it’s applied to the scene after geometry is rendered. Done in Pixel Shaders. Blooms adjust to how the geometry and light interact, what’s obscruing and what’s being obscured, so the bloom is a dynamic “shape”, in fact in the above screenshot, if you moved to the either side, the bloom might go away completely. I don’t see how that will be accomplished accurately and quickly in the fixed pipeline. But… people used to say the world was flat. :slight_smile:



NOTE: I don’t know much about HDRI except for a couple things I read awhile back, so I might be mistaken on a few points.

well…im sure someone has thought of this before me…but here goes:



What im proposing to do is that I create a dual layer trimesh whereby the layers are interconnected. Like many extruded triangles connected together to for a mesh. The vertices nearest the geometry that is "blooming" has the colour yellow, the ones that are furthur away, have a transperant. And that is the given bloom.



However, many calculations will be needed to create a realistic bloom (from the pic, not the whole statue is blooming, just the front). So some vertex colours have to be adjusted. And ofcourse, how close the light is, determines how bright the bloom is.



Whats good about this design (im sure its a + amongst many -ves) is that you can adjust the level of detail on that bloom.



The only reason I need to find the edge, thinking about it more i need to find the backfacing triangles, is to determine which way the light is coming from and apply the vertex colours.



Thats the idea anyway, what ya think? Could be a first in gaming :smiley:



DP

Sounds like a lot of work for something that can be done easier via shaders, but I’m wrong alot. :slight_smile: Good luck with it.

yeah thats very true :frowning:



But I dont have a card that supports Fragment Shaders…only Vertex Shaders…



Besides, if the performance is good, and it doesn’t require any extentions…why not? :slight_smile: