tjheldna Posted May 14, 2012 Share Posted May 14, 2012 Hi All, I need a little direction on how to fade out a model over time, is this done via a shader? or is there some other method? (don't know a whole lot about shaders as of yet). This would be great for fading out dead characters etc instead of just deleting them as I am doing currently. Cheers! Quote Link to comment Share on other sites More sharing options...
Rick Posted May 14, 2012 Share Posted May 14, 2012 This is one of the things I hate about the forward renderer. The model has to be in another world. If you are using the framework there is a transparency world created for you already. You have to switch to that world, load your object, then you can switch back. The thing to remember is that this other world won't care the same lighting unless you make it the same as your main world. Also if you load multiple instances of the same model all in the same world, fading 1 will fade all. All in all it's a mess I think. If there were a way to do this with a shader it would be 100% better, but I'm not sure of the challenges in that alone. Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted May 14, 2012 Share Posted May 14, 2012 ..shader is best way to do it..not just with transparency, but make character disappear in to 'ash', or erode, and so on..other way is to control color value, and gradually cut it down to '0'. That however depending on your renderer setup so i cant say for sure.. Quote Link to comment Share on other sites More sharing options...
Benton Posted May 14, 2012 Share Posted May 14, 2012 Right, because deferred renderer handles transparency differently... Quote Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D Link to comment Share on other sites More sharing options...
tjheldna Posted May 15, 2012 Author Share Posted May 15, 2012 Thanks for the advice guys, i'll give it a crack with a shader. I may need a little more help, but I'll see how I go first. Cheers! Quote Link to comment Share on other sites More sharing options...
shadmar Posted May 15, 2012 Share Posted May 15, 2012 You still have to have the mesh in the transparency world when using shaders. So assuming you are using fw, it should go someting like this (not tested) SetWorld(fw.transparency.world) model = LoadMesh("abstract::model.gmf") SetWorld(fw.main.world); myfade=0; material=LoadMaterial("abstract::")) shader=GetMaterialShader(material) In your run loop : myfade=myfade+0.001 SetShaderFloat(shader,"myfade",myfade) In mat file have blend=alpha In your shader (frag file) add before main(): uniform float myfade=0.0; find : gl_FragData[0] = diffuse; Add below gl_FragData[0].a-=clamp(myfade,0,1); It should now alpha fade by 0.001 per flip() (in theory) Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
tjheldna Posted May 24, 2012 Author Share Posted May 24, 2012 Thanks shadmar. The community project has kept me too busy to check this out, but I will. That looks to me like it will work. Many Thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.