Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
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
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (rki, Ayumi), 475 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Level shading #295007
10/22/09 14:11
10/22/09 14:11
Joined: Mar 2004
Posts: 281
England
frescosteve Offline OP
Member
frescosteve  Offline OP
Member

Joined: Mar 2004
Posts: 281
England
Hey guys, I know how to add a shader to a model, but is it possible to add a shader to the level (WED objects).

(Using toon shader for models, need to appy to level)

T.I.A

Last edited by frescosteve; 10/22/09 14:20.
Re: Level shading [Re: frescosteve] #295012
10/22/09 14:32
10/22/09 14:32
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
T.I.A? [this is africa]? grin

lol, dont worry, i know what it actually means, you can add shaders to blocks too, i think its easily defined in the manual under "shader library"

Re: Level shading [Re: darkinferno] #295074
10/22/09 20:59
10/22/09 20:59
Joined: Jul 2004
Posts: 4,206
Innsbruck, Austria
sPlKe Offline
Expert
sPlKe  Offline
Expert

Joined: Jul 2004
Posts: 4,206
Innsbruck, Austria
its just slow as hell. and i really mean slow as hell...

Re: Level shading [Re: sPlKe] #295082
10/22/09 21:50
10/22/09 21:50
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Originally Posted By: sPlKe
its just slow as hell. and i really mean slow as hell...

not really...

Re: Level shading [Re: Slin] #295136
10/23/09 03:12
10/23/09 03:12
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
Originally Posted By: Slin
Originally Posted By: sPlKe
its just slow as hell. and i really mean slow as hell...

not really...


well... i've never seen a decent size level using shaders, not saying its slow or isnt just that, i dont know

Re: Level shading [Re: darkinferno] #295176
10/23/09 11:01
10/23/09 11:01
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
I think Slin's point is that Spike's comment is probably based on a issue the engine had a long time ago. I could be very wrong laugh

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Level shading [Re: JibbSmart] #295181
10/23/09 11:32
10/23/09 11:32
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Exactly JulzMighty, the problem is meant to be gone with A7, and I actually think that it really is. Also many people think that levelgeometry levels are bad, but lately they are the betterchoice in many terms and in nearly no way worse than the alternative (at the moment I can only think of LOD which I think isn't possible with it)

Re: Level shading [Re: Slin] #295666
10/26/09 19:35
10/26/09 19:35
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
The reason shaders on level geometry is usually slow is because of the clipping the engine uses.

For example, a simple sphere model is visible, you are so close it covers the entire screen. The model will only draw the faces visible with the shader.

When the level covers all visible screen areas, it sometimes draws other parts of the level nearby in the background as well, so it's drawing a lot more.

This is why proper occlusion clipping is so wonderful, it clips out all those background planes because it knows the one visible is blocking it. BSP uses regions of levels for clipping, so theirs still extras. ABT is sort of a mix, and better, but not close.


NOt that this info will really help you, but it's some info which is always nice... i think.


xXxGuitar511
- Programmer
Re: Level shading [Re: xXxGuitar511] #299777
11/26/09 21:27
11/26/09 21:27
Joined: Oct 2009
Posts: 4
F
FakeTruth Offline
Guest
FakeTruth  Offline
Guest
F

Joined: Oct 2009
Posts: 4
Hi all!
I think I have the same question.

here's my code in the .c file
Code:
BMAP* normalMap = "NormalMap.jpg";
BMAP* diffuseMap = "DiffuseMap.jpg";
MATERIAL* m_Normal ={
	skin1 = diffuseMap;
	skin2 = normalMap;
	skin3 = normalMap;
	effect="bump.fx";
}




And here's the shader (it's the default A7 bump.fx shader, but edited. I changed the entSkin's into mtlSkin's so I can specify it through the material definition)
Code:
// Lambert bump mapping
// (c) oP group 2008  Version 2.1

#include <bump_vs>
#include <phong>

//texture entSkin1;	// texture
//texture entSkin2;	// normal map or lightmap
//texture entSkin3;	// normal map on blocks
texture mtlSkin1;
texture mtlSkin2;
texture mtlSkin3;

sampler sBaseTex = sampler_state { Texture = <mtlSkin1>; MipFilter = Linear;	};
sampler sSkin2 = sampler_state { Texture = <mtlSkin2>; MipFilter = Linear;	};
sampler sSkin3 = sampler_state { Texture = <mtlSkin3>; MipFilter = Linear;	};


float3 DoDiffuse(bumpOut In,float3 Normal)
{
	float3 Diffuse = In.Diffuse1 * saturate(dot(normalize(In.Light1.xyz),Normal));
	Diffuse += In.Diffuse2 * saturate(dot(normalize(In.Light2.xyz),Normal));
	Diffuse += In.Diffuse3 * saturate(dot(normalize(In.Light3.xyz),Normal));
	return Diffuse * vecDiffuse.xyz;
}

float4 diffuseBump_PS(bumpOut In): COLOR
{
	float4 Base = tex2D(sBaseTex,In.Tex12.xy);
	float3 Normalmap = tex2D(sSkin2,In.Tex12.xy)*2-1;
   float3 Diffuse = DoDiffuse(In,Normalmap);	
	return Base * DoColor(Diffuse,In.Ambient);
}

float4 diffuseBumpLM_PS(bumpOut In): COLOR
{
	float4 Base = tex2D(sBaseTex,In.Tex12.xy);
	float4 Lightmap = tex2D(sSkin2,In.Tex12.zw);
	float3 Normalmap = tex2D(sSkin3,In.Tex12.xy)*2-1;
   float3 Diffuse = DoDiffuse(In,Normalmap);	
	return Base * DoLightmap(Diffuse,Lightmap,In.Ambient);
}

technique bump
{
	pass one
	{		
		VertexShader = compile vs_2_0 bump_VS();
		PixelShader = compile ps_2_0 diffuseBump_PS();
	}
}

technique bump_lm
{
	pass one
	{		
		VertexShader = compile vs_2_0 bump_VS();
		PixelShader = compile ps_2_0 diffuseBumpLM_PS();
	}
}

technique fallback { pass one { } }



In WED I have assigned the m_Normal material to a level block.

Now when I run it, I get this error:
#DEFAULT - normal or height map missing

where #DEFAULT is the default texture applied to the level block

When I look at the level block with the m_Normal material, it looks like crap. Also, I don't get this error when I apply the material to an entity.

Can anybody help me? frown


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