グニャグニャをもっと綺麗にしてみようとしてみた

アバター
てんむすキツネ
記事: 88
登録日時: 14年前
住所: 岡山

グニャグニャをもっと綺麗にしてみようとしてみた

投稿記事 by てんむすキツネ » 13年前

中心点をxだけでなく、yも変えるようにした。
他にも色々微調整してみた。

[youtube][/youtube]

まだ、試行錯誤中だからぐちゃぐちゃしてます。

CODE:

float4 temp;
float4 col;

struct PS_INPUT{
	float4 Diffuse:COLOR0;
	float4 Specular:COLOR1;
	float2 TexCoords0:TEXCOORD0;
};

struct PS_OUTPUT{
	float4 Output:COLOR0;
};

sampler sampler0:register(s0);

PS_OUTPUT main(PS_INPUT psin){
	PS_OUTPUT psout;
	float2 tempcoord;
	float4 texc;

	float pura;

	pura=sin((temp.z*10+(psin.TexCoords0.y*5+psin.TexCoords0.x*10)*250)*3.1415926535898/180)/90;

	float dx=psin.TexCoords0.x-(pura+temp.x);

	float dy=psin.TexCoords0.y-(pura+temp.y);
	float dist=sqrt(dx*dx+dy*dy);

	if(dist<temp.w){

		float epspura;

		epspura=sin(temp.z*3.1415926535898/360)*0.3+0.5;
		
		float eps=epspura*(1-dist/temp.w);

		tempcoord.x=((psin.TexCoords0.x-temp.x/2)-temp.w/2)*(1-eps)+temp.w/2+temp.x/2;
		tempcoord.y=((psin.TexCoords0.y-temp.y/2)-temp.w/2)*(1-eps)+temp.w/2+temp.y/2;

		texc=tex2D(sampler0,tempcoord);


		psout.Output.r=texc.r+(temp.w-dist)*col.x;
		psout.Output.g=texc.g+(temp.w-dist)*col.y;
		psout.Output.b=texc.b+(temp.w-dist)*col.w;
		psout.Output.a=col.z;

	}
	else psout.Output=tex2D(sampler0,psin.TexCoords0);

	return psout;

}
最後に編集したユーザー てんむすキツネ on 2012年6月14日(木) 20:10 [ 編集 1 回目 ]

コメントはまだありません。