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 3424236
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:27:01+00:00 2026-05-18T06:27:01+00:00

I have been struggling for days to find any resources to help me write

  • 0

I have been struggling for days to find any resources to help me write a simple glow/blur shader using High Level Shader Language and DirectX 9 Managed Libraries.

All I need to do is have an array of CustomVertex.TransformedColored vertices drawn as simple lines and then blurred/glowed by the HLSL effect.

I have searched the internet for about three days now with some results, but I just cannot find a really good tutorial or example. I have a basic understanding of HLSL but I do not understand it enough to figure out how to write this shader (I have read the HLSL chapter in 3 DirectX books as well).

Here is some (abridged) code:

CustomVertex.TransformedColored[] glowVertices = new CustomVertex.TransformedColored[4];
glowVertices[0] = new CustomVertex.TransformedColored(random.Next(this.render.Width), random.Next(this.render.Height), 1, 1, Color.Cyan.ToArgb());
glowVertices[1] = new CustomVertex.TransformedColored(random.Next(this.render.Width), random.Next(this.render.Height), 1, 1, Color.Blue.ToArgb());
glowVertices[2] = new CustomVertex.TransformedColored(random.Next(this.render.Width), random.Next(this.render.Height), 1, 1, Color.Cyan.ToArgb());
glowVertices[3] = new CustomVertex.TransformedColored(random.Next(this.render.Width), random.Next(this.render.Height), 1, 1, Color.Blue.ToArgb());

this.device.BeginScene();
int passes = this.glowEffect.Begin(0);
for (int i = 0; i < passes; i++)
 {
     this.glowEffect.BeginPass(i);
     this.device.DrawUserPrimitives(PrimitiveType.LineStrip, glowVertices.Length - 1, glowVertices);
     this.glowEffect.EndPass();
 }
 this.glowEffect.End();
 this.device.EndScene();

I guess I’m not so much looking for help on a specific part of HLSL, given the number of questions and amount of code I would have to post I’m really just looking for some help finding resources!

  • 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-05-18T06:27:02+00:00Added an answer on May 18, 2026 at 6:27 am

    The immediate problem I see with your code is that you’re applying a shader to the lines themselves. Pixel shaders don’t really work that way. You can’t interact with any of the pixels around the pixel being shaded. All you get is registers (position, colour, texture coordinate, etc) and samplers (textures) for that one pixel that is being output.

    To work around this, the basic process of doing a blur effect (such as for glow or bloom) is to draw the scene you want to blur to a render target. Then use that render target as a texture on a full-screen quad that you draw with a blur shader. A simple blur shader takes takes multiple samples from that texture – each with a slightly offset texture coordinate. The result is a blurred image of the texture.

    Usually you repeat this process (now rendering the render-target-on-a-full-screen-quad to another render target), doing one blur horizontally and one vertically, to get the most blurring with the fewest number of samples.

    I recommend looking at the XNA Bloom Sample. There is more extensive documentation on the process in there. While the API is XNA, not DirectX, they are fairly similar and they both use HLSL.

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

Sidebar

Related Questions

I have been struggling for a few days trying to find out how come
I have been struggling for days trying to find the proper way to implement
I have been struggling for days trying to get a simple ActiveX DLL to
So I've been struggling with this for a couple days now. I have a
I have been struggling all afternoon trying to get a simple mailto: tag to
I have been struggling with this for days now. I am trying to register
I have been struggling with this question for several days. What is the age
I have been struggling with this for three days, I want to do a
I've been struggling with a problem that I have for days now and I
I have been struggling with that for 4 days now. I have a very

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.