Aller au contenu

Photo

Dynamic loading of custom shader


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
mtottenh

mtottenh
  • Members
  • 5 messages
Essentially as part of a mod I'm trying to implement a combat damage indicator similar to that of recent FPS games whereby the screen tints red when you get hit.

I thought that one way to implement this would be to create a custom pixel shader, similar to that of the fade blur shader that comes with the game, and have it load once damage was taken and then unload once the players health regenerated.

Is there some sort of function call which allows you to do this? or are all shaders hardcoded into the engine.

Alternitively if anyone knows of a way of doing this without using custom built shaders could you let me know?

Modifié par mtottenh, 05 novembre 2010 - 08:43 .


#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
AFAIK, you cannot load/unload shaders at run-time.



You can try using the SetAtmosphere and playing around with the parameters passed to it.

#3
FergusM

FergusM
  • Members
  • 460 messages
I'm not familiar with the details of shaders, but is it the same thing as a full screen effect/frame buffer effect? I have a feeling there might be a distinction, but you do mention the fade effect, which is a frame buffer effect.

To manipulate these, you have to enable it in the .lvl file by putting it as one of the frame buffer effects in the level properties. Then, in game you can call a script that uses FB_SetEffectEnabled and FB_SetEffectResource to enable/disable/tweak the effect.

This means you have to enable the effect for every .lvl file though, and re-export them. So it's not an option at all for the original campaign.

Modifié par FergusM, 06 novembre 2010 - 02:15 .


#4
mtottenh

mtottenh
  • Members
  • 5 messages
Thanks for the suggestions guys.

I'll have a play around with the frame buffer effects and see if I can get something to work.



hopefully It wont have too much of a performance hit.

#5
FollowTheGourd

FollowTheGourd
  • Members
  • 572 messages
I'm not sure if you can add new shaders, but if you want some starting point, there's this thread: http://social.biowar.../index/213980/1