Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (EternallyCurious, howardR), 646 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[Req] Second skin overlays first with... #455692
10/27/15 19:05
10/27/15 19:05

M
Malice
Unregistered
Malice
Unregistered
M



Anyone feel like doing a shader?

Looking for something that overlays the colored(non-black or non-transparent) part of skin2 over skin1 to create self-illumination glowing parts.

I have no idea the level of difficulty so I understand if this work than worth doing quick and dirty for fun.

Thank you for your time.
Mal

EDIT- Looking for image examples, will add soon.




Actual light cast not required but would be nice.

Thank you
Mal

Last edited by Malice; 10/27/15 19:12.
Re: [Req] Second skin overlays first with... [Re: ] #456536
11/27/15 14:57
11/27/15 14:57
Joined: Jun 2008
Posts: 402
Germany
S
sebbi91 Offline
Senior Member
sebbi91  Offline
Senior Member
S

Joined: Jun 2008
Posts: 402
Germany
Sounds and looks interesting.
I think I could need that too.
It would be nice if someone could realize that.


3D-Gamestudio A8 - Commercial
Re: [Req] Second skin overlays first with... [Re: sebbi91] #456539
11/27/15 18:09
11/27/15 18:09
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
Here you get a masked self-lighted solid entity shader. It supports up to eight dyn lights but it has not bloom or emmits light. That is another story. It is the simplest indeed. Save the mask as alpha channel on the texture.

Code:
float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecViewPos;
float4 vecViewDir;
float4 vecFog;
float4 vecFogColor;
float4 vecLight;
float4 vecColor;
float4 vecAmbient;

int iLights;
float4 vecLightColor[8];
float4 vecLightPos[8];

texture entSkin1;
sampler ColorSampler = sampler_state { Texture = <entSkin1>; Mipfilter = Linear; Minfilter = Linear; Magfilter = Linear; };

void VS (
	in float4 inposition : POSITION,
	in float3 innormal : NORMAL,
	in float2 intex : TEXCOORD0,
	out float4 outposition : POSITION,
	out float3 outnormal : TEXCOORD0,
	out float2 outtex : TEXCOORD1,
	out float3 outworldPos : TEXCOORD2 )
	{
		inposition.w = 1.0f;
		outposition = mul ( inposition, matWorldViewProj );
		outnormal = mul ( innormal, (float3x3)matWorld );
		outtex.xy = intex.xy;
		outworldPos = mul ( inposition, matWorld ).xyz;
	}

float4 PS (
	float3 normal : TEXCOORD0,
	float2 tex : TEXCOORD1,
	float3 worldPos : TEXCOORD2 ) : COLOR0
	{
		normal.xyz = normalize ( normal.xyz );
		float4 textureColor = tex2D ( ColorSampler, tex.xy );
		float4 finalColor;
		finalColor.rgb = vecAmbient.rgb * vecLight.rgb;
		for ( int i=0; i<iLights; i++ )
		{
			float3 lightDir = normalize ( vecLightPos[i].xyz - worldPos.xyz );
			float Distance = distance ( vecLightPos[i].xyz, worldPos.xyz );
			float Radiance = saturate ( ( vecLightPos[i].w - Distance ) / vecLightPos[i].w );
			finalColor.rgb += vecLightColor[i].rgb * saturate(dot(lightDir.xyz,normal.xyz)) * Radiance;
		}
		finalColor.rgb *= textureColor.rgb;
		finalColor.rgb = lerp ( finalColor.rgb, textureColor.rgb, textureColor.a );
		float Distance = distance ( vecViewPos.xyz, worldPos.xyz );
		float Fog = saturate ( ( Distance - vecFog.x ) * vecFog.z );
		finalColor.rgb = lerp ( color.rgb, vecFogColor, Fog );
		finalColor.a = 1.0f;
	   return finalColor;
	}

technique
{
	pass pass0
	{
		ZWriteEnable = True;
		AlphaBlendEnable = False;
		
		VertexShader = compile vs_3_0 VS(); 
		PixelShader  = compile ps_3_0 PS(); 
	}
}



Salud!


Re: [Req] Second skin overlays first with... [Re: txesmi] #456541
11/27/15 18:25
11/27/15 18:25

M
Malice
Unregistered
Malice
Unregistered
M



^--- Awesome! Thanks Txesmi. I'll start the hacking to add any needed things and post the results. Very kind to give us a frame to work from..

Thanks
Mal

Re: [Req] Second skin overlays first with... [Re: ] #456544
11/27/15 18:50
11/27/15 18:50
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Glad of being helpful laugh

Re: [Req] Second skin overlays first with... [Re: txesmi] #456545
11/27/15 20:52
11/27/15 20:52
Joined: Feb 2012
Posts: 371
Dico Offline
Senior Member
Dico  Offline
Senior Member

Joined: Feb 2012
Posts: 371
I think there is a method in med , so you can get nice glowing without shaders just two skins , one normal and the other is colored!
and with shader bloom you can get nice result.


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