 Home
 » Viewing Profile: Reputation: Lauris Kaplinski
Banner advertising on our site currently available from just $5!
1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!
Lauris Kaplinski
Member Since 02 Aug 2006Offline Last Active Feb 18 2013 02:33 AM
Community Stats
 Group Members
 Active Posts 271
 Profile Views 4,278
 Submitted Links 0
 Member Title Member
 Age 44 years old
 Birthday April 8, 1971

Gender
Male

Location
Estonia
#4985683 How can I put 2d sprites in a 3d world?
Posted by Lauris Kaplinski on 01 October 2012  02:37 AM
Unity Wiki page about billboard: http://wiki.unity3d.com/index.php?title=CameraFacingBillboard
#4982844 Guide to bad game design
Posted by Lauris Kaplinski on 23 September 2012  01:57 AM
#4980677 Reference& question
Posted by Lauris Kaplinski on 16 September 2012  12:14 PM
You probably meant 8 bytes.At end of code here, "10MbClass* Pobj" is 8bit in memory storage?
and "10MbClass& Robj" is how big? is reference taking same amount of space as pointer or?
And yes, internally references take the same amount of memory as pointers. Except of course in cases where compiler is able to optimize these out.
#4979404 View matrix forming
Posted by Lauris Kaplinski on 12 September 2012  12:32 PM
Your view matrix above transforms from world coordinate system to camera coordinate system.
Now u,v and w are camera axes represented in world coordinate system. Thus in your view matrix they form rows, not columns.
On the other hand the world axes represented in camera coordinate system do form the rows of view matrix.
#4978115 Perspective to Ortho Collision fails.
Posted by Lauris Kaplinski on 08 September 2012  04:37 PM
One at mouse position (x,y) and near plane (1)  this will be ray starting point if transformed to world space
Another at mouse position (x,y) and far plane (1)  this will be ray endpoint if transformed to world space
Now after transforming these points to world space use these to construct your view ray.
#4977753 Trouble combining two projection spaces?
Posted by Lauris Kaplinski on 07 September 2012  11:53 AM
Try hardcoding linestrip coordinates (so it lies on the ground plane)  what happens?
#4977619 Effective way to detect whether my 3D cubes are outside the 2D screen boundar...
Posted by Lauris Kaplinski on 07 September 2012  07:37 AM
1. Extract the frstum sides (4 planes)  onetime operation
2. Find the distance of cube center from all planes (4 x cheap operation)
3. If any distance is > diagonal/2 discard that cube
It may have few extra operations compared to your method and it slightly overestimates cube size but I doubt any of these are serious problems.
If you want the absolute least amount of tests and your cubes have linear trajectories then precalculate the time when they go offscreen (using either the above method or the exact method), store the value for each generated cube and discard these as soon as the system time will become greater than their lifetime.
#4977614 blender cutscenes
Posted by Lauris Kaplinski on 07 September 2012  07:21 AM
If you only need object placements, basic textures, lights and camera movement you may try using some common export format, like FBX. But you still have to find/implement the loader of that specific file format, implement animation system and so on.
#4977544 Stuck in late development
Posted by Lauris Kaplinski on 07 September 2012  03:14 AM
1. Admit, that it is not hopeless
2. If you wrote the code yourself, take some time off. Work on something else. Rest.
3. Take a fresh look at your codebase.
4. Write down the structure of your code.
5. Start writing down bugs. Assign priorities to them.
6. Work becomes manageable.
#4977108 Coding gradiant transitions
Posted by Lauris Kaplinski on 06 September 2012  01:34 AM
As a test you may try to add some lowintensity highfrequency (pixel) noise to you color values before sending these to framebuffer. Or even better  add the noise before smapling gradient values so the bands will be smeared aout a bit.
#4976589 being realistic
Posted by Lauris Kaplinski on 04 September 2012  04:23 PM
First  yes, it is possible. But it is hard work  a bit easier if you use engine, but still huge amount of work.I wanted to know if it is possible for a single person to make a game in sdl and or opengl and with this i mean a big game not just a pong or something like that. Should i use a game engine instead?? I want to make a nice looking game, i prefer 2d but i dont dislike 3d. I also like to code so I wouldn't like to use one of those engines where you don't code at all.
I feel that even though engines help a lot they also limit what you can do and also even though I like the flexibility that using sdl and opengl gives you but it seems to hard and maybe I just can't find any good one but everytime I try to look for projectsmade in sdl, sfml, opengl and directx they all look horrible and boring.
I think that if you want to make big game then creating art will become bigger task than code. Of course it depends on the kind of game you are building  if you are clever, you can create very rich environments from simple elements  like Minecraft. But in any case you need highquality art for nice looking game. If you are not modeler/pixel artist/background artist then learning to create it will take very long time.
#4929285 Height on triangles using 4 points
Posted by Lauris Kaplinski on 08 April 2012  05:25 AM
Oh, yes of course ;)If Y is my up vector, shouldn't i be using x and z to find the distance between the points?
#4929008 Height on triangles using 4 points
Posted by Lauris Kaplinski on 07 April 2012  04:15 AM
I should have said "squared distance between two 2D points :)Thanks for the reply, i'm understanding most of it. Just what do u mean by
Just use squared distance of 2D vectors (ignore Z)
To determine where your point lies, you have to project it to XY plane. I.e. if you have player position P=(Px,Py,Pz), make it 2D vector P'=(Pz,Py) and test, int which triangle it lies by finding the its distance from 2D vectors P1'=(P1x,P1y) and P2'=(P2x,P2y)
And instead of calculating and comparing actual distances between P and P1 or P2, you can compare squared distances. I.e. instead of
L = sqrt ((Px  P1x)*(Px  P1x) + (PyP1y)*(PyP1y))
You can leave out square root and use
Lsquared = (Px  P1x)*(Px  P1x) + (PyP1y)*(PyP1y)
Now this is pointless optmization  but it does not hurt.
#4928902 Height on triangles using 4 points
Posted by Lauris Kaplinski on 06 April 2012  03:13 PM
 Test, whether point is inside triangle
 Construct plane from three points
 Find lineplane intersection point
1. As you already know in which grid square your point lies, you can test whether it is closer to p1 or p2. Just use squared distance of 2D vectors (ignore Z)
2. Construct plane from three points (plane is given as normal vector Pn and scalar value Pd). I use P0, P1 and P3 as example triangle.
n = (P1  P0) cross (P3  P0)
Pn = normalize (n)
Pd = Pn dot P0
3. Find lineplane intersection point (line is given as point Lp and direction Ld, intersection point is P)
den = Pn dot Ld
If den is 0 then line is parallel to plane
t = (Pn dot Lp + Pd) / den
P = Lp + t * Ld
In your case you can use line, that starts from same realistic place  say 10m above the head of character and goes directly downwards  i.e. Lp = (playerX, playerY, playerLastZ + 10), Ld = (0,0,1).
#4928762 Collinear 3d Points
Posted by Lauris Kaplinski on 06 April 2012  06:43 AM
EDIT: Another method is checking if the dot product of (P2P1) and (P3P1) is either 1 or 1.
You probably meant normalize(P2  P1) . normalize(P3  P1)