 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
#4928286 Collada vertex format and creating Terrain
Posted by Lauris Kaplinski on 04 April 2012  01:57 PM
Instead I'd suggest simply walking through all vertices, rounding their X & Y (maybe scaled by sme factor, if your grid step is not exactly 1) coordinates to nearest integer (thus getting array coordinates) and saving Z as the elevation at that point.
#4927842 Bone animation and skinning
Posted by Lauris Kaplinski on 03 April 2012  05:36 AM
The vertex transformation is done the following way:
Let matrix B2S be the rest (bind) global transformation of bone.
Let matrix P2S be the rest (bind) global transformation of the parent of given bone
Let matrix AB2P be the animated local transformation of bone
Let V be untransformed vertex and V' animated vertex
Then
V' = (P2S * AB2P * B2S(1))
The trick is to precalculate everything you can  B2S(1) can be calculated once for bone, P2S * AB2P can be calculated once for animation frame
Now, if you have more than one bone transforming given vertex you just have to calculate weighted average of all transformations (i.e. weighted average of transformed vectors).
How to best do that in vertex shader depends on shader model used. If you do not want to use integer attributes and dynamic loops, you will use matrix palettes. Basically each vertex is always influenced by all bones. If in reality given bone does not transform given vertex, it's weight will be 0 for that bone.
Simple matrix palette implementation can kill performance because you have very long list of matrix operations for each vertex, most with weight 0. Depending on model and skeleton complexity it may be beneficial (or necessary) to break model into fragments so that each fragment is influenced by only subset of all bones.
#4927432 2D vs 3D and some other newbie questions
Posted by Lauris Kaplinski on 02 April 2012  04:53 AM
Isometric projection is one kind of 3D projection to 2D surface, the other being perspective projection. So in theory isometric games are 3D. I'm confused by isometric games. Are they 2D, 3D, or can they be both?
Now isometric projection does not have perspective  i.e. all objects appear the same size, regardless of distance. Also, if you do not plan to allow changing of camera angle, all objects ALWAYS appear the same. Thus it is possible to render isometric world with 2D tileset and sprites  and it is often done that way.
Whether it is actually easier to do it in 2D or 3D depends on many factors.
#4879400 I have a problem with theory of relativity
Posted by Lauris Kaplinski on 01 November 2011  03:42 PM
This alone is meaningless statement in STR.This is the scenario:
A spaceship is launched from Earth at a relativistic speed towards a distant planet. One observer is placed on the spaceship and one is placed on the planet.
At the time of launch, two stopwatch clocks are started simultaneously  one on the spaceship and one on the distant planet.
Simultaneity depends on reference frame for any spatially separated events (in this case spaceship and planet). I.e you have to specify in which reference frame  "Earth/Planet" or "moving spaceship" these stopwatches were started simultaneously.
This issue is muddled by the acceleration spaceship has to undertake in above example. But you can make it cleaner so, that spaceship flies with constant speed and synchronizes its clock at the moment, it is passing by Earth in its way towards the planet.
Correct by definition.When the planetbased observer sees 20 years on his stopwatch, the spaceship flies by the planet. Here are my questions:
1. What will the planetbased observer see on his own stopwatch? answer: 20 years
If clocks were started simultaneously in Earth/planet reference frame, then something << 20 years2. What will the planetbased observer see on the ship stopwatch?
If clocks were synchronised in moving spaceship reference frame, then something >> 20 years
Exactly the same value that planetbased observer is seeing (if they are close enough to eachother you can ignore all relativistic effects)3. What will the shipbased observer see on the ship stopwatch?
Also the same value that planetbased observer is seeing (i.e. 20 years)4. What will the shipbased observer see on the planetbased stopwatch?
#4877151 View matrix to reflected view matrix
Posted by Lauris Kaplinski on 26 October 2011  06:12 AM
M'camera = Mreflection * Mcamera
You can take a look at Parts 1.1 and 1.2 of my reflection tutorial, the construction of reflection matrix is shown there (or check any other 3D/matrix/vector geometry reference).
If your water level in scene is Y, the water plane is (0, 1, 0, Y)  assuming Y is upwards direction.
You may also want to add extra mirror transformation (around X or Z axis in your case), to keep the winding (culling) order of polygons intact.
You can also use the same mirror matrix to transform the view and target points (and possibly up vector) for lookAt function.
#4867120 Possible neutrinos travel faster than light
Posted by Lauris Kaplinski on 29 September 2011  04:36 AM
Neutrinos moving faster than light in vacuum does not automatically refute the theory of relativity.In any case, relativity, fasterthanlight communication and causality do not seem to fit together. I personally hope that the last one will be thrown out and the universe turns out to be perfectly deterministic again
 It may be, that relativity still holds, but light itself moves slower than C
 It may be, that neutrinos travel faster than C, but this process does not carry information
 Even if neutrinos can carry information faster than C it may mean, that relativity still holds but causality, as we know it, does not exist in physical world
3. Don't worry, the last one is definitely not the case. Violations of causality are prone to logical contradictions. Logic is the only thing we can always assume in any coherent discussion with out which, the principle of explosion makes the conversation itself meaningless. In so far as we're thinking or talking about anything, logic holds and so must causality.
Causality in philosophy already is logically incoherent, so not big loss here.
Also strictly deterministic theories, like pure Newtonian physics are timesymmetric and thus have no place for true causality. If ball A hits ball B and "causes" it to move, you can simply invert time and say, that ball B "caused" the movement of ball A backwards in time. We can only distinguish between them because of intuitive assignment of causality with forwardintime influences, but this has no any physical meaning.
If Qm anf GTR taught us anything, the most important thing is, that we cannot carry the notions of our daytoday logic naively into physical realms. Of course the theories have to be logically coherent  but "normal" causality does not belong to that part of logic.
2. Neutrinos carry information; that's how they were detected. Neutrino vs. no neutrino is information.
Probably. I simply do not know enough to exclude any entanglementlike setups, where we can postfactum establish, that neutrinos in CERN and Italy "appeared" within certain time interval but not have enough control in CERN to "set" the starting point of given time interval with enough precision.
1. This is... extremely unlikely. Like I mentioned in my post above, light may be being slowed down by something, but the only thing that would have been slowing down light in this experiment relative to cosmic observations would be gravity, and if we allow for gravity to slow down one thing, and not another, we have to disassociate space and time, which refutes special relativity by creating a special reference frame (space) independent of the passage of time experienced by different matter/energy in different places.
Why is gravity "the only thing" that could have slowed down light?
How about our theory of light is completely wrong and it never moves with speed C but always slightly slower depending on other factors than gravity? Thus both special and general relativity can still hold (as C being constant in all reference frames but not the speed of light).
#4866433 Possible neutrinos travel faster than light
Posted by Lauris Kaplinski on 27 September 2011  07:42 AM
According to the theory of relativity there is NO preferred reference frame  thus the descriptions of reality from all inertial reference frames are equally true.What do you mean, 'has travelled backwards in time'? Indeed, faster than light travel would play funny tricks with our perceptions of causality, but not with causality itself. Yes, if you go faster than light, people get to see your present state before ever getting to see your past states. You can do essentially the same thing with a good old mirror.
FTL travel indeed would make traveling backwards in time possible, but not because of some naive interpolation of equations.
According to the theory of relativity, if two spacetime points A & B are separated by spacelike distance (i.e. light cannot travel from A to B before B takes place and vice versa), the timeorder of those events is not definable. I.e. there are always some reference frames, where A happens before B and some where B happens before A.
Now, if somehow something travels from A to B FTL and reaches the spatial location of B "at or before" B takes place, then in those reference frames where B takes place BEFORE A, it has traveled backwards in time.
As I gave in above example  for spacelike events in spacetime there are no fixed (true) order of precedence. If events A and B are separated by spacelike distance, then always for some inertial reference frame (let's call it frameX) event A happens before event B, for some other frame (let's call it frameY) event B happens before event A (and, of course for some frames they are synchronous). And all these descriptions are equally true descriptions of the Universe.
Now, if signal reaches from A to the spatial location of B before ot at the time B takes place, then viewing the situation from reference frame Y:
 Signal reached from A to (the spatial location of) B before B took place
 B happened BEFORE A
#4866373 Possible neutrinos travel faster than light
Posted by Lauris Kaplinski on 27 September 2011  03:58 AM
FTL travel indeed would make traveling backwards in time possible, but not because of some naive interpolation of equations.O RLLY?
snip
What are you talking about the theory of relatively does talk about time and therefore time travel. According to the theory of relatively the faster something travels the slower time passes for that object. Also the higher the gravity around an object the slower time passes for it. Therefore if you travel faster than the speed of light, according to the equation, you would go backwards in time. The notion of time travel was originally proposed by scientist studying relatively, not science fiction writers.
Indeed, more velocity means slower passing of time; but clearly the geometry of the equation doesnt allow for the extrapolation you posit here, since time dilation as a function of v isnt even differentiable at v==c; it has an infinite slope. The correct extrapolation of ever more velocity isnt into negative time; the correct extrapolation is that the function doesnt extend into the v>c domain at all cause it completely curves away from that domain and doesnt point toward it at all.
According to the theory of relativity, if two spacetime points A & B are separated by spacelike distance (i.e. light cannot travel from A to B before B takes place and vice versa), the timeorder of those events is not definable. I.e. there are always some reference frames, where A happens before B and some where B happens before A.
Now, if somehow something travels from A to B FTL and reaches the spatial location of B "at or before" B takes place, then in those reference frames where B takes place BEFORE A, it has traveled backwards in time.
#4866371 Possible neutrinos travel faster than light
Posted by Lauris Kaplinski on 27 September 2011  03:51 AM
I think it is quite well established, that there is no actual difference between "communication" and "effect". Thus if any information can be transmitted FTL, true time travel is also (theoretically) possible.IF this is proven correct and IF we can make use of it the only real use I can see is FTL communication. Now, with respect to light speed this is a form of time travel, in that information could make it from one location to another before light (to use the scifi example you'll be able to see the enemy fire his laser slightly before it starts trying to remove your hull) but it only remains 'time travel' in that sense.
This also would make type 2 perpetum mobile possible, as you could use the information abut future state to influence current state, thus always choosing the state, that will result in minimal future enthropy.
#4865999 Skinning Issues
Posted by Lauris Kaplinski on 26 September 2011  04:34 AM
Btw, what exactly do you mean by bone bind pose matrix? Is it relative to parent or relative to skin?
I usually use the following notation:
 B2P  bone "rest" orientation, relative to parent
 B2S  bone "rest" orientation, relative to object/skin  it is the product of the chain of matrices from root to bone (B2S = B2Sparent * B2P)
 S2P the inverse of B2S
 AB2P  animated orientation of bone  relative to parent
 AB2S  animated orientation of bone  relative to object/skin (AB2S = AB2Sparent * AB2P)
 The matrix you will need (the one transforming skin vertices) is:
 AS2S = AB2S * S2B
#4865876 Shadowmap for multiple omnidirectional lights
Posted by Lauris Kaplinski on 25 September 2011  04:04 PM
I.e. your fragment is in light, if shadow map value is GREATER than fragment distance from light.
#4865852 Atmospheric Scattering  Outscattering integral solution?
Posted by Lauris Kaplinski on 25 September 2011  02:47 PM
h =/= ((A + (C*x/N))  R)
i.e. altitude is not a linear function. You can start from upper atmosphere (A), go through point at sea level and end in upper atmosphere again (B).
#4865235 Shadowmap for multiple omnidirectional lights
Posted by Lauris Kaplinski on 23 September 2011  12:36 PM
Okay, I probably understood what you meant.Thanks for your answer. I've read about the conventional way with a geometry shader, the 6 passes method and also paraboloidmapping. But isn't there a way to skip the projection?
I thought, if I transform the vertices in lightspace, i could use their direction as a cubemap coordinate and their distance from the lightspace nullvector as depthvalue.
Is there really no way to write from fragmentshader to a cubemap with directional texturecoordinates?
I've tried to set gl_Position in the vertexshader of the shadowmapcalculation to the normalized vertexposition in lightspace and to use the vertex's distance to the lightspace nullvector as fragmentcolor. But if I use this shader with an FBO which has cubemaps as depth and colorattachments only one face of the cube is used, the other faces are static but seem to be undefined.
Basically you want to replace standard projection (frustum) with custom calculation of gl_Position.
I think the biggest problem is, that your triangles will not be rasterized over cubemap. Rasterizer projects your triangle to XY viewport plane and then runs fragment shader for all pixels  if, for example, the triangle is parallel to XZ plane in clip coordinates (i.e. after perpective division) it will not be rasterized at all because it covers 0 viewport pixels.
Also do not forget, that single triangle can cover many sides of cubemap. The maximum is 5, although 2 and 3 are probably more common. Rasterization is bound to single layer/viewport I think. And I am pretty sure rasterizer will not select cube map side automatically  you have to do it in geometry shader.
#4865169 Shadowmap for multiple omnidirectional lights
Posted by Lauris Kaplinski on 23 September 2011  09:09 AM
You can still render shadow map in one pass using instancing or geometry shaders, but there is no way to avoid separate projection matrices. Except, of course, dual paraboloid shadow map, but this is quite different issue.
Which method (rendering in 6 passes or using geometry shaders) is actually faster depends AFAIK on GPU and driver versions. If you have frustum culling enabled the amount of geometry rendered is not too different. Doing 6 sides in one pass may actually be bad for memory locality, as all your triangles are each time guaranteed to touch all cubemap sides  but I do not know, how much this may be issue on modern GPUs..
#4862857 normal and wind order
Posted by Lauris Kaplinski on 17 September 2011  11:52 AM
Now, if you want to know the winding order of triangle ABC, you have to calculate the cross product AB X AC. If this is oriented towards you (can be checked with dot product), triangle if CCW.