Jump to content

RGB shader with decals


tjheldna
 Share

Recommended Posts

Hi All,

 

I'm trying my hand at modifying the diffuse_normal shader to do a particular task.

 

Basicly I want to texture cars using rgb values with a decal texture overlay. Doing this I can easily change the color of the cars paintwork using rgb values but keep things like lights, damage, interior the same.

 

 

This does work but one thing I can't do is get a nice alpha fade off, blended by the alpha value on the texture with the rgb value.

 

float textureAlpha = texture(texture0,ex_texcoords0).a;

if(textureAlpha > 0.0)
{
outcolor = texture(texture0,ex_texcoords0);
}
else
{
outcolor = (ex_color * (1.0 - texture(texture0,ex_texcoords0).a));
}

 

post-5086-0-65969700-1435360550.png

 

 

If I change the 0.0 value I get various results but always a hard line around the decals where I'm trying to blend with the texture alpha.

 

Any insight into this would be great!

 

Thanks

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

Essentially you are just doing what the alphatest shader performs - ignore anything below (or above) a fixed alpha limit which will always give a hard line if you have varying alpha in your texture. In LE2, we had the alphablend shader but this only worked when the object was drawn in the transparency world. I would try to combine the color with the texture via a mix() without regards to an alpha limit. It would probably be easier for others to test if you supplied an example object, the full shader, and an example decal texture.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Just wondering where can a find a good list of functions available to me for shaders in LE?

 

This is the official reference card: https://www.opengl.org/sdk/docs/reference_card/opengl44-quick-reference-card.pdf

 

Edit- theres a new one for 4.5 but LE projects appear to be still using 4.4 since 4.5 was just released a month ago (also the built-in functions essentially havent changed much in years).

 

Also, in the previous post i suggested to do a mix without regards to the alpha - actually i would try to use the texture's alpha as the interpolation step value in the mix() function to determine if the color or the texture would be more prevalent.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...