Sign in to follow this  

[Resolved][MDX]Question about procedural HLSL textures

This topic is 4306 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
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

This topic is 4306 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this