Sign in to follow this  

Billboarding quad where specular is highest

This topic is 4180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Everyone! I`d like to make a blink effect on a face where specular value is highest. Anyone knows how to calculate the position with strongest specular using vertex positions and vertex normals? Thanks in advance! arpika

Share this post


Link to post
Share on other sites
Doing that on the CPU maybe isn't very good idea, usually people do that as a post process step in screen space, using some sort of glow-buffer, where only they render only specular component for example.

Of course, if you still want to do that on CPU, and you have the light as a directional/point light source, you could first drop back-faced faces to the light, then process all front faces, computing light reflection vectors for every vertex and form a triangular frustum from every triangle. Then test the viewer being inside, or close to that frustum. Choose a threshold, beyond that you drop specular highlight.
Then, when brightest frustum (triangle) is found, convert the viewing vector into position over the triangle - that's all.

Share this post


Link to post
Share on other sites
You could render point sprites (flares) with at the positions of the vertices in your object, and compute the specular component but let the output control point size instead of color (all this in a vertex shader).

That way a big specular reflection value would be rendered as a big point sprite, and a small specular reflection would be a point sprite so small it wouldn't be visible (no flare).

This would only be at the vertices, tho, so no flares in the middle of a face.

Good luck!

/Simon

Share this post


Link to post
Share on other sites
(sorry, I know you said you get it)

Might I recommend you do this with point sprites whose placement is determined by that half-angle stuff

Then solve for where the interpolation of the surface normal equals* (to a good approximation) the half-angle (half way between the light vector and eye vector)

The size would be, as previously stated, based on the brightness of the light.

I haven't thought through what the math for this would look like. With 3 variable vectors it may be a nightmare to solve for equality. Maybe iterate a fixed number of times.

Anyway, sounds like fun (and could look very cool for anime style rendering)


-Michael g.

Share this post


Link to post
Share on other sites

This topic is 4180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this