Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 945 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
noob question related to outline code #469039
11/03/17 19:53
11/03/17 19:53
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Howdy,

Below I have outline shader code that I successfully used previously in a non-ShadeC project, and now I want to use it in a ShadeC evo project. The problem is however that I think I need to add it to an existing pass. When I simply paste it after the current ShadeC pass the whole screen is the outline color (even with extreme thin outline size). And when pasting it as a separate pass it does nothing. So I quessing I need to add it to a current pass but within the linked VertexShader & PixelShader. So I tried that but than I apparently need to change the code/syntax otherwise it gives fx compiling errors ("object literals are not allowed inside functions").
Could someone help me a bit / point me in the right direction with altering the code so I can add it to the existing VertexShader & PixelShader? (if this is feasible that is)

The required variables:
Code:
vector vecSkill41;
const float4x4 matWorldViewProj;



The outline pass:
Code:
pass outline
	{
		CullMode = CCW; // (Commenting these didn't matter) Not really needed, it is the default state
		ZEnable = True; // Not really needed, it is the default state
		ZFunc = Less; // Not really needed, it is the default state
		ZWriteEnable = False;
		//cullMode = cw;
		vertexShaderConstant[0] = <matWorldViewProj>;
		vertexShaderConstant[16] = <vecSkill41>; // outline_thickness
		vertexShader = asm
		{
			vs.1.1
			dcl_position v0
			dcl_normal v3
			dcl_texcoord0 v7
			dcl_texcoord1 v8

			mov r0,v0
			mul r1,c16.x,v3 // scale normal
			add r0.xyz,r0.xyz,r1.xyz // shell offset (vertex position + scaled normal)
			m4x4 oPos,r0,c0 // transform position to clip space
		};
		pixelShader = asm
		{
			ps.1.3
			def c0,255,255,0,1 // color outline rgba
			mov r0,c0
		};
	}



The Shade-C existing technique / pass (sc_deferred_finalize.fx):
Code:
technique t1
{
	pass p0
	{
		//cullmode = ccw;
		//zwriteenable = false;
		alphablendenable = false;
		//VertexShader = compile vs_2_0 mainVS();
		PixelShader = compile ps_3_0 mainPS();
		//FogEnable = False;
		
		SRGBWriteEnable = true;
	}
}


Re: noob question related to outline code [Re: Reconnoiter] #469048
11/04/17 10:42
11/04/17 10:42
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
The problem is that shade-c (evo) uses deferred rendering and an outline shader like that is usually used in forward rendering. You can still try to use the outline in a second pass but you'd have to output the right data for the gbuffer so your outline is shaded properly in the lighting and shading passes of the deferred pipeline.


POTATO-MAN saves the day! - Random
Re: noob question related to outline code [Re: Kartoffel] #469051
11/04/17 12:17
11/04/17 12:17
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Forward rendering is turned on though in the Shade-C init:

Code:
sc_screen_default.settings.forward.enabled = 1; //enable if you need particles or custom materials which can't be rendered in the deferred pipeline


Please note that there is also a "sc_forward.fx" but when I placed the code in that one it didn't do anything and normally it contains only the following:

Code:
technique t1
{
	pass p0
	{
		ColorWriteEnable = 0;
	}
}


Last edited by Reconnoiter; 11/04/17 12:18.

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