ShadeC-EVO Wasser??

Posted By: DexLoomer

ShadeC-EVO Wasser?? - 05/07/16 06:56

Hi Leute,
ich versuche mit ShadeC-EVO Wasser in mein Level einzubinden. Dazu habe ich ein entsprechendes Modell in mein Hauptverzeichnis angelegt und in mein Level eingebaut. Die Datei sc_obj_water.fx im fx vom shadec Ordner ist vorhanden und ich habe in die common.h Datei ein Wassermaterial angelegt:
Code:
MATERIAL* mtl_water01 =
{
	effect = "sc_obj_water.fx";
	flags = ENABLE_RENDER;
	
	event = sc_materials_event;
}


Das Material habe ich in WED dem Wassermodell zugewiesen.

Jetzt bekomme ich die Fehlermeldung:
Error in "sc_entity.c" line 336
"SC_MYREFRACT" undeclared identifier..

Kann mir jemand helfen wie ich mit ShadeC-EVO Wasser in mein Level bekomme?

Gruß DexxLoomer
Posted By: DexLoomer

Re: ShadeC-EVO Wasser?? - 05/08/16 07:01

Hat jemand eine Idee?
Posted By: Reconnoiter

Re: ShadeC-EVO Wasser?? - 05/08/16 14:53

Dunno if this helps much, but maybe you can try it in code to see if that makes a difference (dont think it will though). Another thing you could try is too see if you can locate SC_MYREFRACT in e.g. the shader fx, perhaps it is commented out or you are missing some shader/shade-c script file in your includes.

-edit, check these threads out, Sivan uses and improved a water shader from shade-c succesfully: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=420547&page=1
and http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=436662
Posted By: DexLoomer

Re: ShadeC-EVO Wasser?? - 05/08/16 17:05

Hier ist mal die Datei als Beispiel:

http://www.filedropper.com/water-test
Posted By: DexLoomer

Re: ShadeC-EVO Wasser?? - 05/09/16 17:34

Hat jemand Erfahrung mit ShadeC-EVO von https://github.com/BoHHavoc/ShadeC-EVO und kann erklären wie man damit Wasser erstellt?
Posted By: rayp

Re: ShadeC-EVO Wasser?? - 05/30/16 20:28

So weit ich in den EVO scripts rum gelesen habe, ist Wasser und Terrainshader nicht fertig gestellt, somit nicht verfügbar.
Und bedenkt man wie alt es inzwischen ist, glaube ich nicht das Boh_Havoc daran noch was ändern wird.

edit: Beim Terrainshader bin ich mir sicher, war schockiert als ich es bemerkte. ^^

mfg
Posted By: sivan

Re: ShadeC-EVO Wasser?? - 05/31/16 07:43

Shade-C EVO uses deferred rendering so a water shader is not an easy job. water shader in general a hard job. laugh

terrain shader could not be a big problem. oliver2s made a good one for his project, but he had to switch to unity. Boh_Havoc also left gamestudio, more exactly switched to unity. I thought I will switch to EVO from the old Shape-C package what I customized in MapBuilder (simplified/improved), but after some testing of EVO finally I switched to UE4.

I do not know anybody else who is dealing with the development of Shade-C...
Posted By: HenWoll

Re: ShadeC-EVO Wasser?? - 05/31/16 13:45

has anyone ever tried the havoc to contact? I also need a lot of assistance with shade-c

I mean it really an alternative for shader with Game Studio must give?

thus are not meant standart shader
Posted By: rayp

Re: ShadeC-EVO Wasser?? - 05/31/16 20:20

With Boh good graphics went with him. frown

edit: About contact. Guess hes a really busy man grin
Posted By: DexLoomer

Re: ShadeC-EVO Wasser?? - 05/31/16 22:27

Hi Leute,
danke für die Antworten. Das es mit ShadeC-EVO schwierig wird habe ich auch eingesehen, scheint nicht ganz fertig geworden zu sein.
Daher bin ich inzwischen zu Shade-c_v0.91_BETA_S1 übergegangen. Da bekomme ich Wasser und Terrain hin. Leider klappt es dort nicht Schatten von dynamischen Lichtern anzuzeigen. Kennt sich vieleicht damit jemand aus?
Posted By: rayp

Re: ShadeC-EVO Wasser?? - 05/31/16 22:46

Hast Du denn auch in der main function folgendes beachtet?
Code:
shadow_stencil = -1; // "3rd party shadows"


Und in der Entity die Schatten werfen soll das Flag Shadow gesetzt?
Code:
set (my, SHADOW); // oder anstelle von "my" eben der Pointer



MfG
Posted By: DexLoomer

Re: ShadeC-EVO Wasser?? - 06/02/16 21:40

Hi rayp,
danke für den Tip. Aber ganz klappt es damit nicht. Ich hab zwar Schatten, diese sind aber durch das Sonnenlich. Ich werde am Wochenende das ganze noch einmal ausprobieren und damit experimentieren.
Mfg
Posted By: rayp

Re: ShadeC-EVO Wasser?? - 06/03/16 03:04

In die main:
Code:
sc_screen_default.settings.lights.sunShadows          =     0; //enable shadows for the sun	
	sc_screen_default.settings.lights.sunShadowResolution =   512; //reduce shadow resolution as we are manually setting the shadow range to 5000 and can therefor get away with a small shadowmap   
	sc_screen_default.settings.lights.sunPssmSplitWeight  =   0.7; // 0.7 high res near splits, low res far splits
	sc_screen_default.settings.lights.sunShadowRange      =  1000; //manually set the shadow range...we don't need realtime shadows in the far distant! If set to 0 (default) shadow range will be set to camera.clip_far
	sc_screen_default.settings.lights.sunShadowBias       = 0.001; //set the shadow bias 0.001

Greets

edit: Eigentlich sollten die Schatten aber auch so gehen. Du hast ein ShadeC - dynamisches Licht erstellt ja?
Code:
action shadeCE_light(){
	set (my, PASSABLE | INVISIBLE);
        sc_light_create (vector (my.x, my.y, my.z), my.skill4,
	                 vector (my.skill1, my.skill2, my.skill3),
	                 SC_LIGHT_SPOT | SC_LIGHT_SPECULAR | SC_LIGHT_SHADOW,
	                 vector (my.pan, my.tilt, my.roll), my.skill5);
}

Zu beachten SC_LIGHT_SHADOW, damit wirft das Licht Schatten. Anstelle von SC_LIGHT_SPOT ( Spotlight ) kannst Du auch SC_LIGHT_POINT ( Punktlicht ) benutzen.
Entfernen kannst Du die Lichter mittels
Code:
if (entity-pointer-here) sc_light_remove (entity-pointer-here);

Und in der Entity die Schatten werfen soll hast Du das Shadow-Flag gesetzt ja?
Code:
set (my, SHADOW);

Hast Du das alles beachtet werden Schatten da sein.


Die internen Lichter kannst Du knicken, wenn Du ShadeC benutzt.
Posted By: alibaba

Re: ShadeC-EVO Wasser?? - 06/03/16 06:59

In 0.91 gibts keine Schatten für dynamische Lichter
Posted By: rayp

Re: ShadeC-EVO Wasser?? - 06/03/16 10:24

So fern wir von shadeC evo reden, wird mein beispiel zu schatten führen, wers nicht glaubt, probieren, fakt
Mfg
Ein Beispiel einer Taschenlampe mit dynamischen Licht. Man beachte den schönen Schatten, ShadeC EVO 0.91 ( BETA if theres any difference )

Quote:
SC_LIGHT_SHADOW


edit:
Bei nicht - EVO bin ich mir nicht sicher, wie's da ist. Hatte nicht gesehen / gerafft das wir inzwischen nicht mehr von EVO reden.
Posted By: DexLoomer

Re: ShadeC-EVO Wasser?? - 06/05/16 09:09

Hi rayp,
danke für die Tips. Aber in "ShadeC EVO"
https://github.com/BoHHavoc/ShadeC-EVO
habe ich auch Schatten von dynamischen Lichtern hinbekommen, sowie "LichtProjektionsTexturen" wie der Lichtkegel einer Taschenlampe. Nur fünktionierte der Terrain und der Wassershader darin nicht.

In der älteren Version "shade-c_v0.91_BETA_S1"
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=434099&page=1 und
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=420547&page=1
habe ich das Wasser und Terrain hinbekommen, welches ich dringend benötige. Daher bin ich auf diese Version jetzt umgestiegen.
Leider bekomme ich dafür keine Beleuchtung der mit dem Shader versehenen Modelle und Objekte durch dynamische Lichter und die ensprechende Schatten hin! Auch "LichtProjektionsTexturen" gehen nicht. Lediglich Beleuchtung und Schatten durch die Sonne sind möglich, die ich für Indoorlevel nicht brauche.

Ich habe mal eine Beispieldatei erstellt:
http://www.filedropper.com/stuff_11

Mfg Dex
Posted By: alibaba

Re: ShadeC-EVO Wasser?? - 06/05/16 10:41

Originally Posted By: alibaba
In 0.91 gibts keine Schatten für dynamische Lichter
Posted By: rayp

Re: ShadeC-EVO Wasser?? - 06/06/16 10:00

Ich habe es nicht mehr in Erinnerung wies beim alten ShadeC ist, aber ich meine alibaba denkt sich schon was bei seinem Post.

edit: Eine tolle Sache wäre es, wenn ein Shaderfachmann EVO einen Terrainshader verpassen würde.
Posted By: HenWoll

Re: ShadeC-EVO Wasser?? - 06/06/16 11:24

@rayp
Zitat:Die internen Lichter kannst Du knicken, wenn Du ShadeC benutzt.

schon klar, dies musste ich durch entities und actionen ergänten um die shade-c lichter zu verwenden,

aber was ich damals nicht probiert habe, was mich schon so ziemlich interessiert,
bezieht sich dies auf alle licht arten von acknex ?
Posted By: alibaba

Re: ShadeC-EVO Wasser?? - 06/06/16 13:25

Was du machen kannst (ist aber ganz schön dreckig):
-Nimm alten Terrain code von 0.91:
Code:
BMAP* sc_bmap_terrainColor = "terrain_color.dds";

MATERIAL* sc_ent_Terrain =
{
	skin1 = sc_bmap_terrainColor;
	effect = "
/******************************************************************************************************
Terrain-Shader by Wolfgang "BoH_Havoc" Reichardt

Entity Textures:
	Skin1 = Global Colormap
	Skin2 = Tile-Colormask  (RGB) + Shadow (A)
	Skin3 = Global Normalmap
	Skin4 = Tile-Normalmap (RGB) + Specularmap (A) (Quad-Texture)

Material Textures:
	Skin1 = Tile-Color (Quad-Texture)

Usage:

	
******************************************************************************************************/

/***************************************TWEAKABLES*****************************************************/

float shadowAlpha = 0.25; //shadowalpha of bumpmapping
float texShadowAlpha = 0.25; //shadowalpha of shadowtexture



/***************************************SHADER*CODE****************************************************/

texture entSkin1; //colormap
texture entSkin2; //global normalmap + Shadow
texture entSkin3; //colormask
texture entSkin4; //normalmaps
texture mtlSkin1; //colormaps

matrix matWorld;
matrix matWorldInv;
matrix matViewInv;
matrix matWorldViewProj;

float4 vecSunPos;
float4 vecSunColor;
float4 vecLightPos[8];
float4 vecViewPos;
float4 vecFog;

#define DOSUN

sampler colorSampler = sampler_state 
{ 
   Texture = <entSkin1>; 
   MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
};

sampler maskSampler = sampler_state 
{ 
   Texture = <entSkin2>; 
   MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
}; 

sampler globalNormSampler = sampler_state 
{ 
   Texture = <entSkin3>; 
   MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
}; 

sampler normSampler = sampler_state 
{ 
   Texture = <entSkin4>; 
   MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
}; 

sampler tileColorSampler = sampler_state 
{ 
   Texture = <mtlSkin1>; 
   MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
};

void terrain_VS( 
   in float4 InPos: POSITION, 
   in float3 InNormal: NORMAL, 
   in float2 InTex: TEXCOORD0,
   in float3 InTangent : TEXCOORD0,
   in float2 InShadow : TEXCOORD1,
   out float4 OutPos: POSITION, 
   out float2 OutTex: TEXCOORD0, 
   out float4 OutLight: TEXCOORD1,
   out float3 OutViewDir: TEXCOORD2,
   out float3 OutWorldNormal	: TEXCOORD3,
	out float3 OutWorldTangent	: TEXCOORD4,
	out float3 OutWorldBinorm	: TEXCOORD5,
	out float3 OutWorldPos	: TEXCOORD6,
   out float OutFog : FOG) 
{ 
	// Transform the vertex from object space to clip space: 
   OutPos = mul(InPos, matWorldViewProj); 
	// Pass the texture coordinate to the pixel shader: 
   OutTex.xy = InTex;
   
   float3 PosWorld = mul(InPos, matWorld);
  	
   //Light
   #ifdef DOSUN
   OutLight.xyz = vecSunPos - PosWorld;;
   OutLight.w = 100000;//distance(PosWorld,vecLightPos[0])/vecLightPos[0].w;
   #else
   OutLight.xyz = vecLightPos[0] - PosWorld;
   OutLight.w = 0;
   if(vecLightPos[0].w < 100000) OutLight.w = 1-distance(PosWorld,vecLightPos[0])/vecLightPos[0].w;
   #endif
  	//

	//Specular Lighting
	#ifdef DOSUN
	OutViewDir = (vecSunPos) - mul(InPos, matWorld);
	#else
	OutViewDir = (vecLightPos[0]) - mul(InPos, matWorld); 
	#endif
	//
	
	//Misc Output
	float3 Binormal = cross(InNormal,InTangent);
	OutWorldNormal.xyz = mul(InNormal, matWorld).xyz;
	OutWorldTangent.xyz = mul(InTangent, matWorld).xyz;
	OutWorldBinorm.xyz = mul(Binormal, matWorldInv).xyz;
	OutWorldPos = PosWorld;
	//
	
	//Fog
	OutFog = 1 - (distance(PosWorld, vecViewPos) - vecFog.x) * (vecFog.z);
   //
}

float4 terrain_PS(
	float2 Tex : TEXCOORD0,
	float4 InLight: TEXCOORD1,
	float3 InViewDir: TEXCOORD2,
	float3 InWorldNormal	: TEXCOORD3,
	float3 InWorldTangent	: TEXCOORD4,
	float3 InWorldBinorm	: TEXCOORD5,
	float3 InWorldPos	: TEXCOORD6
):COLOR0
{
	float4 Color = tex2D(colorSampler, Tex);
	
	float4 colorMask = tex2D(maskSampler, Tex);
	
	float2 Tile = Tex*40;
	Tile = frac(Tile)*(0.5-2*0.004)+0.004;
	
	float4 color = tex2D(colorSampler, Tex);
	
	float4 color1 = tex2D(tileColorSampler, Tile)*colorMask.r;
	float4 color2 = tex2D(tileColorSampler, Tile+float2(0.5, 0.0))*colorMask.g;
	float4 color3 = tex2D(tileColorSampler, Tile+float2(0.0, 0.5))*colorMask.b;
		
	float4 normal1 = tex2D(normSampler, Tile)*colorMask.r;
	float4 normal2 = tex2D(normSampler, Tile+float2(0.5, 0.0))*colorMask.g;
	float4 normal3 = tex2D(normSampler, Tile+float2(0.0, 0.5))*colorMask.b;
		
	float3 Ln = normalize(InLight.xyz);
   float3 Nn = normalize(InWorldNormal);
   float3 Tn = normalize(InWorldTangent);
   float3 Bn = normalize(InWorldBinorm);
   float3 Nb = 0;
   float3 Vn = 0;
   float3 Hn = 0;
   float4 lighting = 0;
	
	float gloss = normal1.a + normal2.a + normal3.a;	
	
	float3 bumpNormal = (normal1.rgb+normal2.rgb+normal3.rgb);
	//bumpNormal += tex2D(globalNormSampler, Tex).xyz;
	bumpNormal = lerp(bumpNormal, tex2D(globalNormSampler, Tex).xyz, 0.5);
	Nb = Nn + (bumpNormal.x * Tn + bumpNormal.y * Bn);
   Nb = normalize(Nb);
   Vn = normalize(InViewDir);
   Hn = normalize(Vn + Ln);
   lighting = lit(dot(Ln,Nb),dot(Hn,Nb),1);
   
	Color.rgb = saturate(clamp(lighting.y, shadowAlpha, 1)*vecSunColor*2);
	//Color.rgb = lighting.y+lighting.z;
	
	Color.rgb *= lerp(color, (color1+color2+color3), 0.5);
	//Color.rgb *= color;
	//Color.rgb *= color*(color1+color2+color3);
	//Color.rgb *= 2;
	//Color.rgb = clamp(Color.rgb,0,1);
	Color.rgb += lighting.z*gloss*Color.rgb;
	Color.rgb = clamp(Color.rgb, 0, 1);
	Color.rgb *= clamp(colorMask.a,texShadowAlpha,1);

	Color.a = 1;
	//Color.rgb = (color1+color2+color3);
	/*
	//VELVETY
	Vn = normalize(matViewInv[3].xyz - InWorldPos);
	half3 velvety1;
   float vdn = 0.4-dot(Vn,Nn);
   float3 vecColor = float4(vdn.xxx,1.0);
   velvety1 = float4((vecColor).xyz,1);
   velvety1 = clamp(velvety1,0,1);
   Color.rgb += velvety1*gloss;
	//
	*/
	
	return float4(Color.rgb,1);
}

technique terrain
{
	pass p0
	{
		//cullmode = none;
		//zwriteenable = true;
		//alphablendenable = true;
		VertexShader = compile vs_2_0 terrain_VS();
		PixelShader = compile ps_2_a terrain_PS();
	}
}


";
}



-aktiviere das forward rendering:
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



-weise dem terrain modell den shader zu und fertig

Aber wie gesagt, das ist sehr umständlich und dreckig. Das selbe kannst du mit dem wassershader machen. Alles sollte so funktionieren, wie beim alten ShadeC.
© 2024 lite-C Forums