
Moderators: Sascha Willems, walaber
For years, I struggled with vehicle tires never behaving satisfactorily. Instead of using the Pacejka tire model, I went with the analytical brush model, but even then, the results weren’t great.
I had to “fake” the tire lateral and longitudinal stiffness to get reasonably traction, and that was kind of a black art magic.
ndScopeSpinLock Lock(m_lock);
ndFloat32 param = m_timeAccumulator / descreteStep;
m_manager->m_renderer->InterpolateTransforms(param);
JoeJ wrote:Did you get it to compile Joe?
Otherwise nice and looks better.
Oh, and i would prefer an environment map with just a sky. Trees and stuff forces your brain to make hopeless attempts on distance estimate
Simple ai vehicle video exemple:
https://www.youtube.com/watch?v=hNoGS_H76Oc
And you get a easy to control for game AI vehicle.
JoeJ wrote:The reflections - well, it's not robust and causes all kinds of flicker and distraction. Maybe that's not the impression you want to make. I would actually remove them or at least turn off by default.
ndRenderPrimitive::ndDescriptor descriptor(render);
descriptor.m_collision = shape;
descriptor.m_mapping = ndRenderPrimitive::m_box;
ndRenderPrimitiveMaterial& material = descriptor.AddMaterial(render->GetTextureCache()->GetTexture(ndGetWorkingFileName("wood_1.png")));
material.m_specular = ndVector::m_zero;
material.m_reflection = ndVector::m_zero;
void ndRenderPassShadowsImplement::RenderScene(const ndRenderSceneCamera* const camera)
{
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_frameBufferObject);
glDisable(GL_SCISSOR_TEST);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClear(GL_DEPTH_BUFFER_BIT);
//glPolygonOffset(GLfloat(1.0f), GLfloat(1024.0f * 8.0f));
glPolygonOffset(GLfloat(1.0f), GLfloat(1024.0f * 32.0f));
glEnable(GL_POLYGON_OFFSET_FILL);
In fact this is so out of control that now you see different Xbx formal. This is so ridiculous that I see now fbx unreal, fbx unity, fbx max, fbx blender, and they are incompatible.
JoeJ wrote:I can pick it up, then it begins to move. So maybe it's something about sleeping. I'll figure it out...
ndModelArticulation::ndNode* const modelRoot = model->AddRootBody(cartBody);
modelRoot->GetBody()->SetSleepAccel(modelRoot->GetBody()->GetSleepAccel() * ndFloat32(0.1f));
const char* ndRenderShaderCache::m_directionalDiffuseShadowPixel =
R""""(
#version 450 core
layout(binding = 0) uniform sampler2D texture0;
layout(binding = 1) uniform sampler2D shadowMapTexture;
layout(binding = 2) uniform samplerCube environmentMap;
uniform vec3 diffuseColor;
uniform vec3 specularColor;
uniform vec3 reflectionColor;
uniform vec3 directionalLightAmbient;
uniform vec3 directionalLightIntesity;
uniform vec3 directionalLightDirection;
uniform float specularAlpha;
uniform mat4 directionaLightViewProjectionMatrix[4];
uniform vec4 shadowSlices;
[color=#FF0040]// fix for shadow acne
uniform vec4 shadowBias; [/color]
in vec4 worldPosit;
in vec3 posit;
in vec3 normal;
in vec2 uv;
out vec4 pixelColor;
// implement a simple Blinn model
void main()
{
vec3 normalDir = normalize (normal);
// calculate emisive, just a constant;
vec3 emissive = diffuseColor * directionalLightAmbient;
// calculate Lambert diffuse component
float diffuseReflection = max (dot (normalDir, directionalLightDirection), 0.0);
vec3 diffuse = diffuseColor * directionalLightIntesity * diffuseReflection;
// calculate Blinn specular component
vec3 cameraDir = - normalize(posit);
vec3 blinnDir = normalize(cameraDir + directionalLightDirection);
float reflectionSign = (diffuseReflection >= 0.01) ? 1.0 : 0.0;
float specularReflection = reflectionSign * pow(max (dot (normalDir, blinnDir), 0.0), specularAlpha);
vec3 specular = specularColor * directionalLightIntesity * specularReflection;
vec3 color = specular + diffuse;
// calculate the shadow tile
int index = 4;
float zbufferDepth = gl_FragCoord.z;
if (zbufferDepth < shadowSlices.w)
{
index = 3;
if (zbufferDepth < shadowSlices.z)
{
index = 2;
if (zbufferDepth < shadowSlices.y)
{
index = 1;
if (zbufferDepth < shadowSlices.x)
{
index = 0;
}
}
}
}
if (index < 4)
{
vec4 pointInDepthMapSpace = directionaLightViewProjectionMatrix[index] * worldPosit;
// this chek will never work for all cacade maps because
// each mapp represent a diffrent resoltions.
// To fix this the code needd to pass an array of zbiaz for each shadow map, for now just use a constant value
pointInDepthMapSpace.z = pointInDepthMapSpace.z - 0.005f;
//pointInDepthMapSpace.z = clamp (pointInDepthMapSpace.z, 0.0, 1.0);
float textDepth = texture(shadowMapTexture, vec2(pointInDepthMapSpace)).x;
if (textDepth < pointInDepthMapSpace.z)
{
color = vec3(0.0, 0.0, 0.0);
}
}
// calculate reflection
vec3 reflectionDir = normalDir * (2.0 * dot(cameraDir, normalDir)) - cameraDir;
vec3 reflection = directionalLightAmbient * reflectionColor * vec3(texture(environmentMap, reflectionDir));
// add all contributions
color = color + emissive;
color = color * vec3 (texture(texture0, uv));
color = color + reflection;
pixelColor = vec4(color, 1.0);
}
)"""";
Users browsing this forum: No registered users and 85 guests