|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Need more functions in UVAnimationHi,
The 'uvanimated alpha' shader was implemented as uv coordinates a linear relation with Time. (see shader:shaders.fx vsUVAnimColor) vsOut.uv0 = vsIn.uv0 + (Velocity.xy * Time); Sometimes we need the uv-animation be a little more complicated, e.g. timing controlled by program; uv rotation. which need a texture transformation. I'm using nmaxtoolbox. I found that some codes about texture transformation in nebula2 has been quoted. I tried to make the following changes to see uv-ani working. a, in nMaterialNode::RenderShader, enable the textureTransform codes ==code=begin============================ // invoke shader manipulators if (this->GetNumAnimators() > 0) { this->InvokeAnimators(nAnimator::Shader, renderContext); shader->SetParams(this->shaderParams); // FIXME: better to check whether any nUvAnimator exist if (!gfxServer->GetHint(nGfxServer2::MvpOnly)) { // set texture transforms n_assert(nGfxServer2::MaxTextureStages >= 4); static matrix44 m; this->textureTransform[0].getmatrix44(m); gfxServer->SetTransform(nGfxServer2::Texture0, m); this->textureTransform[1].getmatrix44(m); gfxServer->SetTransform(nGfxServer2::Texture1, m); } } ==code=end============================= b, in renderpath xml change the SceneOpaque.alpha.alpha_uvanimation.mvpOnly to "No" ==code=begin============================ <Sequence shader="alpha_uvanimation" technique="tUVAnimationAlpha" firstLightAlpha="Yes" mvpOnly="No" /> ==code=end============================= c, export vector3(u,v,w) instead of vector2(u,v) as uveular and export (this changes a lot ralated codes both in nmaxtoolbox and in nebula2) then I got the uv-animation can play in nviewer. But the direction and position are different from within 3dsmax, which rotates (use the w component) around the center of texture. The nUvAnimatior seems never used unless I make those changes. How to use the nUvAnimator? ps. Sorry for my poor English. Regard, kaikai ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Need more functions in UVAnimationFor the c), the guy who provided the uv animation patch also provided the patch
of nUvAnmator which has vector3(u,v,w) not vector2(u,v) as you've mentioned for its parameter to make it possible to export rotation of a texture. But we did not committed that stuff for the reason of compatibility between community's CVS and RL's. And now, is that time to change? :) Cheers, Kim, Hyoun Woo ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
Re: Need more functions in UVAnimation2006/10/25, Kim, Hyoun Wo <kimsama@...>:
> For the c), the guy who provided the uv animation patch also provided the patch > of nUvAnmator which has vector3(u,v,w) not vector2(u,v) as you've mentioned for > its parameter to make it possible to export rotation of a texture. > > But we did not committed that stuff for the reason of compatibility between > community's CVS and RL's. > > And now, is that time to change? :) Wish it to be. And also, max has the scale and rotation center over the center of the texture. The nebula2's transfrom33 does not match the specialties, so I make this change in nMaterialNode. ==code=begin========================== //------------------------------------------------------------------------------ /** Perform per-instance rendering of shader. This should just apply shader parameters which may change from instance to instance. */ bool nMaterialNode::RenderShader(nSceneServer* sceneServer, nRenderContext* renderContext) { nShader2* shader = this->refShader; nGfxServer2* gfxServer = nGfxServer2::Instance(); // FIXME FIXME FIXME // THIS IS A LARGE PERFORMANCE BOTTLENECK! // NEED TO SPLIT SHADER PARAMETERS INTO STATIC "INSTANCE SET" PARAMETERS // AND LIGHTWEIGHT "PER-INSTANCE" PARAMETERS WHICH CAN BE ANIMATED!!! n_assert(sceneServer); n_assert(renderContext); // invoke shader manipulators if (this->GetNumAnimators() > 0) { this->InvokeAnimators(nAnimator::Shader, renderContext); shader->SetParams(this->shaderParams); // FIXME: better to check whether any nUvAnimator exist if (!gfxServer->GetHint(nGfxServer2::MvpOnly)) { // set texture transforms n_assert(nGfxServer2::MaxTextureStages >= 4); static matrix44 m; // >>>HERE<<< is the change //this->textureTransform[0].getmatrix44(m); for (int i = 0; i < 2; i++) { if (this->textureTransform[i].isdirty()) { static matrix33 m3; const vector2 &pos = this->textureTransform[i].gettranslation(); const vector2 &scale = this->textureTransform[i].getscale(); const vector3 &eular = this->textureTransform[i].geteulerrotation(); m3.ident(); m3.translate(vector2(-.5f - pos.x, pos.y - .5f)); m3.scale(vector3(scale.x, scale.y, 1)); m3.rotate_x(eular.x); m3.rotate_y(eular.y); m3.rotate_z(eular.z); m3.translate(vector2(.5f, .5f)); // HACK: set dirty to false directly this->textureTransform[i].setdirty(false); } this->textureTransform[i].getmatrix44(m); gfxServer->SetTransform(nGfxServer2::TransformType(nGfxServer2::Texture0 + i), m); } } } // set shader override parameters from render context (set directly by application) shader->SetParams(renderContext->GetShaderOverrides()); return true; } ==code=end=========================== by applying the change, transform33 also need to change a little. change eular from vector2 to vector3, and add a setdirty() method. > > Cheers, > > Kim, Hyoun Woo Sincerely, kaikai ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 *** NOTE: To reply to the list use "reply to all", *** *** to reply direct to the sender use "reply" *** _______________________________________________ Nebuladevice-discuss mailing list Nebuladevice-discuss@... https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss |
|
|
|
| Free Forum Powered by Nabble | Forum Help |