Jump to content

tjheldna

Members
  • Posts

    938
  • Joined

  • Last visited

Posts posted by tjheldna

  1. It was hard to track down but I found it!!! I did this years ago so you will need to test it and you will need to bundle the oalinst.exe in your application as the script suggests.

     

    [code]
    var OpenALFound: Boolean;
    function CheckOpenAL(): Boolean;
    begin
    if (FileExists('c:\Windows\System32\OpenAL32.dll')) then begin
    MsgBox('OpenAL detected. OpenAL installation skipped', mbInformation, MB_OK);
    OpenALFound := True;
    end;
    
    if (not OpenALFound) then begin
    MsgBox('OpenAL not detected. Click OK to install OpenAL', mbInformation, MB_OK);
    OpenALFound := False;
    end;
    Result := OpenALFound;
    end;
    [Run]
    Filename: "{app}\oalinst.exe"; StatusMsg: "Installing OpenAL"; Check: Not CheckOpenAL();
    

    • Upvote 2
  2. Thanks shadmar for looking at it, that worked. Ha didn't realise I'm re-inventing the wheel. No matter it's all good practice as i'm trying to get my head around shaders.

    • Upvote 1
  3. I took a leaf out of this book and tried a flame shader and to my surprise I managed to get it in...

     

    https://www.shadertoy.com/view/XsXSWS

     

    post-5086-0-62460900-1436568706_thumb.png

     

    I created a material using that shader and assigned it to a billboard which works great. Only thing is the flame is pointing upside down and can't work out why? Any Ideas?

     

     

    Vert

    #version 400
    #define MAX_INSTANCES 256
    //Uniforms
    //uniform mat4 entitymatrix;
    uniform vec4 materialcolordiffuse;
    uniform mat4 projectioncameramatrix;
    uniform mat4 camerainversematrix;
    uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity;
    uniform vec4 clipplane0 = vec4(0.0);
    //Attributes
    in vec3 vertex_position;
    in vec4 vertex_color;
    in vec2 vertex_texcoords0;
    in vec3 vertex_normal;
    in vec3 vertex_binormal;
    in vec3 vertex_tangent;
    //Outputs
    out vec4 ex_color;
    out vec2 ex_texcoords0;
    out float ex_selectionstate;
    out vec3 ex_VertexCameraPosition;
    out vec3 ex_normal;
    out vec3 ex_tangent;
    out vec3 ex_binormal;
    out float clipdistance0;
    void main()
    {
    mat4 entitymatrix = entity.matrix[gl_InstanceID];
    mat4 entitymatrix_=entitymatrix;
    entitymatrix_[0][3]=0.0;
    entitymatrix_[1][3]=0.0;
    entitymatrix_[2][3]=0.0;
    entitymatrix_[3][3]=1.0;
    
    vec4 modelvertexposition = entitymatrix_ * vec4(vertex_position,1.0);
    
    //Clip planes
    if (length(clipplane0.xyz)>0.0001)
    {
    clipdistance0 = modelvertexposition.x*clipplane0.x + modelvertexposition.y*clipplane0.y + modelvertexposition.z*clipplane0.z + clipplane0.w;
    }
    else
    {
    clipdistance0 = 0.0;
    }
    
    ex_VertexCameraPosition = vec3(camerainversematrix * modelvertexposition);
    gl_Position = projectioncameramatrix * modelvertexposition;
    mat3 nmat = mat3(camerainversematrix);//[0].xyz,camerainversematrix[1].xyz,camerainversematrix[2].xyz);//39
    nmat = nmat * mat3(entitymatrix[0].xyz,entitymatrix[1].xyz,entitymatrix[2].xyz);//40
    ex_normal = normalize(nmat * vertex_normal);
    ex_tangent = normalize(nmat * vertex_tangent);
    ex_binormal = normalize(nmat * vertex_binormal);
    
    ex_texcoords0 = vertex_texcoords0;
    
    ex_color = vec4(entitymatrix[0][3],entitymatrix[1][3],entitymatrix[2][3],entitymatrix[3][3]);
    
    //If an object is selected, 10 is subtracted from the alpha color.
    //This is a bit of a hack that packs a per-object boolean into the alpha value.
    ex_selectionstate = 0.0;
    if (ex_color.a<-5.0)
    {
    ex_color.a += 10.0;
    ex_selectionstate = 1.0;
    }
    
    ex_color *= vec4(1.0-vertex_color.r,1.0-vertex_color.g,1.0-vertex_color.b,vertex_color.a) * materialcolordiffuse;
    }
    

     

     

    Frag

    #version 400
    #define BFN_ENABLED 1
    uniform vec2 buffersize;
    uniform float currenttime;
    //Uniforms
    uniform sampler2D texture0;//diffuse map
    uniform samplerCube texture15;//BFN map
    uniform vec4 materialcolorspecular;
    uniform vec4 lighting_ambient;
    uniform float FLAME_SPEED = 2.0;
    uniform float flame_strength = 1.0;
    uniform float flame_length = .75;
    //Lighting
    uniform vec3 lightdirection[4];
    uniform vec4 lightcolor[4];
    uniform vec4 lightposition[4];
    uniform float lightrange[4];
    uniform vec3 lightingcenter[4];
    uniform vec2 lightingconeanglescos[4];
    uniform vec4 lightspecular[4];
    uniform vec4 clipplane0 = vec4(0.0);
    //Inputs
    in vec2 ex_texcoords0;
    in vec4 ex_color;
    in float ex_selectionstate;
    in vec3 ex_VertexCameraPosition;
    in vec3 ex_normal;
    in vec3 ex_tangent;
    in vec3 ex_binormal;
    in float clipdistance0;
    out vec4 fragData0;
    out vec4 fragData1;
    out vec4 fragData2;
    out vec4 fragData3;
    
    // procedural noise from IQ
    vec2 hash( vec2 p )
    {
    p = vec2( dot(p,vec2(127.1,311.7)),
    dot(p,vec2(269.5,183.3)) );
    return -1.0 + 2.0*fract(sin(p)*43758.5453123);
    }
    float noise( in vec2 p )
    {
    const float K1 = (sqrt(3)-1)/2;
    const float K2 = (3-sqrt(3))/6;
    
    vec2 i = floor( p + (p.x+p.y)*K1 );
    
    vec2 a = p - i + (i.x+i.y)*K2;
    vec2 o = (a.x>a.y) ? vec2(1.0,0.0) : vec2(0.0,1.0);
    vec2 b = a - o + K2;
    vec2 c = a - 1.0 + 2.0*K2;
    
    vec3 h = max( 0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );
    
    vec3 n = h*h*h*h*vec3( dot(a,hash(i+0.0)), dot(b,hash(i+o)), dot(c,hash(i+1.0)));
    
    return dot( n, vec3(70.0) );
    }
    float fbm(vec2 uv)
    {
    float f;
    mat2 m = mat2( 1.6, 1.2, -1.2, 1.6 );
    f = 0.5000*noise( uv ); uv = m*uv;
    f += 0.2500*noise( uv ); uv = m*uv;
    f += 0.1250*noise( uv ); uv = m*uv;
    f += 0.0625*noise( uv ); uv = m*uv;
    f = 0.5 + 0.5*f;
    return f;
    }
    // no defines, standard redish flames
    //#define BLUE_FLAME
    //#define GREEN_FLAME
    void main(void)
    {
    //Clip plane discard
    if (clipdistance0>0.0) discard;
    
    vec4 outcolor = ex_color;
    vec4 color_specular = materialcolorspecular;
    vec3 normal = ex_normal;
    vec2 uv = ex_texcoords0;
    
    vec2 q = uv;
    q.x *= 5.;
    q.y *= 2.;
    float strength = floor(q.x+1.3);
    float T3 = currenttime/1000.0 * FLAME_SPEED;
    q.x = mod(q.x,1.)-0.5;
    q.y -= 0.25;
    float n = fbm(strength*q - vec2(0,T3));
    float c = 1. - 16. * pow( max( 0., length(q*vec2(1.8+q.y*1.5,.75) ) - n * max( 0., q.y+.25 ) ),1.2 );
    // float c1 = n * c * (1.5-pow(1.25*uv.y,4.));
    float c1 = n * c * (1.5-pow(2.50*uv.y,4.));
    c1=clamp(c1,0.,1.);
    vec3 col = vec3(1.5*c1, 1.5*c1*c1*c1, c1*c1*c1*c1*c1*c1);
    #ifdef BLUE_FLAME
    col = col.zyx;
    #endif
    #ifdef GREEN_FLAME
    col = 0.85*col.yxz;
    #endif
    
    float a = c * (1.-pow(uv.y,0.9));
    //fragColor = vec4( mix(vec3(0.),col,a), 1.0);
    
    if (a < 0.4) discard;
    //Modulate blend with diffuse map
    outcolor *= vec4( mix(vec3(0.0, 0.0, 0.0),col,a), a);
    
    //Blend with selection color if selected
    fragData0 = outcolor;// * (1.0-ex_selectionstate) + ex_selectionstate * (outcolor*0.5+vec4(0.5,0.0,0.0,0.0));
    
    
    #if BFN_ENABLED==1
    //Best-fit normals
    fragData1 = texture(texture15,normalize(vec3(normal.x,-normal.y,normal.z)));
    fragData1.a = fragData0.a;
    #else
    //Low-res normals
    fragData1 = vec4(normalize(normal)*0.5+0.5,fragData0.a);
    #endif
    fragData1.a = materialcolorspecular.r * 0.299 + materialcolorspecular.g * 0.587 + materialcolorspecular.b * 0.114;
    int materialflags=1;
    if (ex_selectionstate>0.0) materialflags += 2;
    
    
    fragData2 = vec4(0.0,0.0,0.0,materialflags/255.0);
    }
    

     

    You can get a single flame by playing with these values:

    q.x *= 5.;

    q.y *= 2.;

    • Upvote 1
  4. I came across this a day or two ago and wish I researched into Modo's animation system a bit more thoroughly. I'm posting this as it may help someone out too.

     

    In Modo's 'Animate' I've become accustomed to creating all my animations in a single string well that's no more.

     

    If you create an 'Action' for each of your animations and create each animation in the specified action. For example a 'idle' action is been created and selected, I then created the idle animation, same for run, walk etc.

     

    See image.

     

    post-5086-0-65826100-1435661994_thumb.png

     

    In Modos .fbx preferences have 'Export actions into separate takes' selected before exporting

     

    post-5086-0-28307600-1435662023_thumb.png

     

    When imported into the animated model Leadwerks editor, each 'take' will be imported as a separate animation with the animation length being the start and end key frames of each 'action'/'take'.

     

    Doing it this way does away with some of the need to create the text file to define animations or creating them manually. Two major benefits are that at any stage I can increase/decrease the number of frames of any animation and LE will import it perfectly and it really is nice being able to isolate and work on one animation at a time.

     

    Now that I have delved deeper into Modo's animation's tab further, it really is great to use.

    • Upvote 1
  5. Thanks Macklebee for pointing me in the right direction. I got it working in one line.

     

    //Decals

    outcolor = mix(ex_color, texture(texture0, ex_texcoords0), texture(texture0,ex_texcoords0).a)

     

     

    post-5086-0-28984500-1435371159_thumb.png

     

    Summer Games Tournament Truck01 thanks you!

    • Upvote 4
  6. Hi All,

     

    I'm trying my hand at modifying the diffuse_normal shader to do a particular task.

     

    Basicly I want to texture cars using rgb values with a decal texture overlay. Doing this I can easily change the color of the cars paintwork using rgb values but keep things like lights, damage, interior the same.

     

     

    This does work but one thing I can't do is get a nice alpha fade off, blended by the alpha value on the texture with the rgb value.

     

    float textureAlpha = texture(texture0,ex_texcoords0).a;
    
    if(textureAlpha > 0.0)
    {
    outcolor = texture(texture0,ex_texcoords0);
    }
    else
    {
    outcolor = (ex_color * (1.0 - texture(texture0,ex_texcoords0).a));
    }

     

    post-5086-0-65969700-1435360550.png

     

     

    If I change the 0.0 value I get various results but always a hard line around the decals where I'm trying to blend with the texture alpha.

     

    Any insight into this would be great!

     

    Thanks

  7. Collision hull is now working again thanks.

     

    If you have a model with "collisionhull" already imported and you re-export the model overwriting it with a different/changed "collisionhull" the model wont update in the editor.

     

    The only way to get it to update is to update the .phy file first then re-export.

  8. Hi commanderz,

     

    I'm a Modo user too (801). Skinned animations do work. To export an animated rig you need to "bind" the skeleton to the mesh under the setup tab after that it creates a vertex weight map and you can paint vertex weights for deformation.

     

    There is an import issue with the fbx export and Modo. Modo works in meters and LE works in cm. If you set the scale in Modo to export to 0.01 to convert meters to cm which this conversion dosen't work. Everything I export into LE I need to be scaled by 0.01 for correct size. I think Josh is looking into this.

     

    There are few little quirks but all in all it should work.

  9. I was using collision hull a week or two ago and worked fine and exported a number of meshes. I've exported two models now with the child mesh named collisionhull and in the model viewer its coming up as polymesh where before it converted the collisionhull mesh by default.

     

     

    I also think the collisionhull mesh didn't appear in the scene view but it is now (can't remember exactly).

  10. If you have multiple items selected and rotate, the models rotate on their local axis with a gizmo appearing for each.

     

     

    Problem if i piece together a few things i.e bathroom cabinets, sink and bench, mirror and I want to rotate them all to another wall the only option is to rotate them on their local axis so if I do rotate I need to re-align them all which is proving quite painful.

     

     

    I have a few suggestions here:

     

    - Mutiple items to have only 1 gizmo at the centre of the selected items.

     

    - Another plug for a rotate and scale gizmo.

     

    - If you have the 'global coordinates' selected all models rotate about that centre axis else models rotate about their local axis like it is now.

     

    [edit]

     

    - Adjustable rotation angle snap

    • Upvote 1
  11. Thanks Shadmar and Macklebee for your help it is really appreciated. Seems Josh was 1 step ahead of me with the collision and you can do it directly from the modeling program like I was wanting, I must have missed that memo or not understood something. I take back all the swear words I said to the editor when I was doing it the hard way.

     

    Thinking about it it's better looking stupid and finding now when I've 5 houses completed compared to 50 still I have some work to do.

     

    Thanks again

    • Upvote 1
  12. Hi Josh, and thanks for your comments I appreciate it.

     

    In the case of physics shapes, it was found after preparing the scifi model pack that this was a major deficiency...without revising this, it would be impossible to add any new DLCs, or expect people to release ready-made items.

     

    Don't get me wrong, your phy shape implementation is fantastic. I believe the big difference here is creating a model pack and using the models in a level are two different things. Issues like navmesh generation, wasn't on my mind when modeling till I realised that the door frames was stopping the generation because it had collision on it (the fit is as tight as I can get it around doors). Also I don't want all the collision detail in window frames, house fixtures etc, but want the detail in the model so there are savings to be had. You can see the phy file sizes being decimated in my comparisons and sure this will make in game savings too.

     

    I do propose a solution:

    • In your modeling program you can have a child mesh which needs to be named 'HINT' or something
    • In the model viewer if you select 'PolyMesh' and you have the child named 'HINT' a shape is generated from the 'HINT' model else it uses the actual model as it does now.
    • The 'HINT model is removed when the level is run similar to the method using Brushes.

    I recon that would keep everyone happy.

     

    These are available by enabling the EnableLegacyFeatures in the config file. The auto-generation tool in the model editor (or building shapes into the model with named limbs) is the recommended approach.

     

    I'm wary of becoming dependent on a feature that is labeled legacy

     

    This has been disabled for now due to a serious bug that could arise in some situations. it needs to be rewritten to work correctly. I expect this will be revised soon.

     

    No worries, this tool has saved me in the passed with rigs not exported properly. Being able to visually see it when the imports/exports don't line up is where this feature really shines.

     

    I listed this a few weeks ago as one of the usability improvements I wanted to make here. I don't always get the workflow right on my first attempt, and it's important to improve things when a better way is found. I've taken measures to make the workflow backwards compatible with the old approach.

     

    I took a look at the new way in an older project I have. In general I think it's now open to a lot of user error, some form of fool proof way of validating and assigning a uniquely named model has to be done imo. That being said because I was working off unique names anyway it didn't break anything.

     

    @Shadmar

     

    I mean with being able to create your own exported collision mesh and use that easily. With the house models I'm doing the collision has to be very tight.

     

    Cheers

  13. Lately using LE it feels like there are features being removed or changed with no real warning. One of the items is referring to the beta branch.

     

    Here are my examples:

    • Custom collision meshes - This is the one I miss the most, I'm never going to stop on this one, so useful. I've decimated the file size of every .phy file I've optimised and no doubt making a difference in game.
    • Resize and position collision shapes - key adjustment values for collision optimisation. The editor has no idea of where I want the shape or it's orientation, so why let it choose it for me?
    • Skeleton View in model editor - great for debugging your exported rig
    • Target entity field now a text box - I've used it now and if it wasn't intuitive before it's even more so now. I'm not sure why the way this field used to work is now the devil.

    Being a strict C++ user and no use for the game player etc it actually feels like features have not only ground to a halt, but going backwards.

     

    I'm not mad or anything, I just want to voice that these changes are effecting my LE workflow in a negative way.

     

    Cheers

    • Upvote 8
×
×
  • Create New...