Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
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), 636 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 1 of 6 1 2 3 4 5 6
Terrainmaking #98016
11/08/06 22:22
11/08/06 22:22
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Hello

Nagashi pointed to a nice little terrain tool in the "Tools" forum called Earthsculptor. This tool creates highmaps, shadowmaps and rgb-blendmaps. It's quite easy to port the terrains to 3dgs and get them working with a multi-texture-terain shader. I 've tweaked one of my old and wanted to share it

in Earthsculptor


in 3dgs


the shader:
Code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is a multitexture-terrainshader that makes it easy to implement terrains made
//with "EarthSculptor, http://www.earthsculptor.com/" into 3dgs. It's able to blend 4 textures and
//on top of that a shadowmap.
//
//When painting with textures in "earthscuptor" the rgb-blendmap is created as follows:
//(from left to right) texture in slot1 creates red in the rgb-blendmap, slot2 = green, slot3 = blue, slot4 = black.
//After you saved your terrain, you will find the highmap, the blendmap and the shadowmap in the "Maps" folder in the directory where "earthsculptor" is installed.
//
//After converting all needed maps and texture files into a MED compatible format (bmp,pcx,tga), import the highmap into MED
//(File/Import/Import Terrain from Pic)and create a highmap with size according to your needs (I usualy make it around 100x100 vertices),
//then you will have to rescale the terrain in height to fit it as close as possible to the original in "earthsculptor".
//Then assign the rgb-blendmap as first and the shadowmap as second skin to your terrain (Edit/Manage Skins).
//
//Add the terrain to your level (Objec/Add Terrain)
//Include the shader.wdl into your main wdl script and assign the action "multi_rgb" to your terrain. You
//might want to adjust the tiling size of the textures by changing the values in the shader...see:
//"Out.Tex3 = inTexCoord0.xy*30; // tiling texture red...".
//
//
//This terrainshader is a reworked version of Thorsten Kunze 's terrainshader.
//2006 By www.loopix-project.com
/////////////////////////////////////////////////////////////////////////////////////////////////////////////



// entSkin1 rgb-blendmap
// entSkin2 shadowmap

bmap tex3 = <rocks.bmp>; // Texture Layer Red
bmap tex4 = <grass.bmp>; // Texture Layer Green
bmap tex5 = <bark.bmp>; // Texture Layer Blue
bmap tex6 = <cliff.bmp>; // Texture Layer Black


function multirgb_roughness() {
bmap_to_mipmap(mtl.Skin1);
bmap_to_mipmap(mtl.Skin2);
bmap_to_mipmap(mtl.Skin3);
bmap_to_mipmap(mtl.Skin4);

}


material multirgb {
flags = tangent;
skin1 = tex3;
skin2 = tex4;
skin3 = tex5;
skin4 = tex6;

event=multirgb_roughness;

effect
"
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Define your needed values
float4x4 matWorldViewProj;
float4x4 matWorld;
float4x4 matWorldInv;
float4x4 matWorldView;

float4 vecFog;

// Define your textures
texture mtlSkin1;
texture mtlSkin2;
texture mtlSkin3;
texture mtlSkin4;
texture entSkin1;
texture entSkin2;

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Texture settings
sampler sTex1 = sampler_state
{
Texture = <entSkin1>; // rgb-blendmap
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
sampler sTex2 = sampler_state
{
Texture = <entSkin2>; // shadowmap
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};

sampler sTex3 = sampler_state
{
Texture = <mtlSkin1>; // red
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
sampler sTex4 = sampler_state
{
Texture = <mtlSkin2>; // green
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
sampler sTex5 = sampler_state
{
Texture = <mtlSkin3>; // blue
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
sampler sTex6 = sampler_state
{
Texture = <mtlSkin4>; // black
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};


struct TMULTI_VS_OUT // Output to the pixelshader fragment
{
float4 Pos : POSITION;
float Fog : FOG;
float2 Tex1 : TEXCOORD0;
float2 Tex2 : TEXCOORD1;
float2 Tex3 : TEXCOORD2;
float2 Tex4 : TEXCOORD3;
float2 Tex5 : TEXCOORD4;
float2 Tex6 : TEXCOORD5;

};


float DoFog(float4 Pos) {
float3 P = mul(Pos,matWorldView);// apply the linear fog formula
return saturate((vecFog.y-P.z) * vecFog.z);
}


TMULTI_VS_OUT TMulti_VS(
float4 inPos : POSITION,
float3 inNormal : NORMAL,
float2 inTexCoord0 : TEXCOORD0)
{

TMULTI_VS_OUT Out;

// transform the vector position to screen coordinates
Out.Pos = mul(inPos,matWorldViewProj);

// rotate and normalize the normal
float3 N = normalize(mul(inNormal,matWorldInv));

Out.Fog = DoFog(inPos);

// scale the texture coordinates for the masked textures
Out.Tex1 = inTexCoord0.xy; // rgb-blendmap (not tiled)
Out.Tex2 = inTexCoord0.xy; // shadowmap (not tiled)
Out.Tex3 = inTexCoord0.xy*30; // tiling texture red
Out.Tex4 = inTexCoord0.xy*10; // tiling texture green
Out.Tex5 = inTexCoord0.xy*10; // tiling texture blue
Out.Tex6 = inTexCoord0.xy*30; // tiling texture black
return Out;
}


//////////////////////////////////////////////////////////////////////////////////////////////////////
// pixelshader
float4 ps( TMULTI_VS_OUT In ) : COLOR
{
float4 BlendColor = tex2D(sTex1,In.Tex1);
float4 ShadowMap = tex2D(sTex2,In.Tex2);
float4 RedColor = tex2D(sTex3,In.Tex3);
float4 GreenColor = tex2D(sTex4,In.Tex4);
float4 BlueColor = tex2D(sTex5,In.Tex5);
float4 BlackColor = tex2D(sTex6,In.Tex6);




float4 BaseRed = lerp(BlackColor,RedColor,BlendColor.r);
float4 BaseGreen = lerp(BaseRed,GreenColor,BlendColor.g);
float4 FinalColor = lerp(BaseGreen,BlueColor,BlendColor.b);

FinalColor = FinalColor*ShadowMap; // maybe you will want to have it brighter ...*(ShadowMap+0.2)

FinalColor.a = 1.0f; // prevent transparency



return FinalColor;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
//
technique mytechnique
{
// Define your passes
pass p0
{
VertexShader = compile vs_2_0 TMulti_VS();
PixelShader = compile ps_2_0 ps();
}
}
";
}


ACTION multi_rgb {

my.material=multirgb;

}



Re: Terrainmaking [Re: Loopix] #98017
11/08/06 23:16
11/08/06 23:16
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Thank you, Loopix!
Contribution like this, give us the part of 'solid' process of game creation.
Specially for new members of 3dgs community; free tool and clear way to integrate it with 3dgs. Thanks.

Re: Terrainmaking [Re: Lion_Ts] #98018
11/09/06 00:38
11/09/06 00:38
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
This is exactly what I needed right now great contribution! Thanks


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Terrainmaking [Re: EpsiloN] #98019
11/09/06 09:12
11/09/06 09:12
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Thanks for the kind words! I'm happy if it's usefull

Re: Terrainmaking [Re: Loopix] #98020
11/09/06 09:30
11/09/06 09:30
Joined: Jul 2004
Posts: 785
Serbia
Iglarion Offline
User
Iglarion  Offline
User

Joined: Jul 2004
Posts: 785
Serbia
Shader code work really fine.
Thanks!


IGRAVISION Page - www.igravision.com
RPG project - The Battle For Forgol 92.75%
Re: Terrainmaking [Re: Iglarion] #98021
11/09/06 11:04
11/09/06 11:04
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Very cool Loopix, thanks!

Edit: A little question btw, which map is the actual blendmap? Is it a greyscale image?

Cheers

Last edited by PHeMoX; 11/09/06 11:31.

PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Terrainmaking [Re: Loopix] #98022
11/09/06 11:52
11/09/06 11:52
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
This is a quite helpfull tool you contributed Loopix
I'll try it out tonight
One request I have, could you make a complided version in WED with a terrain
(heightmap and textures included) in it and the shader attached to it, that way I think the users will get the right information about it and also to be sure that the user doesn't apply it the wrong way to avoid the frustrasion ^^

Cheers

Frazzle

Re: Terrainmaking [Re: frazzle] #98023
11/09/06 11:57
11/09/06 11:57
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
T
Tempelbauer Offline
Expert
Tempelbauer  Offline
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
wow, loopix
looks very good

iŽll test it soon

Re: Terrainmaking [Re: Tempelbauer] #98024
11/09/06 12:23
11/09/06 12:23
Joined: Oct 2004
Posts: 1,856
TheExpert Offline
Senior Developer
TheExpert  Offline
Senior Developer

Joined: Oct 2004
Posts: 1,856
Thanks a lot
that's a really great and real "contribution" for community.

i have asked for terrain editor for 3DS , some user is doing an outstanding tool
that will allow that ... nothing released or done

finally users will have at least your contribution for the moment.

Thanks again Loopix

Re: Terrainmaking [Re: TheExpert] #98025
11/09/06 16:28
11/09/06 16:28
Joined: Nov 2003
Posts: 170
Tachys Offline
Member
Tachys  Offline
Member

Joined: Nov 2003
Posts: 170
TheExpert:

With all due respect, the strength of this system has never been in the tools that come with it. You know this, we know this... cease kicking the bones of this long dead horse.

It has been, and will probably remain, 2 things:

First, the system's flexibility. Almost no matter what level of the app you buy, there is a way to get some or all of the extras included in the higher levels. Few and far between are the development suites where you can get so much for so little. If there is something you want out of the system, no one is stopping you from coding it and adding it in.

Second, are the plethora of users like Loopix, who are more than willing to share their work with the community, if not for free, then for a nominal fee.
With them on board, almost anything is within your reach.

Note the similarity in the ending statements above: YOU have to extend YOUR reach. I have seen nothing on these boards from you in recent times that shows that you are doing that, or helping others extend theirs.

Back on topic, Loopix, great work, and the contribution is awesome! I was loking into doing something like this for another project, so it was also very timely as well.

Thanks again!

Page 1 of 6 1 2 3 4 5 6

Moderated by  adoado, checkbutton, mk_1, Perro 

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