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

  • Home
  • SEARCH
  • 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 4256866
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:24:48+00:00 2026-05-21T05:24:48+00:00

My overall goal is to be able to create a pixel shader that takes

  • 0

My overall goal is to be able to create a pixel shader that takes multiple textures as input, and renders to multiple targets.
As well as via an initialise and finalise shader, through repeated runs of this shader i will get my result.

I’ve created shaders with multiple input textures before, and shaders that render to multiple targets, but i’ve never combined the 2.

What i belive is causing issues is my lack of full understanding of semantics, and how to properly set up input and output textures.

I’ve seen several different ways of getting input textures and am getting confused as to how it should be set up.

Below is the code for a shared struct that is output by the init and itterate shaders (the finalise shader simply outputs a colour):

struct FRACTAL_OUTPUT
{
    float4 IterationsAndControl : COLOR0;
    float4 Variables1And2 : COLOR1;
    float4 Variables3And4 : COLOR2;
};

Below is the texture declarations for the itterate and finalise shaders (the init shader doesn’t use any textures):

Texture2D IterationsAndControl;
sampler IterationsAndControlSampler : register(s4)
{
    Texture = <IterationsAndControl>;
};

Texture2D Variables1And2; sampler Variables1And2Sampler : register(s5) { Texture = <IterationsAndControl>; };

Texture2D Variables3And4; sampler Variables3And4Sampler : register(s6) { Texture = <IterationsAndControl>; };

In c# XNA code, i set the render targets (by doing GraphicsDevice.SetRenderTargets() then set the texture parameters (by doing Effect.Parameter[“TextureVariableName”].SetValue(), then draw a quad (via a sprite batch).

Any help would be much appreciated, as i can’t find any examples of doing something like this.

  • 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-21T05:24:48+00:00Added an answer on May 21, 2026 at 5:24 am

    For anyone else who’s interested, i’ve managed (through a lot of trial and error!) to get this working.

    Since i’m doing number crunching i set my render targets format to Vector4 (i previously had rgba64 which didn’t seem to work).
    Because i’m now using a vector format i also had to change the device samplers to be SamplerState.Point:

    GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
    GraphicsDevice.SamplerStates[1] = SamplerState.PointClamp;
    GraphicsDevice.SamplerStates[2] = SamplerState.PointClamp;
    GraphicsDevice.SamplerStates[3] = SamplerState.PointClamp;
    

    My FRACTAL_OUTPUT struct hasn’t changed.

    What has changed is the samplers. I’m using the macro defined in the XNA effect samplers:

    #define DECLARE_TEXTURE(Name, index) \
    Texture2D<float4> Name : register(t##index); \
    sampler Name##Sampler : register(s##index);
    

    Then, to sample multiple textures i’m doing the following:

    DECLARE_TEXTURE(IterationsAndControl, 1);
    ....
    return tex2D(IterationsAndControlSampler, texCoord).x;
    

    Then in c# I set the render targets in the usual way, setting my input textures as i’d set any other effect parameter.

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

Sidebar

Related Questions

My overall goal is isolate tags that contain a certain word in the text
Overall goal of my project is to connect to a Oracle database that is
The overall goal I'm trying to accomplish is to implement a customizable avatar system
Are there overall rules/guidelines for what makes a method thread-safe? I understand that there
I'm going to assume that the overall structure of my code as it currently
I'm making a program with the Pygame that changes the overall colours of inserted
I built my first site with jQuery and overall it turned out quite well
The overall goal: Copy the permissions of files from the local filesystem when uploading
My overall goal is to let users of my Rails app authenticate against our
I'll first explain my overall goal and then the question itself. Overall Goal: To

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.