2 registered members (SBGuy, AndrewAMD),
739
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Lightmap Shader
[Re: mk_1]
#84779
08/06/06 14:46
08/06/06 14:46
|
Joined: Mar 2003
Posts: 4,427 Japan
A.Russell
OP
Expert
|
OP
Expert
Joined: Mar 2003
Posts: 4,427
Japan
|
You can use the same UV map (if we are on the same page here), because I can do it in Lightwave. I also have GILE[s], which creates a separate UV map for the lighting information (often several models for the same map). Just the lights, this is probably what you mean by a "pre-lighting calculation" (with the same UV map as the texture) -actually, this is a bad example because I have mapped both the left and right side to the same part of the image, but you get the idea Lighting baked in. This is what the shader should achieve by mixing the lightng information(above) with the base texture.
Last edited by A.Russell; 08/06/06 14:49.
|
|
|
Re: Lightmap Shader
[Re: A.Russell]
#84782
08/09/06 09:35
08/09/06 09:35
|
Joined: Mar 2003
Posts: 4,427 Japan
A.Russell
OP
Expert
|
OP
Expert
Joined: Mar 2003
Posts: 4,427
Japan
|
Obviously no-one was interested, so I tried it myself. However, I don't know anything about shader programming, and this was a stab in the dark. Effectively, I have got the lightmap to show, but it is too strong. How do can I adjust this to dim the lighting down?: Code:
material lightmap {
effect " texture entSkin1; // model texture texture entSkin2; // light texture
technique test { pass p0 { Texture[0] = <entSkin1>; // block Texture[1] = <entSkin2>; // shadow
TexCoordIndex[0] = 1; // TexCoordIndex[1] = 1; //
pixelshader = asm { ps.1.0 tex t0 tex t1 add r0, t0, t1 };
} } "; }
I thought it might work with multiplication, but I couldn't get it to do anything.
Last edited by A.Russell; 08/09/06 09:38.
|
|
|
Re: Lightmap Shader
[Re: A.Russell]
#84783
08/09/06 11:05
08/09/06 11:05
|
Joined: Dec 2000
Posts: 4,608
mk_1
Expert
|
Expert
Joined: Dec 2000
Posts: 4,608
|
Quote:
add r0, t0, t1
This line just adds texture1 (shadowmap) to texture0 (diffuse map). What you need to do is to multiply with the shadowmap: Code:
mul r0, t0, t1;
Anyway wiki features a little pixelshader tutorial using assembler.
Your code is missing albedo and specular though. Maybe you should try hlsl
|
|
|
Re: Lightmap Shader
[Re: A.Russell]
#84785
08/09/06 13:47
08/09/06 13:47
|
Joined: Jan 2006
Posts: 1,829 Neustadt, Germany
TWO
Serious User
|
Serious User
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
|
This may work: Code:
material mtl_shadowmap { effect= " texture entSkin1; texture entSkin2;
technique one_pass_shadow { pass p0 { Texture[0]=<entSkin1>; Texture[1]=<entSkin2>; ColorArg1[0]=Texture; ColorOp[0]=Modulate2x; ColorArg2[0]=Diffuse; TexCoordIndex[0]=0; TextureTransformFlags[0]=Count2; TextureTransform[0]={1.0,0.0,0.0,0.0, // color map u scale 0.0,1.0,0.0,0.0, // color map v scale 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0};
ColorArg1[1]=Texture; ColorOp[1]=Modulate; ColorArg2[1]=Current; TexCoordIndex[1]=0; TextureTransformFlags[1]=Count2; TextureTransform[1]={1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0}; } } "; }
|
|
|
|