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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,395 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Terrain multi-texturing - just the lighting please #35344
10/26/04 02:12
10/26/04 02:12
Joined: Dec 2002
Posts: 293
Minnesota
Peter Churness Offline OP
Member
Peter Churness  Offline OP
Member

Joined: Dec 2002
Posts: 293
Minnesota
Anyone know how to just apply shadows to a terrain via shader code (using SunPos) while keeping your established terrain skin plus 2nd skin detail map (i.e. so that entSkin1 is not tilable, but just stretches over entire .hmp)???

Re: Terrain multi-texturing - just the lighting pl [Re: Peter Churness] #35345
10/26/04 16:18
10/26/04 16:18
Joined: May 2004
Posts: 36
L
lekboon Offline
Newbie
lekboon  Offline
Newbie
L

Joined: May 2004
Posts: 36
have you try the stencil shadows to make you shadow on terrains in your case?

Re: Terrain multi-texturing - just the lighting pl [Re: lekboon] #35346
10/26/04 23:55
10/26/04 23:55
Joined: Jun 2003
Posts: 1,017
Germany
T
Thomas_Nitschke Offline
Senior Developer
Thomas_Nitschke  Offline
Senior Developer
T

Joined: Jun 2003
Posts: 1,017
Germany
That would lead to hard performance impacts. I think what he meant was how to get the gouraud shading to work with the multitex-shader...

Last edited by The Matrix; 10/26/04 23:55.

Formerly known as The Matrix - ICQ 170408644 I've been here for much longer than most people think. So where's my "Expert" status?
Re: Terrain multi-texturing - just the lighting pl [Re: Thomas_Nitschke] #35347
10/27/04 01:31
10/27/04 01:31
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
I think you've got to add

ShadeMode = Shaded;

And add a stage with

ColorArg1[n] = Current;
ColorOp[n] = Modulate2x;
ColorArg2[n] = Diffuse;

if there aren't enough stages left in your pass, try to add another one.

joey.

Re: Terrain multi-texturing - just the lighting please [Re: Peter Churness] #35348
10/27/04 08:44
10/27/04 08:44
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Quote:

Anyone know how to just apply shadows to a terrain via shader code (using SunPos) while keeping your established terrain skin plus 2nd skin detail map (i.e. so that entSkin1 is not tilable, but just stretches over entire .hmp)???




I am not too clear on what you mean exactly... Are you just asking about getting diffuse lighting onto the big skin so that there is shading on the terrain based on your sun settings?? Or some diabolical plan for a shadowmap??

Re: Terrain multi-texturing - just the lighting pl [Re: Steempipe] #35349
10/27/04 08:53
10/27/04 08:53
Joined: Jul 2002
Posts: 2,813
U.S.
Nadester Offline

Expert
Nadester  Offline

Expert

Joined: Jul 2002
Posts: 2,813
U.S.
I am able to create a shadow map (without actually having a shadowmap, but generating it rather), but I didn't put the time into figuring out how to implement a detail map additionally. I'd have to add an additional pass, and then dest/src blending.

EDIT: Actually, just adding the standard material diffuse to a current terrain may work - if you don't add an actual effect="", the detail map should stick. If not, I'll write up a simple detailmap shader+diffuse... (If time allows me to of course).

Last edited by Nadester; 10/27/04 08:59.
Re: Terrain multi-texturing - just the lighting pl [Re: Nadester] #35350
10/27/04 14:11
10/27/04 14:11
Joined: Dec 2002
Posts: 293
Minnesota
Peter Churness Offline OP
Member
Peter Churness  Offline OP
Member

Joined: Dec 2002
Posts: 293
Minnesota
Sorry for the confusing post. It was due to the fact that I ... ur ... um ... well when it comes to shaders I don't know what I'm doing

I think I just got that mult-texture terrain shader from the wiki to do what I want it to (was that yours Steempipe?).

Not sure how I did it, because I don't understand how to designate how much to blend of one skin versus another via the alpha map. I just played around with the alpha channel a bit until I got something decent (if someone can explain how the alpha map effects the blend of two skins I'd appreciate it). The first skin is taken from my .hmp and is not scaled (entSkin1, skill41 and skill42 set to 1). The second skin is from a file but I tile it like my detail map (mtlSkin2, skill43 and skill44 set to 64. So my original skin is intact, there's something of a detail map and the shadows are being cast by the sun.

Here's a few pics. Any suggestions on how to improve on what I have here?

BEFORE:


AFTER


Code:
 function terrain_shader
{
my.skill41=float(1); // uv for my entSkin1 (i.e. no tiling)
my.skill42=float(1);
my.skill43=float(64); // uv for my "detail" map mtlSkin2
my.skill44=float(64);
my.flare=off;
my.transparent=off;
my.ambient = -30 ;
my.material=mat_terrain_multitexture;
}



Re: Terrain multi-texturing - just the lighting pl [Re: Peter Churness] #35351
10/27/04 14:22
10/27/04 14:22
Joined: Jul 2002
Posts: 2,813
U.S.
Nadester Offline

Expert
Nadester  Offline

Expert

Joined: Jul 2002
Posts: 2,813
U.S.
The way the shader/alpha maps work:

They take the first texture, and tile it on top of your entire terrain. Then they tile the 2nd texture over the first texture. Then, they take the alpha map, and stretch onto the entire terrain, so that it covers everything but does not tile. The alpha map then determines what parts of the second texture are transparent and what parts are not. White is solid, while black is completely see through. Any shades of gray inbetween are their appropriate transparency values - it is all linear. The 1st texture shows through the parts of the 2nd texture which are transparent from the alpha map.

Thus, if you made grass as your first texture, sand as your 2nd, and made an alpha map with a giant white dot in the middle, your terrain would show up as a large grassy terrain, with a sandy dot in the middle.

Of course, most shaders have even another texture layer, whichs acts like the 2nd layer, only its alpha map blends everything below it. (Thus both the 1st and 2nd texture). Make sense?

Such power allows you to add patches of other textures, very detailed paths, and so on. It is quite powerful.


--Eric
Re: Terrain multi-texturing - just the lighting pl [Re: Nadester] #35352
10/27/04 15:00
10/27/04 15:00
Joined: Dec 2002
Posts: 293
Minnesota
Peter Churness Offline OP
Member
Peter Churness  Offline OP
Member

Joined: Dec 2002
Posts: 293
Minnesota
Thanks!! Just what I needed.

Makes total sense now. Except the part about the second texture layer. What do you mean by "blends everything below it"?

Re: Terrain multi-texturing - just the lighting pl [Re: Peter Churness] #35353
10/27/04 16:04
10/27/04 16:04
Joined: Feb 2003
Posts: 2,826
Margaritaville (Redneck Rivier...
myrlyn68 Offline
Senior Expert
myrlyn68  Offline
Senior Expert

Joined: Feb 2003
Posts: 2,826
Margaritaville (Redneck Rivier...
Think of the way normal images are handled.

You have 3 (or 4) seperate channels in your image. Red, Green, Blue and sometimes Alpha. In order to create a specific image each channel is filled in Grey scale with black being the completely without any of that color and white being completely whatever color the channel represents. By blending these various channels you create the actual image that you see on your computer.

When you apply this to shaders - each channel represents not a color...but a seperate picture. By using a base image (your large terrain skin) you are able to make much more complicated skins. You can specify the Red (R channel) to be a stone texture, the Green (G channel) to be a grass texture and the Blue (B channel) to be a water texture. By doing as much and mixing the channels using the various shades of grey in each channel through a shader you are able to display grass or moss covered stone or swampy grass. You can also have areas that are completely grass, water or stone.

It really all depends on the shader used (you can right a shader to have different results when overlaying textures in this manner similiar to the various options in Photoshop like color dodge overlay, hard light overlay or other effects). In this case, the shader acts more like adjusting the transparency of the layers and simply adds the pixels together based on the value of their assigned channel.


Virtual Worlds - Rebuilding the Universe one Pixel at a Time. Take a look - daily news and weekly content updates.
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