Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Akow), 1,365 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Ooh my god! My modle's hair is gone! (alphamaping) #387165
11/15/11 09:33
11/15/11 09:33
Joined: Sep 2011
Posts: 9
H
hallohope Offline OP
Newbie
hallohope  Offline OP
Newbie
H

Joined: Sep 2011
Posts: 9
confused
hello Handsome guys, I have a propbem with alphamap in 3DGSA7.
I import a modle in Shader viewer demo of official. But the hair of the modle can't see ,Why we just see the sky? Is any way to Solve the problem?Here is the core of bump.fx .



#include <bump_vs>
#include <phong>

texture entSkin1; // texture
texture entSkin2; // normal map or lightmap
texture entSkin3; // normal map on blocks

sampler sBaseTex = sampler_state { Texture = <entSkin1>; MipFilter = Linear; };
sampler sSkin2 = sampler_state { Texture = <entSkin2>; MipFilter = None; };
sampler sSkin3 = sampler_state { Texture = <entSkin3>; MipFilter = None; };


float3 DoDiffuse(bumpOut In,float3 Normal)
{
float3 Diffuse = In.Diffuse1 * saturate(dot(normalize(In.Light1.xyz),Normal));
Diffuse += In.Diffuse2 * saturate(dot(normalize(In.Light2.xyz),Normal));
Diffuse += In.Diffuse3 * saturate(dot(normalize(In.Light3.xyz),Normal));
return Diffuse * vecDiffuse.xyz;
}

float4 diffuseBump_PS(bumpOut In): COLOR
{
float4 Base = tex2D(sBaseTex,In.Tex12.xy);
float3 Normalmap = tex2D(sSkin2,In.Tex12.xy)*2-1;
float3 Diffuse = DoDiffuse(In,Normalmap);
return Base * DoColor(Diffuse,In.Ambient);
}

float4 diffuseBumpLM_PS(bumpOut In): COLOR
{
float4 Base = tex2D(sBaseTex,In.Tex12.xy);
float4 Lightmap = tex2D(sSkin2,In.Tex12.zw);
float3 Normalmap = tex2D(sSkin3,In.Tex12.xy)*2-1;
float3 Diffuse = DoDiffuse(In,Normalmap);
return Base * DoLightmap(Diffuse,Lightmap,In.Ambient);
}

technique bump
{
pass one
{ ZWriteEnable = True;

VertexShader = compile vs_2_0 bump_VS();
PixelShader = compile ps_2_0 diffuseBump_PS();
}
}

technique bump_lm
{
pass one
{ ZWriteEnable = True;

VertexShader = compile vs_2_0 bump_VS();
PixelShader = compile ps_2_0 diffuseBumpLM_PS();
}
}

technique fallback { pass one { } }

Re: Ooh my god! My modle's hair is gone! (alphamaping) [Re: hallohope] #387188
11/15/11 14:49
11/15/11 14:49
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
"ZWriteEnable = True;" is the problem. Sort of. The transparent parts are writing to the z-buffer. Since the other parts have greater depth, they are not being rendered, so you see the sky instead.

Usually when one needs gradual alpha transparency, one has those parts in a separate model and shader without ZWriteEnable. This means you might get sorting errors, but at least they'll only be on the transparent model. Alternatively, if you just want to have some parts completely transparent and some completely opaque, you'd also have "AlphaTestEnable = True;" to allow rejection of pixels with low alpha, set "AlphaRef" to a value below which pixels will be rejected, have "AlphaTest = GREATER;" or "GREATEREQUAL" so that we keep pixels whose alpha is higher than AlphaRef, turn off alpha blending with "AlphaBlendEnable = False;" and keep "ZWriteEnable = True;"


Formerly known as JulzMighty.
I made KarBOOM!
Re: Ooh my god! My modle's hair is gone! (alphamaping) [Re: JibbSmart] #387191
11/15/11 15:14
11/15/11 15:14
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Isnīt that the main character of "Bulletstorm"?


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Ooh my god! My modle's hair is gone! (alphamaping) [Re: alibaba] #387243
11/16/11 05:31
11/16/11 05:31
Joined: Sep 2011
Posts: 9
H
hallohope Offline OP
Newbie
hallohope  Offline OP
Newbie
H

Joined: Sep 2011
Posts: 9
Is means like that?
technique bump
{
pass one
{
VertexShader = compile vs_2_0 bump_VS();
PixelShader = compile ps_2_0 diffuseBump_PS();
AlphaBlendEnable = false;

AlphaTestEnable = true;
AlphaFunc = Greater;
AlphaRef = 245;

ZEnable = true;
ZWriteEnable = true;

CullMode = None;

}
}

technique bump_lm
{
pass one
{
VertexShader = compile vs_2_0 bump_VS();
PixelShader = compile ps_2_0 diffuseBumpLM_PS();
AlphaBlendEnable = false;

AlphaTestEnable = true;
AlphaFunc = Greater;
AlphaRef = 245;

ZEnable = true;
ZWriteEnable = true;

CullMode = None;

}
}


Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1