Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
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
3 registered members (TedMar, AndrewAMD, fairtrader), 578 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
Page 1 of 2 1 2
BumpMap #138756
06/29/07 09:05
06/29/07 09:05
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
Hello there,

i really did not get a working BumpMap Shader for 3DGS yet.

can anyone give me the code / give me a sample how to use that please ?


also is it possible to use a model without textures in 3dGS ? will it be visible correctly.. ? i mean.. only solid colored object, without using textures.. (i need to change the object color from code.)

[ sorry if its already asked manytimes ]

Thanks.

Last edited by ACKNEX007; 06/29/07 09:14.
Re: BumpMap [Re: ACKNEX007] #138757
06/29/07 15:19
06/29/07 15:19
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
colored objects can be rendered by a simple ffp effect. set TextureFactor to your needed color and as ColorArg use TFactor. you can then multiply or multiply 2x with diffuse to preserve correct shading.

Re: BumpMap [Re: Joey] #138758
06/29/07 16:01
06/29/07 16:01
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
about model without texture
yes... just attach skin with only material setup checked in skin settings

about bump_map
all you need is first skin with color texture and second one with normal_map texture.

in model function:
my.material = mat_bumpmap;

cheers


Code:
 
material mat_bumpmap
{
flags=tangent;

effect="

matrix matWorldViewProj;
matrix matWorld;

texture entSkin1; //Colormap
texture entSkin2; //Normalmap

vector vecLight;
vector vecFog;
vector vecSunDir;

technique dot3mapping
{
pass p0
{

AlphaBlendEnable = False;
AlphaTestEnable = False;
Lighting = True;
DitherEnable = True;

Texture[0] = <entSkin2>;
Texture[1] = <entSkin1>;

ColorOp[0] = Dotproduct3;
ColorArg1[0] = Texture;
ColorArg2[0] = Diffuse;

ColorOp[1] = Modulate;
ColorArg1[1] = Texture;
ColorArg2[1] = Current;

VertexShaderConstant[0]=<matWorldViewProj>;
VertexShaderConstant[4]=<matWorld>;

vertexShaderConstant[9]= <vecFog>;
vertexShaderConstant[10]=<vecSunDir>;
vertexShaderConstant[11]=<vecLight>;
VertexShaderConstant[12]={0.5f, 0.5f, 0.0f, 0.0f}; //0.5 0.5 0.0 0.0

VertexShader =
asm
{

vs_1_1

// Declarations
dcl_position v0
dcl_normal v3
dcl_texcoord0 v7
dcl_texcoord1 v8

// Transform position to clip space
m4x4 oPos, v0, c0

// Tranform normal and tangent to world space
m3x3 r3, v8, c4
m3x3 r5, v3, c4

// Compute binormal
mul r0, r3.zxy, r5.yzx
mad r4, r3.yzx, r5.zxy, -r0

// Transform (Sun)light vector to tangent space
dp3 r0.x, r3.xyz, -c10
dp3 r0.y, r4.xyz, -c10
dp3 r0.z, r5.xyz, -c10

// Normalize transformed light vector
dp3 r0.w, r0, r0
rsq r0.w, r0.w
mul r0, r0, r0.w

// Put light vector in range from 0 to 1
mad r0, r0, c12.x, c12.x
// Adjust the intensity
mul r0, r0, c12.y
// Add environment light then send it down the diffuse pipe
add oD0.xyz,r0,c11

// Fog calculations
mov r1.w,c9.w
dp4 r0,v0,c6 // distance to camera position
add r0,r0,-c9.x // distance-fog_start
mad r0.x,-r0.x,c9.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog,r0.x,c12.w // clamp with custom max value

// Pass the texture coordinates through
mov oT0, v7
mov oT1, v7
};
}
}
";
}



Last edited by tompo; 06/29/07 16:07.
Re: BumpMap [Re: tompo] #138759
06/29/07 17:57
06/29/07 17:57
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
Hi Joey,tompo


the problem was : all you need is first skin with color texture and second one with normal_map texture.
i did not added second texture in MED.


Thank You.

i got it.

Re: BumpMap [Re: ACKNEX007] #138760
06/29/07 23:39
06/29/07 23:39
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
i tested the code & it works fine..

if you dont mind.. is there any way to enable the effect of lights in bump mapped models ?

thanks..

Re: BumpMap [Re: ACKNEX007] #138761
06/30/07 07:03
06/30/07 07:03
Joined: Apr 2007
Posts: 582
Germany
Poison Offline
User
Poison  Offline
User

Joined: Apr 2007
Posts: 582
Germany
ACKNEX007 yes it is enabled


Everything is possible, just Do it!
Re: BumpMap [Re: Poison] #138762
06/30/07 08:30
06/30/07 08:30
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
i added few lights with colors and Dynamic flag set ON.

i tried to make a entity as light also.. (with the below action applied.)

action light1
{
my.red = 0;
my.green = 250;
my.blue = 0;
my.light = on;
my.lightrange = 200;

}


..
also in the effect file..
......
AlphaBlendEnable = False;
AlphaTestEnable = False;
Lighting = True; << its TRUE
DitherEnable = True;

..........

but its not showing the light colors in BumpMap shader..




what i was did wrong ?

Thank You.

Last edited by ACKNEX007; 06/30/07 08:36.
Re: BumpMap [Re: ACKNEX007] #138763
06/30/07 08:36
06/30/07 08:36
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
about above
try not write my.red...etc
but before effect" in material function add diffuse_blue, ambient_blue... etc

or use guitar's nm shader. The best one
You will have bump_map with light reflections... etc



Last edited by tompo; 06/30/07 08:38.

Never say never.
Re: BumpMap [Re: tompo] #138764
06/30/07 08:37
06/30/07 08:37
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
OK ;-)

Thanks.

Re: BumpMap [Re: ACKNEX007] #138765
06/30/07 09:03
06/30/07 09:03
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
Will any format of .FX file support with 3D Game Studio ?

Page 1 of 2 1 2

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