Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (3run, AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip), 605 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
limit specular effect #53054
08/22/05 18:10
08/22/05 18:10
Joined: Feb 2003
Posts: 195
slacker Offline OP
Member
slacker  Offline OP
Member

Joined: Feb 2003
Posts: 195
RE normalmap_level_ps20.fx from the shader collection.

I changed two lines in normalmap_level_ps20.fx:

Basically I changed mtlSkin1 to entSKin2 - to make it work with models (putting the normal map in skin 2)

It works fine - but I am now trying to limit the specular effect by using an alpha channel. If I put an alpha channel in either the color or normal map skin - the model looks partially transparent - but in a messed up kind of way - like some normals or flipped? When I put an alpha in the normal map - it appears to limit the specular effect - but it is hard to tell because of the transparency.

I have found posts relating to this, but not for HLSL?

Last edited by slacker; 08/22/05 19:34.
Re: limit specular effect [Re: slacker] #53055
08/22/05 18:19
08/22/05 18:19
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline
Expert
XNASorcerer  Offline
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
Is this what you are trying to do? I am using an alpha channel to limite the effect to a a few areas of the car.


The only thing that I need is to fix the cubeenvmapping effect, because before I could see the car texture and it was like this:


Last edited by Sorcerer; 08/22/05 18:25.
Re: limit specular effect [Re: XNASorcerer] #53056
08/22/05 19:50
08/22/05 19:50
Joined: Feb 2003
Posts: 195
slacker Offline OP
Member
slacker  Offline OP
Member

Joined: Feb 2003
Posts: 195
That is the basic idea - but for specularity and in an hlsl shader. I have been reading up on the hlsl language - I am not new to programming, I can find my way around a C program, can pretty much figure out coniscript - but this shader stuff leaves me in the dust- I keep hoping to make a breakthrough - I understand the basics - vertex shader passes to pixel shader which outputs color. But after that...

btw - can't you just make your alpha shades of grey to limit the env effect and see more of the base color - are you just using white and black?

Last edited by slacker; 08/22/05 20:00.
Re: limit specular effect [Re: slacker] #53057
08/22/05 20:40
08/22/05 20:40
Joined: Aug 2005
Posts: 512
Bayern
Schmerzmittel Offline
User
Schmerzmittel  Offline
User

Joined: Aug 2005
Posts: 512
Bayern
Hi you mean an effect like this?




Here is a Envmap.wdl. This one can handle the alpha channel. Then it must work.

material mtl_envmap
{
skin1=bcube;
event=mtl_envmap_init;

effect=
"
texture entSkin1;
texture mtlSkin1;
matrix matMtl;
technique envmap
{
pass p0
{
texture[0]=<entSkin1>;
texture[1]=<mtlSkin1>;

zWriteEnable=true;
alphaBlendEnable=false;

colorArg1[0]=Texture;
colorOp[0]=Modulate2x;
colorArg2[0]=Diffuse;

colorArg1[1]=Texture;
colorOp[1]=blendCurrentAlpha;
addressU[1]=Clamp;
addressV[1]=Clamp;
texCoordIndex[1]=cameraSpaceReflectionVector;
textureTransformFlags[1]=Count3;
textureTransform[1]=<matMtl>; // transform camera space back to world space
}
}
";
}


A7 Com V7.80
Re: limit specular effect [Re: slacker] #53058
08/22/05 20:46
08/22/05 20:46
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline
Expert
XNASorcerer  Offline
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
That would work probably. And yes, I am using just white and black.

Re: limit specular effect [Re: XNASorcerer] #53059
08/23/05 02:52
08/23/05 02:52
Joined: Feb 2003
Posts: 195
slacker Offline OP
Member
slacker  Offline OP
Member

Joined: Feb 2003
Posts: 195
Yay - sorted it.

I added a third skin and use it to control the gloss variable. Before it seemed to use some aspect of the normal map. (it can be a small map)

spec_bump_model_20.fx

Varying specularity can have a dramatic impact on the realism of a scene. Right now I need it so that my characters suit is highly specular, but the skin tones are not.

Thanks to Matt_Coles for the original code. I just bought a book on writing shaders - it is absolutely fascinating what they are doing in real time.

Re: limit specular effect [Re: slacker] #53060
08/23/05 09:44
08/23/05 09:44
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
the best solution is to simply put the gloss map in the alpha channel of your color texture, and then just multiply the specular value by the alpha channel .. and then set the final color alpha to 1.0f

Re: limit specular effect [Re: Matt_Aufderheide] #53061
08/23/05 18:55
08/23/05 18:55
Joined: Feb 2003
Posts: 195
slacker Offline OP
Member
slacker  Offline OP
Member

Joined: Feb 2003
Posts: 195
thx!

I gave that a try, but don't exactly know how to set the alpha to 1. What if you want to use the alpha of the model for transparency, you could use the alpha of the normal map, eh?

My spec mask is much smaller than my color and normal map, does this save on memory as opposed to putting it in the alpha channel - I guess probably not as the alpha is only 8-bit.

Transparency seems to mess things up - I know of the plant 2-sided texture, and am trying to implement that in this shader. Any help on this?



Re: limit specular effect [Re: slacker] #53062
08/23/05 19:18
08/23/05 19:18
Joined: Feb 2003
Posts: 195
slacker Offline OP
Member
slacker  Offline OP
Member

Joined: Feb 2003
Posts: 195
I think I may have answered my own question here. I added from the wiki plant shader:
alphablendenable=false;
srcblend=zero;
added ->ZwriteEnable=True;
added ->alphaTestEnable=true;
added ->cullMode=none;

in each pass and it seems to work. I have not tried doing this with the spec mask though.. And have NO idea if this is right or whether it will implode anybody's machine.


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