Xoliul

Member
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

125 Neutral

About Xoliul

  • Rank
    Newbie
  1. I've found the culprit. Looks like when I add a texcoord input from the application, it breaks the entire thing. Basically: [CODE] // input from application struct a2v { float4 position : POSITION; }; // output to fragment program struct v2f { float4 position : POSITION; float4 wposition : TEXCOORD0; }; [/CODE] to this: [CODE] // input from application struct a2v { float4 position : POSITION; half2 texCoord : TEXCOORD0; }; // output to fragment program struct v2f { float4 position : POSITION; half2 texCoord : TEXCOORD0; float4 wposition : TEXCOORD1; }; [/CODE]
  2. Hey Ashaman, I guess that's me yes hah. I've tried using the /LD switch but I didn't fix things. I did so many different compiles with different options so i can't remember what was wrong. I've progressed a bit, I'm basically re-building the code step by step, compiling it again and again and so far it has worked fine. I think I'm 85% of the way and it is working. I'm not even using the /LD switch at the moment.
  3. I've written a procedural noise shader. It's pretty heavy but it only serves to Render-To-Texture so that's fine. One big problem I have is that the compile time is pretty insane, so I'm trying to precompile it using FXC.exe. I have to use the June 2010 DX SDK because it's not an SM4.0 shader (my application, 3DS Max, is still D3D9). Now the problem with the assembly code that FXC generates, is that it doesn't work exactly the same as the uncompiled code. The values the noise functions generate are in a very different range, resulting in pretty much nothing visible. If my application compiles it with its own compiler, it works fine... This is a bit of a long shot, but would anyone know what is going wrong?
  4. I'm only talking from 3DS Max experience here, but it works fine with Max' DXSAS compiler. So it's not exactly true that this isn't possible in general. Have you looked at the example? I can't tell you for sure if it will work in the Xray engine, I don't know what you have tried exactly so far, but it might be worth the try to create a very simple shader and then compile an ASM version to see if the engine will take it. BTW, I'm curious what you are doing exactly in your shader that is so heavy and improves the quality so drastically?
  5. This is a long shot, but what about doing a "hybrid" precompiled version? Here's an example from someone that's been doing that for 3DS Max for a long time: http://www.poopinmymouth.com/3d/sdk/agusturinn-shader.zip It basically means you replace the actual vertex- and pixelshaders with compiled asm code, and then feed the variables back in as PixelShaderConstants and the like. (3DS Max requires this or you can't interface with it) I'm looking into this as well as i've got a 10-minute compile in 3DS Max, while the (incomplete) hybrid precompiled version loads instantly. It's a bit annoying to generate, I'm trying to contact the author of that example to see if he has a better way than manually doing it (which is a bunch of mindless copy paste work).
  6. Tokamak car physics

    Okay, I'm new here, pretty serious question to begin with. We're starting on a game project for school, which will be utilizing Tokamak physics? You'll be driving a car, so I need to do the car physics. I'll have Tokamak handle collision and integration of forces over time, and do the tire and suspension code myself, starting with the car example code that is available on their site. Now thing is, I want to fully understand this code before I start using and modifying it myself, yet I have some trouble with it. Here's what I have so far (posting all of the car control code so it's understandable): void CSampleCar::CarController(neRigidBodyController * controller) { neT3 body2World = carRigidBody->GetTransform(); carRigidBody->BeginIterateSensor(); neSensor * sn; neV3 force, torque; force.SetZero(); torque.SetZero(); s32 i = 0; while (sn = carRigidBody->GetNextSensor()) { f32 k = 6.0f; //spring constant f32 u = 0.8f; //damping constant if (i == 2 || i == 3) { k = 10.0f; } // add spring force f32 depth = sn->GetDetectDepth(); //gw.car.suspensionLength[i] = 1.0f - depth; suspensionLength[i] = 1.0f - depth; if (depth == 0.0f) { i++; continue; } //if (depth > 0.7f) // depth = 0.7f; neV3 groundNormal = sn->GetDetectNormal(); neV3 lineNormal = body2World.rot * sn->GetLineUnitVector(); neV3 linePos = body2World * sn->GetLinePos(); f32 dot = lineNormal.Dot(groundNormal) * -1.0f; //apparently unused ? //if (dot <= 0.7f) // continue; neV3 f = depth * lineNormal * -k ;//* dot; //get spring push force: force along normal, strength from spring compression (inverse) force += f;//add spring force to total wheel force vector neV3 r = linePos - carRigidBody->GetPos();//get normalised wheel offset torque += r.Cross(f);//add normal of spring force and normalised wheel offset to torque vector -> torque vector serves for // add damping force //GetVelocityAtPoint most probably requires a relative value from the rigid body's center f32 speed = carRigidBody->GetVelocityAtPoint(r).Dot(lineNormal); //dot product of linenormal and velocity at relative wheel offset for scalar speed value //speed is the car bodies speed along the sensor line's normal vector f = -speed * lineNormal * u; //inverse speed along sensor, dampened by dampening constant, along sensor line's normal. force += f; //add dampening force to suspension force torque += r.Cross(f);//apply dampening torque // add friction force neV3 vel = carRigidBody->GetVelocityAtPoint( sn->GetDetectContactPoint() - carRigidBody->GetPos() ); //get velocity at wheel/ground contactpoint vel.RemoveComponent(groundNormal); //RemoveComponent function code, copied from library source /* RemoveComponent (const neV3& V) { f32 dot = (*this).Dot(V); (*this) = (*this) - V * dot; } */ if (i == 0 || i == 1) { //steering vel.RemoveComponent(steerDir); } else { vel.RemoveComponent(body2World.rot[0]); //rear wheel always parallel to car body } f = vel; f.Normalize(); f *= -2.0f; if (i == 2 || i ==3) { f *= (1.0f - slide); } f[1] = 0.0f; force += f; r = sn->GetDetectContactPoint() - carRigidBody->GetPos(); torque += r.Cross(f); // driving force if (i == 2 || i == 3) // rear wheel { f = body2World.rot[0]; f *= accel; force += f; torque += r.Cross(f); } /* gw.car.displayLines[i][0] = linePos; gw.car.displayLines[i][1] = sn->GetDetectContactPoint(); */ i++; } // drag f32 dragConstant = 0.5f; neV3 vel = carRigidBody->GetVelocity(); f32 dot = vel.Dot(body2World.rot[0]); neV3 drag = dot * body2World.rot[0] * -dragConstant; force += drag; controller->SetControllerForce(force); controller->SetControllerTorque(torque); } Where I'm running stuck in trying to understand, is as soon as they start to use the neV3.RemoveComponent() function. I don't understand what excatly the result of this function is supposed to be, and I don't understand how these functions will create the friction forces. Also, why do they normalize the velocity vector afterwards ? I really want to understand the friction and grip part here, as this is where the demo is lacking most of all: the friction model will need a lot more elaboration in our project, so naturally I want to fully understand it before I start changing it. Hope somebody can help me out here, as I really don't have anybody I can ask this. [Edited by - Xoliul on February 20, 2008 2:18:12 PM]