Jump to content
  • Advertisement
Sign in to follow this  
CadeF

[Resolved][MDX]Question about procedural HLSL textures

This topic is 4520 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Lets say I have the following code in my .fx shader
texture permTexture
<
    string texturetype = "2D";
    string format = "l8";
	string function = "GeneratePermTexture";
	int width = 256, height = 1;
>;
float4 GeneratePermTexture(float p : POSITION) : COLOR
{
	return permutation[p*256] / 255.0f;
}


In FX composer, permTexture is created from the function GeneratePermTexture. How would I do that, in my MDX app? Thanks [Edited by - CadeF on March 6, 2006 2:22:05 AM]

Share this post


Link to post
Share on other sites
Advertisement
Well you could do this simply in a fragment shader just drop in the code you have there (though you'll need to drop the POSITION and COLOR semantics) as a function and then call it passing in an appropiate position and use the colour returned.

Share this post


Link to post
Share on other sites
Well it'll look something like this:


float4 frag_main(FRAG_IN i) : COLOR
{
float4 texColor = GeneratePermTexture(i.texPos);
//use texColor here
}



Where i.texPos comes from depends upon what's actually passed as the position in FX Composer when generating that texture.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Isnt there some effect function to return a function given an input value?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!