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 (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 622 guests, and 1 spider.
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
Blending textures #90446
09/17/06 10:33
09/17/06 10:33
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
I'm not sure if what I want is "Blending textures", but I need to use a texture to put over another texture so the black will make the texture look dark and white will not appear.

Re: Blending textures [Re: sheefo] #90447
09/18/06 10:00
09/18/06 10:00
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
OK, if it's easier, Black means invisible and White means darken the texture.

Re: Blending textures [Re: sheefo] #90448
09/19/06 16:43
09/19/06 16:43
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Bloody hell, I have to bump this topic up the ass and no one even replies.

Re: Blending textures [Re: sheefo] #90449
09/19/06 17:21
09/19/06 17:21
Joined: Sep 2002
Posts: 1,604
Deutschland
ChrisB Offline
Serious User
ChrisB  Offline
Serious User

Joined: Sep 2002
Posts: 1,604
Deutschland
Well because nobody really knows what you want.
If you have a hlsl shader were you want blend the textures:
outColor=texture.rgb*blend.rgb;


www.Swollen-Eyeballs.org
ICQ:169213431
#3dgs@quakenet
Re: Blending textures [Re: ChrisB] #90450
09/19/06 18:11
09/19/06 18:11
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
I need a certain colour to darken it and another to lighten it. Any ideas?

Re: Blending textures [Re: sheefo] #90451
09/19/06 18:25
09/19/06 18:25
Joined: Sep 2002
Posts: 1,604
Deutschland
ChrisB Offline
Serious User
ChrisB  Offline
Serious User

Joined: Sep 2002
Posts: 1,604
Deutschland
You wan't an shader or an ffe or a tutorial how to do it in photshop? For models or for blocks?
Code:

texture entSkin1;
texture mtlSkin1;

technique blendit
{
pass p0
{
Texture[0] =<entSkin1>;
Texture[1] = <mtlSkin1>;
ColorArg1[0] = Texture;
ColorArg2[0] = Diffuse;
ColorOp[0] = Modulate2x;
ColorArg1[1] = Texture;
ColorArg2[1] = Current;
ColorOp[1] = Modulate;
}
}




www.Swollen-Eyeballs.org
ICQ:169213431
#3dgs@quakenet
Re: Blending textures [Re: ChrisB] #90452
09/19/06 19:36
09/19/06 19:36
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
It's for models, and I need it in HLSL format.
But thanks, that code looks nice Can you convert it?

Re: Blending textures [Re: sheefo] #90453
09/19/06 20:06
09/19/06 20:06
Joined: Sep 2002
Posts: 1,604
Deutschland
ChrisB Offline
Serious User
ChrisB  Offline
Serious User

Joined: Sep 2002
Posts: 1,604
Deutschland
Code:
  
float4x4 matWorldViewProj;
texture entSkin1;
texture entSkin2;
sampler BlendSampler = sampler_state
{
Texture = <entSkin2>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
};

sampler ColorSampler =sampler_state
{
Texture=<entSkin1>;

MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
};

void VS(in float4 inPos:POSITION, in float2 inTex:TEXCOORD0, out float4 outPos:POSITION, out float2 outTex:TEXCOORD0)
{
outPos=mul(inPos,matWorldViewProj);
outTex=inTex;
}

float4 PS(float2 inTex:TEXCOORD0) :COLOR
{
float4 color=tex2D(ColorSampler,inTex);
float4 blend=tex2D(BlendSampler,inTex);
return color*blend;
}
technique blend
{
pass p0
{
VertexShader = compile vs_1_1 VS();
PixelShader = compile ps_1_4 PS();
}
}



didn't test it, so there should be many errors
skin2 is your texture that darken the first skin


i don't know why you don't wan't an ffe, doesn't makes sense for me


www.Swollen-Eyeballs.org
ICQ:169213431
#3dgs@quakenet
Re: Blending textures [Re: ChrisB] #90454
09/20/06 08:12
09/20/06 08:12
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
I needed to add it to my Multitexture terrain shader which is in HLSL format. I PMed you it, see if you can add it to it because I cant.

Re: Blending textures [Re: sheefo] #90455
09/20/06 16:09
09/20/06 16:09
Joined: Sep 2002
Posts: 1,604
Deutschland
ChrisB Offline
Serious User
ChrisB  Offline
Serious User

Joined: Sep 2002
Posts: 1,604
Deutschland
Ok, when you don't post what exactly you want nobody can help you.
so here is the code:
Code:
 
// Declare pre-defined matrices to be included
float4x4 matWorldViewProj;
float4x4 matWorldView;
float4x4 matWorldInv;
// Declare additional vectors for optional features
float4 vecSunDir;
float4 vecFog;

float4 vecSkill41;
// Declare the terrain's textures
texture entSkin1;
texture entSkin2;
texture entSkin3;
texture entSkin4;
texture mtlSkin1;
texture mtlSkin2;
//////////////////////////////
// Base-Texture (BLACK)
//////////////////////////////
sampler sTex1 = sampler_state
{
Texture = <entSkin1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
//////////////////////////////
// Red-Texture (RED)
//////////////////////////////
sampler sTex2 = sampler_state
{
Texture = <entSkin2>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
//////////////////////////////
// Blue-Texture (BLUE)
//////////////////////////////
sampler sTex3 = sampler_state
{
Texture = <entSkin3>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
//////////////////////////////
// Green-Texture (GREEN)
//////////////////////////////
sampler sTex4 = sampler_state
{
Texture = <entSkin4>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
//////////////////////////////
// Detail Map
//////////////////////////////
sampler sTex5 = sampler_state
{
Texture = <mtlSkin1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};
//////////////////////////////
// Shadow Map
//////////////////////////////
sampler sTex6 = sampler_state
{
Texture = <mtlSkin2>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};

////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////
//////////////////////////////
// Input
//////////////////////////////
struct VS_OUTPUT
{
float4 position : POSITION;
float4 sunlight : COLOR0;
float fog : FOG;
float2 Tex1 : TEXCOORD0;
float2 Tex2 : TEXCOORD1;
float2 Tex3 : TEXCOORD2;
float2 Tex4 : TEXCOORD3;
float2 Tex5 : TEXCOORD4;
};
//////////////////////////////
// Output
//////////////////////////////
VS_OUTPUT VS(float4 position : POSITION, float3 inNormal : NORMAL, float2 inTexCoord0 : TEXCOORD0)
{
VS_OUTPUT Out;
// Transform Vector Position to Screen Co-ordinates
Out.position = mul(position, matWorldViewProj);
// Calculate sunlighting
float3 sunlighting = normalize(mul(inNormal, matWorldInv));
Out.sunlight = dot(sunlighting, -vecSunDir);
// Calculate Fogging
float3 fogging = mul(position, matWorldView);
fogging = saturate((vecFog.y - fogging.z) * vecFog.z);
Out.fog = fogging;
// Scale Texture Co-ordinates
Out.Tex1 = inTexCoord0.xy * vecSkill41.x;
Out.Tex2 = inTexCoord0.xy * vecSkill41.x;
Out.Tex3 = inTexCoord0.xy * vecSkill41.x;
Out.Tex4 = inTexCoord0.xy * vecSkill41.x;
Out.Tex5 = inTexCoord0.xy;
return(Out);
}
////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////
//////////////////////////////
// Output
//////////////////////////////
float4 PS(VS_OUTPUT In) : COLOR
{
float4 BaseColour = tex2D(sTex1, In.Tex1);
float4 RedColour = tex2D(sTex2, In.Tex2);
float4 GreenColour = tex2D(sTex3, In.Tex3);
float4 BlueColour = tex2D(sTex4, In.Tex4);
float4 MaskColour = tex2D(sTex5, In.Tex5);
float4 ShadowColour = tex2D(sTex6, In.Tex5);

float4 BaseRed = lerp(BaseColour, RedColour, MaskColour.r);
float4 BaseGreen = lerp(BaseRed, GreenColour, MaskColour.g);
float4 FinalColour = lerp(BaseGreen, BlueColour, MaskColour.b);
FinalColour = (FinalColour + (FinalColour * In.sunlight)) / 2; // Brightness
FinalColour*=ShadowColour;

FinalColour.a = 1.0f; // prevent transparency
return(FinalColour);
}
////////////////////////////////////////////////////////////
// The 'terrainshader' initialization
////////////////////////////////////////////////////////////
technique terrainshader
{
pass p0
{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_2_0 PS();
}
}





www.Swollen-Eyeballs.org
ICQ:169213431
#3dgs@quakenet
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