imgremap3d.fx
来自「java实现的简单的分形树。简单易学!是学习分形知识的很好的例子。其java语法」· FX 代码 · 共 81 行
FX
81 行
// 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 + =
减小字号Ctrl + -
显示快捷键?