⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imgremap3d.fx

📁 java实现的简单的分形树。简单易学!是学习分形知识的很好的例子。其java语法简单
💻 FX
字号:

// Generic image space color remapper.
//
// Remaps colors via dependant read into volume texture.
// Does point sampling on volume texture for this demo purposes :)

#include "_shared.fx"

texture		tBase;
texture		tRemap;

// --------------------------------------------------------------------------
//  samplers 

sampler smpBase = sampler_state {
    Texture   = (tBase);
    MipFilter = None; MinFilter = Point; MagFilter = Point;
    AddressU = Clamp; AddressV = Clamp;
};
sampler smpRemap = sampler_state {
    Texture   = (tRemap);
    MipFilter = None; MinFilter = Point; MagFilter = Point;
    AddressU = Clamp; AddressV = Clamp; AddressW = Clamp;
};


// --------------------------------------------------------------------------
//  vertex shader

struct VS_OUTPUT {
	float4 pos	: POSITION;
	float2 uv	: TEXCOORD0;
};

VS_OUTPUT vsMain (
	float4	pos : POSITION,
	float2  uv : TEXCOORD0 )
{
    VS_OUTPUT o;
	// fullscreen quad
	o.pos = pos * float4(-2,2,1,1) - vQuadOffset;
	o.uv = uv;
	return o;
}


// --------------------------------------------------------------------------
//  pixel shader

struct PS_INPUT {
	float2 uv : TEXCOORD0;
};

float4 psMain( PS_INPUT i ) : COLOR
{
	float4 color = tex2D( smpBase, i.uv );
	float4 remap = tex3D( smpRemap, color.xyz );
	return remap;
}

// --------------------------------------------------------------------------
//  effect

technique tec0
{
	pass P0 {
		VertexShader = compile vs_1_1 vsMain();
		//Fvf = Xyz | Normal | Tex1;
		PixelShader = compile ps_1_4 psMain();

		ZEnable = False;
		ZWriteEnable = False;

		//CullMode = None;
	}
	pass PLast {
		ZEnable = True;
		ZWriteEnable = True;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -