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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:57:34+00:00 2026-06-07T03:57:34+00:00

I am currently learning the language HLSL for effect files to my XNA game.

  • 0

I am currently learning the language “HLSL” for effect files to my XNA game. However; I have ran into the issue of applying the effects to my SpriteBatch.

My effect file looks like this, and makes the rendered texture, white. :]

float4 PSFunction(float2 coord : TEXCOORD0) : COLOR0
{
    return float4(0, 0, 0, 1); // Return a white pixel
}

technique Sample
{
    pass pass0
    {
        PixelShader = compile ps_2_0 PSFunction();
    }
}

It is working as it should, when I begin my SpriteBatch with following arguments:

SpriteBatch.Begin(0, null, null, null, null, SampleEffect);

However; the SpriteBatch.Begin method does not accept multiple effects. Therefore I tried to do

SampleEffect.CurrentTechnique.Passes[0].Apply();

before calling

SpriteBatch.Begin();

But nothing happend, therefore I tried couple of diffrend methods. Such as

SampleEffect.CurrentTechnique.Passes["pass0"].Apply();

But it still did not work.
So I verified the effect was attached to the correct GraphicsDevice using the object.ReferenceEquals function, but it was equaled to the correct graphicsDevice.
What am I doing wrong? How would I attach multiple effects to my SpriteBatch?

Thanks in Advance, Rasmus :]

  • 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-07T03:57:35+00:00Added an answer on June 7, 2026 at 3:57 am

    You can’t draw with multiple effect passes simultaneously. Instead, you need to draw the same thing multiple times, combining the results together.

    As an example of this, imagine simulating lighting with 3 effects: ambient light, diffuse light, and specular light. Each of these would be represented by an effect pass. You would render them in order, additively combining the results together (just like light adds together).

    If you want to combine several effects, you need to manually specify how they are to combine. You would usually do this by looping through the effect passes you want to use, and applying them one at a time, drawing your scene at each iteration.

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

Sidebar

Related Questions

I'm currently learning the fascinating J programming language, but one thing I have not
I am currently learning Assembly language on Linux. I have been using the book
im currently learning python (in the very begining), so I still have some doubts
im currently learning stacks in java and have a quick question. what will the
I'm currently learning how eclipse plugins work. I want to get a table into
I am currently learning C Programming ( my first programming language ). I am
Hello everyone I'm currently implementing a simple programming language for learning experience but I'm
I'm currently learning the C programming language (coming from Java) and I'm a bit
I'm a computer science student. Currently we are learning the Ada programming language. The
I am currently learning c++.My first language was python.I am used to coding in

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.