Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by LoLJester

  1. The Vert and Pix shaders: void uvAnimFeatureHLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { MultiLine *meta = new MultiLine; if(fd.features[MFT_UseInstancing]) { // We pass the uvOffset to the pixel shader via // another output register. // // TODO: We should see if we can share this register // with some other common instanced data. // ShaderConnector *conn = dynamic_cast( componentList[C_CONNECTOR] ); Var *out_UV_Offset = conn->getElement( RT_TEXCOORD ); out_UV_Offset->setStructName( "OUT" ); out_UV_Offset->setName( "uvOffset" ); out_UV_Offset->setType( "float" ); ShaderConnector *vertStruct = dynamic_cast( componentList[C_VERT_STRUCT] ); Var *inst_UV_Offset = vertStruct->getElement( RT_TEXCOORD, 1 ); inst_UV_Offset->setStructName( "IN" ); inst_UV_Offset->setName( "inst_uvOffset" ); inst_UV_Offset->setType( "float" ); mInstancingFormat->addElement( "uvOffset", GFXDeclType_Float, inst_UV_Offset->constNum ); meta->addStatement( new GenOp( " @ = @; // Instancing!\r\n", out_UV_Offset, inst_UV_Offset ) ); } getOutTexCoord("texCoord", "float2", true, false, meta, componentList); output = meta; } //------------------------------------------------------------------------------------------------------- void uvAnimFeatureHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { //Sorin D: Get the uvOffset constant. Var *uvOffset = NULL; if(fd.features[MFT_UseInstancing]) uvOffset = getInTexCoord( "uvOffset", "float", false, componentList ); else { uvOffset = (Var*)LangElement::find( "uvOffset" ); if(!uvOffset) { uvOffset = new Var(); uvOffset->setType( "float" ); uvOffset->setName( "uvOffset" ); uvOffset->uniform = true; uvOffset->constSortPos = cspPotentialPrimitive; } } MultiLine *meta = new MultiLine; //Sorin D: Get the texture coordinate UV0. Var *inUV = getInTexCoord( "texCoord", "float2", true, componentList ); //Sorin D: Calculate and set the UV's offset. meta->addStatement(new GenOp( " @ = float2( @.x, @.y + @ );\r\n", inUV, inUV, inUV, uvOffset)); output = meta; }
  2. No. I'm on the road right now, always on the move. :) I will double check if everything gets initialized properly. I basically looked at how WindDeform and Visibility do it. Is there a way to Debug the Shaders through Torque?
  3. Ok. I got it to somewhat work, but strangely only in Debug. For some odd reason, I can't get the shader to work in Release or Optimized Debug mode. Is there something I'm missing?
  4. Thanks, Azaezel! It looks like something that might just work.
  5. Anybody, please? I'm sure there's been a situation similar to this that someone must have encountered. Nobody's ever worked with the UVs in T3D before? I'm tempted to animate the tracks themselves, but they are already animated for suspension.
  6. Hi Azaezel, the video looks pretty good. I can see what you did, but the code seems to only apply to quads that you create from point A to point B. How do I apply this to sceneObjects that are already mapped? What I'm trying to do is modify the positioning of a texture already mapped to the tank tracks. I see that "tverts" is assigned the UVs of the mesh in assembleMesh() and assembleShape(), but once I modify it, where is it updated? Am I even on the right path?
  7. Hello, I'm trying to create a Tank vehicle with animated UV tracks. Material animation is not an option as I'm to understand that Materials are not instanced per mesh, but one material applies to all meshes that have this material mapped to them. Is it "tverts" that I must modify for the UV to displace in real time?
  8. In WaterBlock(customName) { useOcclusionQuery = 1; // stutter useOcclusionQuery = 0; // no stutter }
  9. Thank you Azaezel, but that doesn't fix the problem. I don't know if this is related or not, but there also seems to be a stutter with scene objects that have multiple LODs. I see that water also uses LODs.
  10. @Azaezel: I'll try that fix. @JeffR: No, not just from under water. The moment the reflection of the water gets into view after being occluded by terrain, there's stutter.
  11. It does it in 3.8 RC, as well. Very subtle, though. If you put the camera under the water, in a level with only water and terrain, and you move the camera upwards really fast facing the sky, you can see a small stutter/freeze. Same thing happens in 1.2. The more populated is the level, the more obvious the stutter gets. It only happens the first couple of times you speed across the level. It seems to settle after.
  12. Hi JeffR, It happens when driving, flying, or moving the camera really fast in the World Editor. I'm using 1.2 only. Never tried it on 3.8, as my project's majority features currently only work on 1.2. A port will be done later on after initial release. So, I'd like to have this work in 1.2 for now, if possible.
  13. If I turn off "useOcclusionQuery" everything is fine and smooth. I'm using T3D 1.2. Anybody know how to fix this? I have a nVidia GTX 780M card with ample of memory.
  • Create New...