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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:44:33+00:00 2026-06-11T16:44:33+00:00

For my project I’m using directx 9 C++. I’m using pixel shader in order

  • 0

For my project I’m using directx 9 C++.
I’m using pixel shader in order to disply a large picture using couple texture in the method of index image (color image).

In order to save texture space, I’d like to store the image’s pixes using look up table entries, in order to use the look up tables values as the image pixel values at the pixel shader phase.

I’m using 2 textures , first texture is the image texture, size of 2048^2.
The variety of pixesl is 128 pixesl , second texture is the LUT (Look up table) size of 128*1.

I’m using the second texture as an index image (Look up table),

somehow, i find it difficult to sample the value from the first texture (image texture ) –> A[i,j]
and sample the second texture at the same spot –> Pixel value = LUT[A[i,j]]

Then, output the pixel value to the screen.

Here is my pixel shader code:

sampler2D layoutSample : register (s0)
sampler2D LUTSampler   : register (s1)

 struct PS_INPUT
 { 
       float2 texture : TEXCOORD0;
       float2 LUT_Texture: TEXCOORD1;
   } 
 struct PS_OUTPUT
   {
         float4 color : COLOR0; 
   }

   PS_OUTPUT ps_main ( in PS_INPUT input )
    {
           PS_OUTPUT out; 
            ///  Sample the first texture - the image texture 
           float4 color = tex2D(layoutSampler, input.Texture); 

           float2 locationInLUT = float2(color.a , 0.0) ; 
           // I WOULD LIKE TO USE: But it's seems like a sampler is neccery for tex2D command 
           ///float4 realColor = tex2D(locationInLUT , input.LUT_Texture); 

           float4 realColor = tex2D(LUTSamplerm , input.LUT_Texture); 

           Out.color = float4(realColor.r, realColor.b, realColor.g, 1.0);

           return Out;
    }
  • 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-11T16:44:35+00:00Added an answer on June 11, 2026 at 4:44 pm

    Try

    float4 realColor = tex2D(LUTSampler, locationInLUT);
    

    Next time, use FXC compiler and look at error output.

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

Sidebar

Related Questions

This project is in Obj-C for iphone. I'm using the double float version of
project: Using VB.NET to build a winforms database interface and work-automation app. I am
project: Using VB.NET to build a winforms database interface and work-automation app. I am
Our project is to profile the various Vertex and Pixel, Geometry shaders used within
My project is currently using a svn repository which gains several hundred new revisions
Project with ARC. Dealloc method is called immediately after the call popViewControllerAnimated viewDidUnload method
Project explained below is created and built using Eclipse Juno(4.2). We receive the following
My project is using Guice as the IOC container responsible for providing dependencies (service
Project: http://design.vitalbmx.com/fave/news.html When I click Add to favorites button (under main pic), in Chrome
Project layout: /project_a /shared /project_b /shared /shared project_a and project_b both need to contain

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.