Question about terrain multitexture shader

Posted By: LogantheHogan

Question about terrain multitexture shader - 10/05/04 06:46

I have a question about Steempipe's terrain multitexturing effect -

Is there any way to use detailmaps in conjunction with his shader? Like, for one of the tileable textures, have a smaller detail map, and then for the other, have a different detail map? I was playing Halo yesterday and I noticed that it looks like they did this. There are 2 terrain textures and both of the textures has its own detailmap, and it looked really good.

Thanks for any help.

Logan

P.S. Let's see if anyone can reply before I finish my homework! Only 10 more vocab words!
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/05/04 07:53

Yes... possible... My current FFP effect has a unique detailmap for each texture. It still needs some cleaning up though, as I have had to abandon it.
Posted By: LogantheHogan

Re: Question about terrain multitexture shader - 10/05/04 08:07

Thanks Steempipe, this isn't the effect thats currently on your Terrain page on your site, is it?
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/05/04 08:34

No.. it's not. That one is way outdated. I really need to get the website updated one of these days.

Since I need to incorporate the effect into a current project, it needs to be cleaned up very, very, very soon.

I'll send it to you when I've got it under control and you can help test it. I would say that it will be ready by the 12th of Oct, hopefully sooner.
Posted By: LogantheHogan

Re: Question about terrain multitexture shader - 10/05/04 08:44

OK thanks for the help, Steempipe! I really appreciate all you are doing for the community as far as shaders, terrains and such. Just thought you should know that.

Logan
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/05/04 08:49

Cool. Thanks for saying that.
Posted By: William

Re: Question about terrain multitexture shader - 10/05/04 09:27

Would I be able to do some testing of you new shader as well? I couldnt convert your old one completely to directx 9, just the FFP part of it... it seems to run a bit slower than the pixelshader/vertexshader version of it. I cant seem to convert the pixelshader version of it right. Also, while I got the FFP version of it working right I cant seem to get the textures to change there uvscale independantly. Hope your new shader will be able to do this stuff - Thanks, I also appreciate all the hard work your putting into progressing shaders in 3DGS!!

BTW - Steempipes FFP shader edited slightly to work with DX9

Code:
 

///////////////////////////////////////////////////////////
// FFP Terrain MultiTexturing Effect
//
// By: Eric A. Hendrickson-Lambert (Steempipe)
//

bmap grass = <ashpalt3.bmp>;//gets blended with the blue channel
bmap Alpha_M = <pointysharpparkt.tga>; // Alpha Map/texture

function mtl_terraintex_init()
{
bmap_to_mipmap(mtl.skin2);
// Adjust the texture transform to do some tiling of the textures
mtl.matrix11 = float(1); // Tileing of the textures
mtl.matrix22 = float(1); // Tileing of the textures
}

material mat_terraintex
{
Skin1 = grass;
Skin2 = Alpha_M;

event = mtl_terraintex_init;

effect =
"
texture mtlSkin1; // Grass
texture mtlSkin2; // alphamap

matrix matWorldViewProj;
matrix matWorld;
matrix matWorldView;

vector vecSunDir;
vector vecDiffuse;
vector vecAmbient;
vector vecLight;
vector vecFog;
vector vecSkill41;

matrix matMtl;

// default technique
technique ffp_terrain_tex
{
pass P0
{
//fillmode = wireframe;

alphablendenable=false;
Texture[0] = <mtlSkin1>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

TextureTransformFlags[0] = Count2;
TextureTransform[0] = <matMtl>;
texcoordindex[0]=1;

colorArg1[0] = Texture;
colorOp[0] = selectarg1;
alphaop[0]=disable;
colorop[1]=disable;
alphaop[1]=disable;
//disable, modulate, modulate2x, modulate4x, add, subtract, addsigned, addsigned2x, tfactor, dotproduct3, envbumpmap, envemumap

}

pass P1
{
alphablendenable=true; // We need to enable alphablending
srcblend=srcalpha;
destblend=invsrcalpha;

Texture[0] = <mtlSkin2>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

TextureTransformFlags[0] = disable;// We don't want the alphamap to tile

texcoordindex[0]=0;

colorArg1[0] = current;
colorOp[0] = selectarg1;
alphaarg1[0] = Texture | alphareplicate;
alphaop[0]=selectarg1;

Texture[1] = <mtlSkin2>;//sand

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

TextureTransformFlags[1] = Count2;
TextureTransform[1] = <matMtl>;
texcoordindex[1]=1;

colorArg1[1] = Texture;
colorOp[1] = addsigned;
alphaarg1[1] = current | alphareplicate;
alphaop[1]=disable;

// colorop[2]=modulate;
alphaop[2]=disable;
}
}
"; // end of the effect string
}

action Terrain
{
my.ambient = 4; //change brightness
my.material = mat_terraintex;
}


Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/20/04 09:27

After I work on getting multiple detailmaps in this thing, then my DX 9 FFP terrain effect should be ready to test. Hope it will work soon...

@LoganTheHogan & William: I'll send you a link when it is ready to test.


Posted By: LogantheHogan

Re: Question about terrain multitexture shader - 10/20/04 10:10

Thanks, looks nice.
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/22/04 10:19

Good news LoganTheHogan & William, we are getting closer to a desirable DX9 FFP Multitex effect.

Not running too bad, about the same as my pixelshader version with as many textues. Tweaking and optimizing is the next step.

The colormap is just a basic big skin stretched across the land... but when all done we will be able to apply tileable textures in it's place.

Here are (3) Detailmaps applied, based on blendmaps



And here is showing that lighting is working across all blends. finally.



Soon I will be notifying you of code downloads.

Eric
Posted By: William

Re: Question about terrain multitexture shader - 10/22/04 14:02

Thanks for doing this Eric. I have a couple questions though. What do you mean by the colormap thats stretched over the terrain? What do you mean by lightmap? Can you have like 3 totally different textures tiled due to an alpha map like in your old shader? Thanks for all your help and hard work, I am really looking forward to seeing the code.
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/22/04 17:44

The "stretched" colormap thing is just like using a 1024x1024 colormap and then applying a smaller dimension detailmap. It was just convienient here to use the texture I already had in entSkin1. The big colormap was rendered in Terragen.

These shots have no lightmap texture applied. I was refering to an original problem of where diffuse lighting was only getting applied to the 1st pass and the susequent blend passes did not get diffuse lighting. They would be full-on bright. Looked strange....
However, I am going to expiriment with just adding a light/shadowmap and see what happens.

Yes, it is like the old effect in that the individual textures are applied according to individual alphamaps. In this example; I render the "big skin", then use alphamaps to apply a detail texture. It could easily replace the "big skin" with other tileable textures, apply a detailmap to it, or mix and match as you see fit.

Right now I am working on some methods to up the framerate as much as possible and to also achieve the best effect I can for geForce2 type of cards.

Eric
Posted By: William

Re: Question about terrain multitexture shader - 10/23/04 12:43

Thanks for the informative answers. Please dont feel rushed, I am glad you are concerned about the speed of the shader as thats very important to me as well. Thanks.
Posted By: Alkai

Re: Question about terrain multitexture shader - 10/25/04 22:59

Steempipe, if you could send me the link as well once you've got it, I'd appreciate it! Great work!
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/26/04 05:32

Yes, you'll get the link. It's pretty much done... I'll have to re-check it tonight.
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/27/04 09:29

Getting closer.... I had to spend some time dialing in the very minimum fallback technique to get the light right.

Basically, I am looking to make a complete effect that will have all the fallbacks and things in it and have some detailed comments, etc.




Posted By: LogantheHogan

Re: Question about terrain multitexture shader - 10/27/04 10:40

Looking better and better! Thanks.

Logan
Posted By: William

Re: Question about terrain multitexture shader - 10/27/04 13:39

"The one Multitexturing Shader to rule them all!"

BTW - I was wondering if its possible to retrieve the texture by using trace on multitexturing shaders? This would be very usefull in racing games in which you want the player to slow down depending on the texture there on. As far as I can read the scan_texture command will only detect a terrain as a whole. I'm not completely sure though, so if anyone knows of a method to do this please share it. Thanks.
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/27/04 19:01

If all else fails, maybe you can use an adaptation of Lolek's terrain sound script.

BTW: The effects here are being programmed with DX9.00c because of the flexibility and such. Will that work you you guys for testing/implementing??
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/27/04 19:30

Added some parts to incorporate varioust lighting control....


Posted By: LogantheHogan

Re: Question about terrain multitexture shader - 10/27/04 23:32

DX9c will be fine.

Heh, I'm pretty stoked on this. Hurry it up, Steempipe! jk

Logan
Posted By: Peter Churness

Re: Question about terrain multitexture shader - 10/28/04 02:12

Hey Steempipe,

How do you get the character model to cast a shadow on a terrain?

You're pics are looking great, btw...

Thanks,
Peter
Posted By: Steempipe

Re: Question about terrain multitexture shader - 10/28/04 03:56

Hmmmm... I have a hollowed cube around my terrain. Assigned the sun color and angles in the map properites. Checked the shadow flag on cbabe. I think that was all.
Posted By: CD_saber

Re: Question about terrain multitexture shader - 11/18/04 19:45

Hello Steempipe,

can you please make a little demo level with a terrain and your code, cause i can't get your code working.

That would be very nice of you !

CD_SABER
Posted By: sane

Re: Question about terrain multitexture shader - 11/24/04 05:35

hey steempipe,

did i get it right that you do not use for example three different detail-textures but one big one that covers the complete hmp and than you use detail-textures turning this one more bright or more dark?
Posted By: LogantheHogan

Re: Question about terrain multitexture shader - 11/24/04 05:37

No, the effect is three individual detail maps blended over a large terrain colormap.
Posted By: Steempipe

Re: Question about terrain multitexture shader - 11/24/04 11:08

Quote:

Hello Steempipe,

can you please make a little demo level with a terrain and your code, cause i can't get your code working.

That would be very nice of you !

CD_SABER




Sure. I Will be working on one... It will wind up in this thread when I post it.

Thanks for clarifying sane's question, LogantheHogan.

Eric
© 2024 lite-C Forums