Jump to content

Ma-Shell

Members
  • Posts

    371
  • Joined

  • Last visited

Posts posted by Ma-Shell

  1. I wouldn't think you'd need to iterate over all the lights. You should be able to do the raycast from inside the csg light collision function the player is colliding with.

    OK, you're right with that one.

     

    The csg matching should handle the falloff then too with good enough precision so nothing to do there as the shape itself is the falloff distance I would think.

    Not really sure, how to interprete that one. Do you only want to distinguish two states ("dark enough to be considered outside the light" and "bright enough to be considered inside the light")?

  2. Actually such a collision wouldn't necessarily mean that the player is really exposed to the light source, as there might be walls or anything else between the player and the light.

    Also I assume pointlights should have some kind of falloff (the nearer the brighter), so it would be hard to determine which size the sphere should be.

    Instead you should iterate through all the lights and

    1. perform a raytrace to determine if you are exposed to the lightsource.

    2. for lights that have a falloff (pointlights and spotlights?) check the distance

    3. for lights with an angle (directional lights and spotlights) calculate the angle.

     

    The only part of that you could make easier by these proposed csg-shapes would be the third one, but that is also easily achievable by using the acos of the dot product of the normalized light's viewing vector and the normalized vector from the player towards the light.

  3. Is there any bottleneck problem in LE3 with ressources priorities and allocations or GPU ?

    - LE3 alone : 30 fps (1368*1024)

    - Crysis and LE3 : LE3 drops down to 10 fps

     

    What exactly do you want to say with this? You didn't expect that the frames will drop, when you start another highly demanding program?

  4. Learning to program shaders is a real useful thing.

    For a start, you should have some fundamental knowledge about the basics of vector-maths (dot-product, cross-product, length, vector*matrix,...).

    Once you got that, you should make yourself familiar with the "programmable function pipeline" to learn, which kinds of shaders exist and what they do. (You will mainly focus on vertex- and fragment-shaders but there also exist three more (control, evaluation and geometry), which you should only mess with, once you got yourself comfortable with the former two.

    Then you should look at some existing shaders and try making little changes to them. You can't imagine, how satisfying it is to get your first wobbling teapot by moving a vertex along its normal with the sinus of the time ;). There are tons of good tutorials out there, but I think, it's important to keep messing around.

     

    I found that this site helped me a lot: https://coolcodea.wordpress.com/category/shaders/page/5/

    • Upvote 1
  5. i.e. In the vertex-shader: at the beginning (where all the uniforms are declared) add:

    uniform float currenttime;

    then search for the line

    ex_texcoords0 = vertex_texcoords0;

    and add below that:

    ex_texcoords0.y -= currenttime*0.0005;

     

    (The uniform will automatically be filled with its correct value)

    • Thanks 1
    • Upvote 1
  6. The problem with GEMA in germany is not that we are not allowed to listen to it, but that youtube is not allowed to present it to us. GEMA is short for "Gesellschaft für musikalische Aufführungs- und mechanische Vervielfältigungsrechte" (Society for musical presentation- and mechanical copyrights). They demand to get payed by everyone who is playing music to anyone in public and give a part of that money to the artists (cough, cough). The problem is, that they don't come to terms with youtube and so they keep suing them and requesting videos to be blocked because youtube doesn't have the license to show that music. By now youtube got quite pissed and started to automatically block videos where they aren't sure, whether they are allowed to show it, so they don't.

    In your video it says (translated): This video isn't available in Germany, because it might include music by SME, for the usage of which they couldn't yet come to terms with GEMA. They are sorry.

    • Upvote 1
  7. You are aware, that your ray goes into y-direction, which is upwards? I think you rather meant to edit z, not y (as anything with a mass won't stay above you for long ;) ) Also these are global coordinates, so you would probably want to move the points along forward direction, not along a constant axis.

  8. What are the issues with having a parent with many children, anything major?

     

    I think, the problem is not about having a parent with many children but having many objects. AFAIK it doesn't matter, if your objects are parented to anything but if you are trying a modular aproach, you likely turn out with really many objects for which you need to store things like transformation matrix etc. So, if your house consists of only one Object, which holds all the geometry description, you will only need one transformation matrix. If your house consists of an entity, which is parent to 4 Wall-Objects, one roof-object, 5 window-objects and one door-object, you will have to store 1+4+1+5+1=12 transformation matrices (and additional overhead for each object).

     

    EDIT:

    OK, it does matter, if those things are parented to an entity, because e.g. you will have to generate a new global transformation-matrix (by transforming the local transformation-matrix of the child with the parent's one.)

  9. You are right. A matrix-multiplication with the vector (0,0,1,0)^T is just the third column. rolleyes.gif

    Doing it your way, we can get rid of the for-loops and the matrix-transposition.

  10. Hi,

    I noticed, Leadwerks has functions for transforming vectors and points to different spaces. However, I am not really sure, what to think of the following things:

     

    I would have thought, transformation of the point A into the space of the matrix M simply means multiplying the matrix (from left) with setting the fourth coordinate of the point to 1:

    A' = M*A

    The same for vectors but just have the fourth coordinate be 0 instead of 1. I wrote the following code to do a matrix multiplication:

     

    ret = Vec4(0)
    for i = 0,3,1 do
    ret[i] = 0
    for j = 0,3,1 do
     ret[i] = ret[i] + M[i][j] * A[j]
    end
    end
    

     

    (I also noticed, the matrix of self.entity:GetMatrix() has to be transposed before doing this because otherwise the last row is not 0,0,0,1, which is a MUST for transformation-matrices).

    However,

    Transform:Vector() and Transform:Point() all yield different results and I can't figure out, why.

    Transform:Vector yields quite similar results to my function, if I do not transpose the matrix beforehand, except for the fourth coordinate. The values yielded by Transform:Point() don't seem to be related to my values at all. Consider the following example code:

     

    local M = self.entity:GetMatrix():Transpose()
    local A = Vec4(0,0,1,0)
    System:Print(mat)
    ret = Vec4(0)
    for i = 0,3,1 do
    ret[i] = 0
    for j = 0,3,1 do
     ret[i] = ret[i] + M[i][j] * A[j]
    end
    end
    
    local a = Vec3(0,0,1)
    local v = Transform:Vector(a, nil, self.entity)
    System:Print(v[0] .. "," .. v[1] .. "," .. v[2] .. "," .. v[3])
    local v = Transform:Point(a, nil, self.entity)
    System:Print(v[0] .. "," .. v[1] .. "," .. v[2] .. "," .. v[3])
    System:Print(ret[0] .. "," .. ret1] .. "," .. ret[2] .. "," .. ret[3])
    

     

    All of these yield different values, when actually Transform:Vector should be the same. If I change the last coordinate of A to 1 instead of 0, Transform:Point should be the same. Can anyone enlighten me on this?

×
×
  • Create New...