Gamestudio Links
Zorro Links
Newest Posts
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
Zorro version 3.0 prerelease!
by TipmyPip. 02/24/26 17:09
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (Martin_HH, TipmyPip, AndrewAMD, Grant), 5,825 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
detail mapping with alpha mixing #49299
07/17/05 08:46
07/17/05 08:46
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline OP
Senior Expert
ulillillia  Offline OP
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
This was posted in another thread that no one is replying to. This is more of a shaders question so it might be because it's in the wrong forum. Earlier, I was given a link to some code by steempipe, however, I was getting an all-black texture as my texture is all black, but with varying degrees of alpha quite randomized. So, I scanned through the code to look for some things that might be the cause to it and managed to get a little further, however, the objects are half as dark still apparently not reading through the alpha.

Think about it this way. You have a base image for the background layer in the GIMP. You add a new layer with the roughness containing the random alpha. Only, instead, you can "cram" 4 pixels (I'd like this to vary dependent on one of the entity's skill values like my.skill15 or something) on each side on the roughness texture into the background texture (like detail mapping does). What am I missing? I suspect the alphaop thing, but changing that didn't work as I only got an error instead.

As a side note, I've modified the original code quite a bit, mainly for fixing the tabbing, removing the big chunks of comments that I don't find neccessary like "the material", and changing the names used for some things, like the function name, name of the bmap, name of the technique, material, and action. This is how I have it now:

Code:

var detail_size=4;
bmap detailmap = <roughnessstep2.tga>; // alpha is in multiples of 2 - max of 30

function BG_roughness()
{
bmap_to_mipmap(mtl.Skin1);

// Adjust the scale of the textures
mtl.matrix11 = float(18); // default u scale
mtl.matrix22 = float(18); // default v scale
}

material roughness
{
skin1=detailmap;
event = BG_roughness;
effect =
"
matrix matMtl;
texture entSkin1; // Your big skin tex
texture mtlSkin1; // A detailmap

technique add_roughness
{
pass P0
{
lighting=false;//false;
ditherenable=true;
zwriteenable=true;
zenable=true;

alphablendenable=true;
Texture[0] = <entSkin1>;

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

TextureTransformflags[0] = disable;
texcoordindex[0]=0;

ColorArg1[0] = Texture;
ColorOp[0] = modulate;//2x;
ColorArg2[0]=Diffuse;

Texture[1] = <mtlSkin1>;

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

ColorOp[1]=addsigned;
ColorArg1[1]=Texture;
ColorArg2[1]=Current;
AlphaOp[1] = Disable; // this might be the cause to the problem

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

colorop[2]=disable;
alphaop[2]=disable; // as well as this
}
}
";
}

action apply_roughness
{
my.material = roughness;
}



What am I seeing? Go here and see.

The buildings on the right are of a plain white texture with almost no detail. The texture shown in here is half as bright, which is what the code above is doing. The buildings on the left and the beach area are also with the roughness, what they are in the above screenshots. The roughness as you see it is actually from the model's skin image, the texture, not from the detail mapping, but this is how it should appear (only, not this dark). They, too, are half as bright. I'm using a black texture with varying amounts of transparency, depending on the degree of roughness.

What else do I need to add or change to get this to cooperate? The list of advantages of this is quite strong.

Also, what shader version and type is this code supposedly compatible with? I think it's a pixel shader, but have absolutely no idea which version.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: detail mapping with alpha mixing [Re: ulillillia] #49300
07/17/05 09:07
07/17/05 09:07
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Well, first off, this is not a shader at all--it's a fixed function effect, and as such should run on any card.

as far as why it doesnt give the dsired effect I can't help a lot,unfortunately i dont really understand the texture stage states like i ought to. however, you might try commenting out this : AlphaOp[1] = Disable; and this:colorop[2]=disable; alphaop[2]=disable;

This might not do it but i dunnno why you would need a third stage here to disable.. anyway also outhgt to chnage this alphablendenable=true; to false and this lighting=false; to true

let me know if this does anything.. if not, maybe i can load the effect and mess around with it.

Re: detail mapping with alpha mixing [Re: Matt_Aufderheide] #49301
07/17/05 09:22
07/17/05 09:22
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline OP
Senior Expert
ulillillia  Offline OP
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
For one, I don't have lighting at all in my level. Models are practically unaffected by them. I've played with some of the values but didn't get anywhere. Here's what I have it at this moment:

Code:

var detail_size=4;
bmap detailmap = <roughnessstep2.tga>;

function BG_roughness()
{
bmap_to_mipmap(mtl.Skin1);

// Adjust the scale of the textures
mtl.matrix11 = float(18); // default u scale
mtl.matrix22 = float(18); // default v scale
}

material roughness
{
/*
ambient_blue = 255;
ambient_green = 255;
ambient_red = 255;
emissive_blue = 0;
emissive_green = 0;
emissive_red = 0;
diffuse_blue = 0;
diffuse_green = 0;
diffuse_red = 0;
albedo = 50;
alpha = 100;
specular_blue = 0;
specular_green = 0;
specular_red = 0;
power = 0;
*/

skin1=detailmap;
event = BG_roughness;
effect =
"
matrix matMtl;
texture entSkin1; // Your big skin tex
texture mtlSkin1; // A detailmap

technique add_roughness
{
pass P0
{
lighting=false;//false;
ditherenable=true;
zwriteenable=true;
zenable=true;

alphablendenable=true;
Texture[0] = <entSkin1>;

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

TextureTransformflags[0] = disable;
texcoordindex[0]=0;

ColorArg1[0] = Texture;
ColorOp[0] = modulate;//2x;
ColorArg2[0]=Diffuse;

Texture[1] = <mtlSkin1>;

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

ColorOp[1]=addsigned;
ColorArg1[1]=Texture;
ColorArg2[1]=Current;
// AlphaOp[1] = Disable; // this might be the cause to the problem

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

// colorop[2]=disable;
// alphaop[2]=disable; // as well as this
}
}
";
}



Having it like this gives the half transparent effect, but no detail or anything.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: detail mapping with alpha mixing [Re: ulillillia] #49302
07/17/05 12:42
07/17/05 12:42
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
I can help troubleshoot, but you should send a small test level to me that replicates the problem. My email is in my Profile.

Re: detail mapping with alpha mixing [Re: Steempipe] #49303
07/17/05 21:24
07/17/05 21:24
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline OP
Senior Expert
ulillillia  Offline OP
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Quote:

I can help troubleshoot, but you should send a small test level to me that replicates the problem. My email is in my Profile.




Okay, will look into it, however, I could just upload it to my webhost then PM you the ZIP file of the neccessary files for a very simple level. Thank you for the assistance. If you're just viewing this, wait about 15 to 30 minutes and I should be set with the test level for you. Or, in short, just wait for the PM.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: detail mapping with alpha mixing [Re: ulillillia] #49304
07/17/05 22:23
07/17/05 22:23
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline OP
Senior Expert
ulillillia  Offline OP
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
PM sent. Thanks for the help.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: detail mapping with alpha mixing [Re: ulillillia] #49305
07/28/05 03:41
07/28/05 03:41
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline OP
Senior Expert
ulillillia  Offline OP
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Well, it's been ten days, did you forget or something?


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: detail mapping with alpha mixing [Re: ulillillia] #49306
07/29/05 18:52
07/29/05 18:52
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
I'm busy. It's on my list, however... not near the top.

Re: detail mapping with alpha mixing [Re: Steempipe] #49307
07/29/05 21:47
07/29/05 21:47
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline OP
Senior Expert
ulillillia  Offline OP
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Oh, I thought you just forgot about it, that's all. No biggie though and I still appreciate the help .


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials

Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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