2 registered members (AndrewAMD, 1 invisible),
1,395
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Thomas_Nitschke
Senior Developer
|
Senior Developer
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 please
[Re: Peter Churness]
#35348
10/27/04 08:44
10/27/04 08:44
|
Joined: Dec 2003
Posts: 1,097 Maryland, USA
Steempipe
Serious User
|
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: Nadester]
#35350
10/27/04 14:11
10/27/04 14:11
|
Joined: Dec 2002
Posts: 293 Minnesota
Peter Churness
OP
Member
|
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
Expert
|
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: Peter Churness]
#35353
10/27/04 16:04
10/27/04 16:04
|
Joined: Feb 2003
Posts: 2,826 Margaritaville (Redneck Rivier...
myrlyn68
Senior Expert
|
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.
|
|
|
|