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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,534 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Question/Help needed on Multi Texture Shader #57215
10/07/05 13:27
10/07/05 13:27
Joined: Oct 2004
Posts: 150
Germany
T
tkunze Offline OP
Member
tkunze  Offline OP
Member
T

Joined: Oct 2004
Posts: 150
Germany
I try to use the RGB Shader from Steempipe i found in the Forum. Anything works fine but there was no possibility to add a detailmap because of the limitated number of textures.
I tried to change the script by using the first texture as a combination of Mask and Texture shown on the screen. I added to the Terrain Texture red and green areas where i blend the grass and road texture over which frees me one slot for the detail map. It works in general but unfortunately on the edges i still have red and green color.

The question is it possible to work in the way described? And if so can someone help me getting the code running.

Unfortunetaly i do not have any experience on Shaders so far and it is much more complex than expected. So any help would be appreciated.

Result with Red and Green Color on the edges instead of the texture


Maskimage



Source:

sampler sMaskTex = sampler_state
{
Texture = <entSkin1>; // Image with Red/Green areas where i'd like to blend the grass and road texture
MipFilter = LINEAR; // Anything else should be shown unchanged
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Wrap;
Addressv = Wrap;
};

sampler sBaseTex = sampler_state
{
Texture = <mtlSkin1>; // Detail Map Image
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Wrap;
Addressv = Wrap;
};

sampler sRedTex = sampler_state
{
Texture = <entSkin2>; // Grass Texture
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Wrap;
Addressv = Wrap;
};

sampler sGreenTex = sampler_state
{
Texture = <entSkin3>; // Road Texture
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Wrap;
Addressv = Wrap;
};


float4 TMulti_PS_13(TMULTI_VS_OUT In): COLOR
{
// retrieve the pixels for the textures and the masks
float4 MaskColor = tex2D(sMaskTex,In.MaskCoord);
float4 RedColor = tex2D(sRedTex,In.RedCoord);
float4 GreenColor = tex2D(sGreenTex,In.GreenCoord);
float4 DetailColor = tex2D(sBaseTex,In.BaseCoord);

float4 BaseColor;
BaseColor=MaskColor;

float4 BaseRed = lerp(MaskColor,RedColor,BaseColor.r);
BaseColor=MaskColor;
float4 Fcolor = lerp(BaseRed,GreenColor,BaseColor.g);
float4 FinalColor;
FinalColor =Fcolor + DetailColor - 0.5;


FinalColor.a = 1.0f; // prevent transparency
return FinalColor;
}

Re: Question/Help needed on Multi Texture Shader [Re: tkunze] #57216
10/07/05 18:58
10/07/05 18:58
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
I suggest you go back to the orginal method, and store the greyscale detail maps in the alpha channel of your 32 bit tga files. This way you could even have up to 3 detail maps, one for each texture blended on the terrain...this basically gives you three textures for the price of none, as you have already done the float4 reads

you access the alpha channel in the shader like this:
FinalColor.rgb*=RedColor.a


Sphere Engine--the premier A6 graphics plugin.
Re: Question/Help needed on Multi Texture Shader [Re: Matt_Aufderheide] #57217
10/08/05 12:27
10/08/05 12:27
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
For some reason I am not following exactly what you want to do, and how you would like to incorporate various textures.

How many regular textures tiled and blended?
How many detailmaps blended, and what coverage?
Are you using a large single colormap?


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