Topic: Passing variable value to shader question?
Hi. Is it possible by some way to pass variable to shader by script? For examle time.
You are not logged in. Please login or register.
Hi. Is it possible by some way to pass variable to shader by script? For examle time.
Not right now, but it can be done in c++ :
float time = 0.0f;
MMaterial * material = mesh->getMaterial(0);
if(material)
{
MFXRef * FXRef = material->getFXRef();
if(FXRef)
{
unsigned int fxId = FXRef->getFXId();
render->bindFX(fxId);
// send uniform variable
render->sendUniformFloat(fxId, "time", &time);
render->bindFX(0);
}
}
Or you can use a trick :
- in Blender, animate a material variable you don't use in your shader : "MaterialShininess" for example
- use "uniform float MaterialShininess;" as your time variable
So as far as i understand i have to create a "Game.ll" and create a behaviour?
One more question-how do you get "mesh" and "render"?
Last edited by Skywriter (2014-07-17 14:49:40)
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.