Is there a way to apply a shader to all entities ?

Posted By: ZZZgames

Is there a way to apply a shader to all entities ? - 07/14/06 21:50

Hey.
Is there a way to apply a shader to all entities that are displayed by the camera without having to attach the material manually to every entity?
And to map blocks?
Posted By: broozar

Re: Is there a way to apply a shader to all entiti - 07/14/06 22:00

jepp, d3d_automaterial (-->manual).
Posted By: ZZZgames

Re: Is there a way to apply a shader to all entiti - 07/14/06 22:43

Thanks DaBroozar ...
I achieved to apply the shader to one model file ....
According to the manual ,you have to name the shader as the model file or texture you want to apply the shader on ...
But does that mean i'd have to write 1 material per file i want to apply the shader on??
I wonder if i can write a list like"
material monster1_mdl,monster2_mdl,monster3_mdl,monster4_mdl
no??
Posted By: broozar

Re: Is there a way to apply a shader to all entiti - 07/14/06 23:20

example for geometry:

material nameOfTheWadTexture{
yourDefs;
}

starter shader_load{
d3d_automaterial=1;//lvl geo
effect_load(nameOfTheWadTexture,"yourFxFileWithTheShader.fx"); //apply fx file
nameOfTheWadTexture.effect=nameOfTheWadTexture2.effect=nameOfTheWadTexture3.effect [andSoForth];//same effect for all mats you define
wait(5);
}

PS: there is an entity.material pointer as well, so if you just want to apply one <c-script>-material to some ents (and not an fx-based material as posted above), you could just use ent1.material=ent2.material with the appropriate pointers.
Posted By: ZZZgames

Re: Is there a way to apply a shader to all entiti - 07/14/06 23:57

ok i got it .
Now i use something like that :

material model1name_mdl
{
effect="my_effect.fx";
}
material model2name_mdl
{
effect="my_effect.fx";
}
material modelXname_mdl
{
effect="my_effect.fx";
}
etc..etc..

Thats the fastest way i found for the moment.
Thanks for your answers.
Posted By: mk_1

Re: Is there a way to apply a shader to all entiti - 07/15/06 00:15

Crazy

Check the manual for ent_next. You can use the example with a little modification to achieve your goal.
Posted By: ZZZgames

Re: Is there a way to apply a shader to all entiti - 07/15/06 00:29

I have checked the manual .Cool !
This is an useful command..I havenot tryed it yet but it seems that it will work fine .
Thanks

Unfortunately the shader i use decreases a lot the framerate ...On my computer it goes down from 35 FPS to 20 FPS when i apply the shader to most of models.
I dont know how to fix that ...Perhaps i shouldnot use a shader.
Posted By: mk_1

Re: Is there a way to apply a shader to all entiti - 07/15/06 01:28

Perhaps you should optimize your shader.
What shader are you talking about anyways?
Posted By: ZZZgames

Re: Is there a way to apply a shader to all entiti - 07/15/06 10:54

I tryed the shader of the wiki " New Toon Shader".
Since i have no knowledge in shader coding,i have no clue how to optimize it ..
Posted By: mk_1

Re: Is there a way to apply a shader to all entiti - 07/15/06 13:57

nothin'
Use low poly models. The less vertices you have the fast the model is rendered.
Posted By: ZZZgames

Re: Is there a way to apply a shader to all entiti - 07/15/06 14:42

Too bad ,my models for player and enemies do around 2000 polygons each ....Another time maybe !
Posted By: Lion_Ts

Re: Is there a way to apply a shader to all entiti - 07/16/06 21:59

You needn't ent_next for that. use effect_load for material mat_model.
About complex model: use detailed texture with simpler model. This is common technique for all games (imitate self shadowing, small details on model, etc.)
© 2024 lite-C Forums