View Full Version : GAME engine + non-polygonal 3d collision detection project
Georgy
05-02-2008, 04:22 PM
latest version here: http://www.igrodel.ru/tdg3d
This is the new release of Collision Detection engine. It is better than CDNR1 (released in 2006). Improved perfomance and less memory requirements, here it is: CDNR2ALPHA v2008-2-5: http://www.igrodel.ru/index.php?p=1202226872
http://www.igrodel.ru/upload/cdnr2alpha-2008-2-5-1.jpg http://www.igrodel.ru/upload/cdnr2alpha-2008-2-5-2.jpg
http://www.igrodel.ru/upload/cdnr2alpha-2008-2-5.7z (245kb)
waran
05-02-2008, 04:53 PM
I browsed your code a bit and here are my tips :D
Avoid so much divisions. Float divs are slow like hell.
Slow:
vx:=vx/vlen;
vy:=vy/vlen;
vz:=vz/vlen;
Damn lot faster:
vlen := 1/vlen;
vx:=vx*vlen;
vy:=vy*vlen;
vz:=vz*vlen;
Also check if you are using any sqrt() for your bounding circle/sphere
code - its unnecessary!
Maybe you can use further math-tricks to speed it up a lot.
To success!
Georgy
20-02-2008, 01:13 PM
small update: the same engine sources with old demo included
http://www.igrodel.ru/upload/myengine-2008-2-20.zip (771kb)
chronozphere
20-02-2008, 03:13 PM
Also check if you are using any sqrt() for your bounding circle/sphere
code - its unnecessary!
Hmmm... that makes me kinda curious. How can you do circle collision detection without using the square root :?
I thought the only way was to use pythagoras. Can you explain how your way works? :razz:
waran
20-02-2008, 03:19 PM
Pythagoras said: c¬? = a¬? + b¬?.
If you want to find out c, you need the root. But
that isn't exactly what you want to know...
type
circle = record
x, y, r: single;
end;
function collide(a, b: circle): boolean;
begin
result := sqr(a.x-b.x) + sqr(a.y-b.y) <= sqr(a.r+b.r);
end;
Just quad the radii and compare :)
Georgy
22-02-2008, 12:58 PM
this code (mycollisiontrick.pas) runs only 1 time for each object in frame
it's better to optimise 2d code in collisioncircle/docollision array layered heightmap algorithm (mydepthcollision.pas) first.
chronozphere
22-02-2008, 04:35 PM
@waran: that's a neat trick...You dont need to know the actual length between the circle centers. why didn't i thought about this before. :razz:
Georgy
13-03-2008, 12:51 PM
New release with debug output:
http://www.igrodel.ru/tdg3d/tdg-4.jpg
http://www.igrodel.ru/tdg3d/tdg-3.jpg
http://www.igrodel.ru/tdg3d/tdg-2.jpg
http://www.igrodel.ru/tdg3d/tdg-1.jpg
http://www.igrodel.ru/tdg3d/tdg-2008-3-13.zip
Georgy
21-03-2008, 12:53 PM
v 2008/3/21
- new more powerful functions added
- added post-processing shader functions
- better GLSL shader support
- collision detection improvements
- fixed material management errors
- some changes in nft_export.py for Blender 2.45
Download:
http://www.igrodel.ru/tdg3d/tdg-2008-3-21.zip
Screenshots:
http://www.igrodel.ru/tdg3d/tdg-7.jpg
http://www.igrodel.ru/tdg3d/tdg-6.jpg
Georgy
05-04-2008, 12:43 PM
Added screen space ambient occlusion support:
http://www.igrodel.ru/tdg3d/tdg-8.jpg
v 2008/4/5
- added simple dynamic Ambient Occlusion example
- added cameraPosition flag to shader parser
- few bugs fixed
arthurprs
05-04-2008, 04:24 PM
looks good, you are developing only the engine or a game?
Georgy
06-04-2008, 02:15 AM
only the engine
I want develop game engine and better graphics engine. First make some tech demos and then maybe start some real game project.
Georgy
07-04-2008, 09:54 AM
v 2008/4/7
- added TBN support
- added parallax mapping example
- added temporary uvscalehack global variable
- fixed ssao shader
http://www.igrodel.ru/tdg3d/tdg-9.jpg
Georgy
13-07-2008, 04:35 AM
Depth Corrected Parallax Mapping shader for TDG3D:
[VP test]
varying vec3 lightVec;
varying vec3 eyeVec;
varying vec3 et;
varying vec3 V_M;
varying vec4 glVertex;
varying vec2 glTexCoord0;
//*> TBNtangent Tangent
attribute vec3 Tangent;
//*> TBNnormal Normal
attribute vec3 Normal;
//*> TBNbinormal BiNormal
attribute vec3 BiNormal;
mat3 glNormalMatrixInverse(void)
{
return mat3( gl_ModelViewMatrix[0][0], gl_ModelViewMatrix[1][0], gl_ModelViewMatrix[2][0],
gl_ModelViewMatrix[0][1], gl_ModelViewMatrix[1][1], gl_ModelViewMatrix[2][1],
gl_ModelViewMatrix[0][2], gl_ModelViewMatrix[1][2], gl_ModelViewMatrix[2][2] );
}
void main(void)
{
glTexCoord0 = gl_MultiTexCoord0.st;
glVertex = gl_Vertex;
V_M = normalize(-glNormalMatrixInverse() * gl_ModelViewMatrix[3].xyz - glVertex.xyz);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
vec3 t = normalize(gl_NormalMatrix * Tangent);
vec3 b = normalize(gl_NormalMatrix * BiNormal);
vec3 n = normalize(gl_NormalMatrix * Normal);
vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);
vec3 tmpVec = gl_LightSource[0].position.xyz - vVertex;
lightVec.x = dot(tmpVec, t);
lightVec.y = dot(tmpVec, b);
lightVec.z = dot(tmpVec, n);
tmpVec = -vVertex;
eyeVec.x = dot(tmpVec, t);
eyeVec.y = dot(tmpVec, b);
eyeVec.z = dot(tmpVec, n);
}
[FP test]
//*> sampler2D 0 colorMap
uniform sampler2D colorMap;
//*> sampler2D 1 heightMap
uniform sampler2D heightMap;
//*> sampler2D 2 normalMap
uniform sampler2D normalMap;
varying vec3 lightVec;
varying vec3 eyeVec;
varying vec3 V_M;
varying vec4 glVertex;
varying vec2 glTexCoord0;
const float howmuch = 1.5;
const float invRadius = 0.0005;
void main (void)
{
float distSqr = dot(lightVec, lightVec);
float att = clamp(1.0 - invRadius * sqrt(distSqr), 0.0, 1.0);
vec3 lVec = lightVec * inversesqrt(distSqr);
vec3 vVec = normalize(eyeVec);
float height = texture2D ( heightMap, glTexCoord0.xy ).b;
float h = 0.03 * (1.0-height) - 0.015;
vec2 tex = glTexCoord0.xy - vVec.xy * h * howmuch / vVec.z;
vec4 base = texture2D(colorMap, tex);
vec3 bump = normalize( texture2D(normalMap, tex).xyz * 2.0 - 1.0);
float diffuse = max( dot(lVec, bump), 0.0 );
vec4 vertex = glVertex + vec4(2.0*height * V_M, 0.0);
vec4 p = gl_ModelViewProjectionMatrix * vertex;
gl_FragColor = vec4( base.rgb*diffuse*att,1.0 );
gl_FragDepth = 0.5 * (p.z / p.w + 1.0);
}
This shader alters OpenGL depth buffer to make parallax effect more realistic. Enjoy!
JSoftware
13-07-2008, 02:48 PM
Screenshots?... :D
Firlefanz
14-07-2008, 06:44 AM
The downloads all don't work?
Is there a mesh to mesh collision function included? :wink:
Thanks,
firle
PS: Could download it now from the website. Interesting stuff. Too bad all the comments are in russian. :wink: And too bad it is OpenGL, but thanks anyway :)
Georgy
15-07-2008, 02:44 AM
Yes, functions included:
ObjectToLevelCollision(0,1, variablesElapsedTime);
ObjectToLevelCollision(2,1, variablesElapsedTime);
ObjectToObjectCollision(0,2);
0,2 - object1,object2
1 - level
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.