Jump to content

Josh

Staff
  • Posts

    23,217
  • Joined

  • Last visited

Posts posted by Josh

  1. I'm surprised that bug made it through. You can fix it immediately by setting Shaders\Editor\TerrainTools\Paint.shader pixel shader to this:

    #version 400
    
    uniform vec4 drawcolor;
    uniform vec2 toolradius;
    uniform float strength;
    uniform sampler2D texture0;
    uniform vec2 toolposition;
    uniform vec4 mask;
    
    in vec2 ex_texcoords0;
    in vec4 vertexposition;
    
    out vec4 fragData0;
    
    void main(void)
    {
       vec4 current = texture2D(texture0,ex_texcoords0);
       float d = length(vertexposition.xy-toolposition);
       if (toolradius[1]-toolradius[0]>0.0)
       {
           d = 1.0 - (d - toolradius[0]) /(toolradius[1]-toolradius[0]);
       }
       else
       {
           d = 1.0 - (d - toolradius[0]);
       }
       d = clamp(d,0.0,1.0);
       d *= 0.2 * strength;
       fragData0 = current + d * mask;
    }

    • Upvote 2
  2. The default value is 64,64,64.

     

    You can delete the file C:\Users\username\AppData\local\Leadwerks\Leadwerks.cfg and the editor will reset to its default values. I think there also might be a command-line switch in the readme.txt file for this...

     

    Yes, if you launch the editor with the "-restoreconfig" option it in the command line it should reset the configuration.

    • Upvote 1
  3. My favorite suggestion is the security camera. I'd like to do this, with proper art assets and maybe an extra command to make life easier.

     

    Doing portals would require an additional script function to ignore certain collisions, and it would be a lot of complicated code. It could be done, but that's probably better for one person's individual project.

     

    I'm also interested in machinery and map interactions. Things like a moving crane and mechanical parts make good subjects for lessons.

    • Upvote 4
  4. Here are the values Leadwerks will automatically send to shaders when they are bound:

       	 if (uniform_currenttime) uniform_currenttime->SetFloat(Time::GetCurrent());
           if (uniform_buffersize) uniform_buffersize->SetVec2(Vec2(buffer->GetWidth(),buffer->GetHeight()));
           if (uniform_drawmatrix) uniform_drawmatrix->SetMat4(graphicsdriver->drawmatrix);
           if (uniform_drawcolor) uniform_drawcolor->SetVec4(Leadwerks::GraphicsDriver::GetCurrent()->drawcolor);
           if (uniform_projectionmatrix) uniform_projectionmatrix->SetMat4(graphicsdriver->projectionmatrix);
           if (uniform_isbackbuffer) uniform_isbackbuffer->SetInt(buffer->isbackbuffer);
    
      	 if (world != NULL)
           {
               if (uniform_ambientlight) uniform_ambientlight->SetVec4(world->ambientlight);
               if (uniform_tessstrength) uniform_tessstrength->SetFloat(world->tessellationstrength);
           }
    
      	 if (ActiveCamera!=NULL)
           {
               if (uniform_projectioncameramatrix) uniform_projectioncameramatrix->SetMat4(ActiveCamera->projectioncameramatrix);
               if (uniform_cameraposition) uniform_cameraposition->SetVec3(ActiveCamera->GetPosition(true));
               if (uniform_cameradrawmode) uniform_cameradrawmode->SetInt(ActiveCamera->drawmode);
               if (uniform_cameraprojectionmode) uniform_cameraprojectionmode->SetInt(ActiveCamera->projectionmode);
               if (uniform_lighting_ambient) uniform_lighting_ambient->SetVec4(ActiveCamera->world->ambientlight);
               if (uniform_camerarange) uniform_camerarange->SetVec2(ActiveCamera->range);
               if (uniform_camerazoom) uniform_camerazoom->SetFloat(ActiveCamera->zoom);
               if (uniform_cameramatrix) uniform_cameramatrix->SetMat4(ActiveCamera->mat);
               if (uniform_prevprojectioncameramatrix) uniform_prevprojectioncameramatrix->SetMat4(ActiveCamera->prevprojectioncameramatrix);
               if (uniform_camerainversematrix) uniform_camerainversematrix->SetMat4(ActiveCamera->mat.Inverse());
               if (uniform_cameranormalmatrix) uniform_cameranormalmatrix->SetMat3(Mat3(ActiveCamera->mat));
               if (uniform_camerainversenormalmatrix) uniform_camerainversenormalmatrix->SetMat3(Mat3(ActiveCamera->mat.Inverse()));
           }
           else
           {
               if (uniform_projectioncameramatrix) uniform_projectioncameramatrix->SetMat4(graphicsdriver->projectioncameramatrix);
           }

    Additionally, texture0-15 are automatically initialized to 0,1,2, etc.

    • Upvote 7
  5. Hi everyone,

     

    Im trying to add a skybox, to a new project but it seems im doing something wrong.

     

    I created a terrain (1024x1024) then from the Materials->Sky i drag and drop the Skybox Texture.mat and i get the following messages

     

    Loading material "C:/Users/Matias/Documents/Leadwerks/Projects/TestProject2/Materials/Sky/skybox_texture.mat..."

    Loading shader "C:/Users/Matias/Documents/Leadwerks/Projects/TestProject2/shaders/model/flat/sky.shader"...

    Loading texture "C:/Users/Matias/Documents/Leadwerks/Projects/TestProject2/Materials/Sky/skybox_texture.tex..."

    Deleting material "C:/Users/Matias/Documents/Leadwerks/Projects/TestProject2/Materials/Sky/skybox_texture.mat"

    Deleting shader "C:/Users/Matias/Documents/Leadwerks/Projects/TestProject2/shaders/model/flat/sky.shader"

    Deleting texture "C:/Users/Matias/Documents/Leadwerks/Projects/TestProject2/Materials/Sky/skybox_texture.tex"

     

    Any ideas on what am i doing wrong?

     

    Any help appreciated.

    I recommend attaching your map file in this forum so we can try it ourselves and see.
  6. To set the animation shader...in the material editor, there is a tab called "Shader". There are two shaders you can set there. For the regular shader choose the file "Shaders\Model\Animated\diffuse+normal+specular.shader". For the shadow shader (this gets used to render shadowmaps) choose "Shaders\Model\Shadow\shadow+animation.shader".

     

    See the crawler character's material to see what it uses.

  7. First off, your map is really cool. I'm really super happy to see this level of interactivity so early, it's really encouraging.

     

    When bushes are loaded in a map, the engine collapses them down into merged static geometry, if certain conditions are met. If the brush has 0 mass, no script attached, and some other things, it is assumed the user wants it collapsed. In your case, of course, this was wrong.

     

    Rather than keep guessing, and having to add more and more conditions in the future, I should probably add a checkbox in the editor so the user can control whether it gets merged or not. I'm sorry this slowed you down. Your map is pretty interesting to explore already.

     

    One thing you could do immediately is add an empty script to each child brush. This will prevent the brushes from being merged, but won't add any behavior to them.

  8. Wow, that is disturbing. Good thing we have our live shader editor. This is exactly what I did, and it worked right away:

     

    1. Open the material for her face and body.

    2. Select the Shader tab in the Material Editor.

    3. Press the Edit button next to the shader. The shader will be opened in the Shader Editor.

    4. Select the Vertex shader in the left-hand panel.

     

    post-1-0-18770700-1389500045_thumb.jpg

     

    5. On line 44 change it so the normal is being normalized. Press F5 and presto!

     

    post-1-0-93803300-1389500066_thumb.jpg

    • Upvote 1
×
×
  • Create New...