Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:31:08+00:00 2026-06-18T12:31:08+00:00

I am trying to write a set of shaders to be able to draw

  • 0

I am trying to write a set of shaders to be able to draw the edges of surfaces (not polygons!), like in the game Echochrome.

From what I can remember from graphics programming, the technique for doing this is to make a multi-pass render. The first pass should encode face normal vectors and depths as RGBA colors and draw these to a texture. The second pass should look up values in the texture and draw an edge if the normal or depth information at the current fragment varies significantly from the surrounding texels’ normals or depths.

(Note: If there is an easier way to do this, please tell me, especially if it’s easy to do in Flash. However, my specific question is as follows.)

I have hit a snag in programming the first pass. From what I’ve read in Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach by Frank D. Luna, the correct way to “interpolate” a normal vector is to average the normal vectors for the triangle’s vertices, then use that value for every fragment on the surface. However, my fragment shader is interpolating the normal vector instead, which results in drawing a gradient instead of solid colors for the surfaces.

How can I get AGAL to do the necessary averaging instead of interpolating?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:31:09+00:00Added an answer on June 18, 2026 at 12:31 pm

    I think you will need to duplicate your vertices, so that each triangle has it’s own three vertices, not shared with any other triangle. The normal for each vertex of the triangle should be the averaged normal: All three normals for a triangle will be the same, so that the interpolated value will not change. I know that this is not ideal, but I don’t of any other solutions.

    In OpenGL, you can calculate the averaged normals in a geometry shader or use the “flat” qualifier so that the normals are not interpolated, but I don’t think you can do either of these in AGAL.

    See this question/answer for some more info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to write a chat, like on facebook, I wondered if two clients can
I'm trying to write a script that can control different windows from different programs
I'm trying to write a result set (100,000 rows, 45 cols) from a web
I'm trying write a code that can the set property value through the lambda
I'm trying to write a macro that can generate a set of functions that
I am trying to write a program to display a set of values from
Trying to write a fourth column to a set of data which looks like
I m trying write code that after reset set up rrpmax as 3000. It
I am trying to write an android tablet application which scans for a set
I'm trying to use openmp to multithread a loop through std::set. When I write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.